Mercurial > libervia-backend
comparison setup.py @ 1154:6365e6826831
misc (install): use os.symlink instead of distutils.file_util.copy_file to avoid error when --root is used
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 03 Sep 2014 17:18:27 +0200 |
parents | 25a16df15ae2 |
children | a1d47760df3f |
comparison
equal
deleted
inserted
replaced
1153:25a16df15ae2 | 1154:6365e6826831 |
---|---|
119 | 119 |
120 def custom_create_links(self): | 120 def custom_create_links(self): |
121 """Create symbolic links to executables""" | 121 """Create symbolic links to executables""" |
122 # the script which launch the daemon | 122 # the script which launch the daemon |
123 for source, dest in self.sh_script_links: | 123 for source, dest in self.sh_script_links: |
124 if os.path.islink(dest) and os.readlink(dest) != source: | 124 if self.root is None: |
125 os.remove(dest) # copy_file doesn't force the link update | 125 if os.path.islink(dest) and os.readlink(dest) != source: |
126 dest_name, copied = copy_file(source, dest, link='sym') | 126 os.remove(dest) # copy_file doesn't force the link update |
127 assert copied | 127 dest_name, copied = copy_file(source, dest, link='sym') |
128 # we change the perm in the same way as in the original install_scripts | 128 assert copied |
129 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 | 129 # we change the perm in the same way as in the original install_scripts |
130 os.chmod(dest_name, mode) | 130 mode = ((os.stat(dest_name)[ST_MODE]) | 0555) & 07777 |
131 os.chmod(dest_name, mode) | |
132 else: | |
133 # if root is not None, source probably doesn't exist yet | |
134 # this is not managed by copy_file, so we must use os.symlink directly | |
135 if os.path.islink(dest): | |
136 os.remove(dest) # symlink doesn't force the link update | |
137 os.symlink(source, dest) | |
131 | 138 |
132 def run(self): | 139 def run(self): |
133 ignore_idx = 0 if self.root is None else len(self.root) | 140 ignore_idx = 0 if self.root is None else len(self.root) |
134 if self.root[-1] == '/': | 141 if self.root[-1] == '/': |
135 ignore_idx-=1 # we dont want to remove the first '/' in _final paths | 142 ignore_idx-=1 # we dont want to remove the first '/' in _final paths |