diff options
author | James E.H. Turner <jturner@gemini.edu> | 2016-09-01 17:29:22 -0400 |
---|---|---|
committer | James E.H. Turner <jturner@gemini.edu> | 2016-09-01 17:29:22 -0400 |
commit | 1c431a933c12ca0cf928a382df3b5ab3ceb971d4 (patch) | |
tree | 8b55650eb933781de1e1e876e1b846b9ad8d2512 | |
parent | 87b72507c22cf64a7ce7148251018048c1522ef2 (diff) | |
download | astroconda-iraf-helpers-1c431a933c12ca0cf928a382df3b5ab3ceb971d4.tar.gz |
Create a new file when editing extern.pkg, otherwise conda's hard links propagate changes to the master IRAF package and other installations!
-rwxr-xr-x | scripts/ac_update_extern_pkg | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/scripts/ac_update_extern_pkg b/scripts/ac_update_extern_pkg index e6f1e60..ee618c3 100755 --- a/scripts/ac_update_extern_pkg +++ b/scripts/ac_update_extern_pkg @@ -36,6 +36,7 @@ args = parser.parse_args() # an iraf_extern/package/ur_extern.pkg (ie. files already installed): path = os.path.abspath(args.path) # env dir with extern.pkg extpkg_path = os.path.join(path, extern_pkg) # extern.pkg path +extbak_path = os.path.join(path, extpkg_bak) # path to backup copy pkg_path = os.path.join(path, extern_dir, args.name) # path to this IRAF pkg template_path = os.path.join(pkg_path, template) # this ur_extern.pkg @@ -153,9 +154,13 @@ else: buffer += keep_str # Back up the original extern.pkg: -shutil.copy2(extpkg_path, os.path.join(path, extpkg_bak)) +os.rename(extpkg_path, extbak_path) -# Write the modified extern.pkg: +# Write the modified extern.pkg as a new file with the same name, otherwise +# conda's hard linking propagates its changes to other environments!: with open(extpkg_path, 'w') as extpkg_file: extpkg_file.write(buffer) +# Inherit permissions from the original copy (just as good practice): +shutil.copymode(extbak_path, extpkg_path) + |