comparison setup.py @ 493:636b6c477a87

setup: tiny factorisation
author souliane <souliane@mailoo.org>
date Tue, 15 Jul 2014 13:39:36 +0200
parents 1a0cec9b0f1e
children b483f1c88b7c
comparison
equal deleted inserted replaced
492:a7f5448a1bc3 493:636b6c477a87
100 100
101 def custom_create_links(self): 101 def custom_create_links(self):
102 """Create symbolic links to executables""" 102 """Create symbolic links to executables"""
103 # the script which launch the daemon 103 # the script which launch the daemon
104 for source, dest in self.sh_script_links: 104 for source, dest in self.sh_script_links:
105 dest = os.path.join(self.install_scripts, dest)
106 if os.path.islink(dest) and os.readlink(dest) != source: 105 if os.path.islink(dest) and os.readlink(dest) != source:
107 os.remove(dest) # copy_file doesn't force the link update 106 os.remove(dest) # copy_file doesn't force the link update
108 dest_name, copied = copy_file(source, dest, link='sym') 107 dest_name, copied = copy_file(source, dest, link='sym')
109 assert (copied) 108 assert (copied)
110 # we change the perm in the same way as in the original install_scripts 109 # we change the perm in the same way as in the original install_scripts
132 shutil.rmtree(html, ignore_errors=True) 131 shutil.rmtree(html, ignore_errors=True)
133 shutil.copytree(self.pyjamas_output_dir, html) 132 shutil.copytree(self.pyjamas_output_dir, html)
134 133
135 def run(self): 134 def run(self):
136 self.sh_script_path = os.path.join(self.install_lib, NAME, 'libervia.sh') 135 self.sh_script_path = os.path.join(self.install_lib, NAME, 'libervia.sh')
137 self.sh_script_links = [(self.sh_script_path, LAUNCH_DAEMON_COMMAND)] 136 self.sh_script_links = [(self.sh_script_path, os.path.join(self.install_scripts, LAUNCH_DAEMON_COMMAND))]
138 self.install_data_dir = os.path.join(self.install_data, 'share', NAME) 137 self.install_data_dir = os.path.join(self.install_data, 'share', NAME)
139 self.pyjamas_output_dir = os.path.join(os.getcwd(), 'html') 138 self.pyjamas_output_dir = os.path.join(os.getcwd(), 'html')
140 sys.stdout.write('running pre installation stuff\n') 139 sys.stdout.write('running pre installation stuff\n')
141 sys.stdout.flush() 140 sys.stdout.flush()
142 if PURGE_OPT in install_opt: 141 if PURGE_OPT in install_opt:
184 self.install_data_dir, 183 self.install_data_dir,
185 os.path.join(self.install_data, 'share', 'doc', NAME), 184 os.path.join(self.install_data, 'share', 'doc', NAME),
186 os.path.join(self.install_lib, "%s-py%s.egg-info" % (self.config_vars['dist_fullname'], self.config_vars['py_version_short'])), 185 os.path.join(self.install_lib, "%s-py%s.egg-info" % (self.config_vars['dist_fullname'], self.config_vars['py_version_short'])),
187 ]) 186 ])
188 for source, dest in self.sh_script_links: 187 for source, dest in self.sh_script_links:
189 dest = os.path.join(self.install_scripts, dest)
190 if os.path.islink(dest): 188 if os.path.islink(dest):
191 to_remove.append(dest) 189 to_remove.append(dest)
192 plugin_file = os.path.join(self.install_lib, 'twisted', 'plugins', NAME) 190 plugin_file = os.path.join(self.install_lib, 'twisted', 'plugins', NAME)
193 if os.path.isfile(plugin_file): 191 if os.path.isfile(plugin_file):
194 to_remove.append(plugin_file) 192 to_remove.append(plugin_file)