diff --git a/setup.py b/setup.py index 22e3cc2d..df66557f 100644 --- a/setup.py +++ b/setup.py @@ -121,13 +121,20 @@ class CustomInstall(install): """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)