From 1c431a933c12ca0cf928a382df3b5ab3ceb971d4 Mon Sep 17 00:00:00 2001 From: "James E.H. Turner" Date: Thu, 1 Sep 2016 18:29:22 -0300 Subject: Create a new file when editing extern.pkg, otherwise conda's hard links propagate changes to the master IRAF package and other installations! --- scripts/ac_update_extern_pkg | 9 +++++++-- 1 file 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) + -- cgit