# HG changeset patch # User Goffi # Date 1409757507 -7200 # Node ID 6365e6826831521c66d1e18b6666c483855014cb # Parent 25a16df15ae21c34fb5ac54194187370055f5086 misc (install): use os.symlink instead of distutils.file_util.copy_file to avoid error when --root is used diff -r 25a16df15ae2 -r 6365e6826831 setup.py --- a/setup.py Wed Sep 03 16:40:52 2014 +0200 +++ b/setup.py Wed Sep 03 17:18:27 2014 +0200 @@ -121,13 +121,20 @@ """Create symbolic links to executables""" # the script which launch the daemon for source, dest in self.sh_script_links: - if os.path.islink(dest) and os.readlink(dest) != source: - os.remove(dest) # copy_file doesn't force the link update - dest_name, copied = copy_file(source, dest, link='sym') - assert copied - # we change the perm in the same way as in the original install_scripts - mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 - os.chmod(dest_name, mode) + if self.root is None: + if os.path.islink(dest) and os.readlink(dest) != source: + os.remove(dest) # copy_file doesn't force the link update + dest_name, copied = copy_file(source, dest, link='sym') + assert copied + # we change the perm in the same way as in the original install_scripts + mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 + os.chmod(dest_name, mode) + else: + # if root is not None, source probably doesn't exist yet + # this is not managed by copy_file, so we must use os.symlink directly + if os.path.islink(dest): + os.remove(dest) # symlink doesn't force the link update + os.symlink(source, dest) def run(self): ignore_idx = 0 if self.root is None else len(self.root)