Show More
@@ -74,10 +74,6 b' from setupbase import (' | |||
|
74 | 74 | check_package_data_first, |
|
75 | 75 | find_data_files, |
|
76 | 76 | git_prebuild, |
|
77 | install_symlinked, | |
|
78 | install_lib_symlink, | |
|
79 | install_scripts_for_symlink, | |
|
80 | unsymlink, | |
|
81 | 77 | ) |
|
82 | 78 | |
|
83 | 79 | #------------------------------------------------------------------------------- |
@@ -135,10 +131,6 b" setup_args['cmdclass'] = {" | |||
|
135 | 131 | 'build_py': \ |
|
136 | 132 | check_package_data_first(git_prebuild('IPython')), |
|
137 | 133 | 'sdist' : git_prebuild('IPython', sdist), |
|
138 | 'symlink': install_symlinked, | |
|
139 | 'install_lib_symlink': install_lib_symlink, | |
|
140 | 'install_scripts_sym': install_scripts_for_symlink, | |
|
141 | 'unsymlink': unsymlink, | |
|
142 | 134 | } |
|
143 | 135 | |
|
144 | 136 | setup_args["entry_points"] = { |
@@ -220,74 +220,10 b' def find_entry_points():' | |||
|
220 | 220 | major_suffix = str(sys.version_info[0]) |
|
221 | 221 | return [e % "" for e in ep] + [e % major_suffix for e in ep] |
|
222 | 222 | |
|
223 | ||
|
224 | class install_lib_symlink(Command): | |
|
225 | user_options = [ | |
|
226 | ('install-dir=', 'd', "directory to install to"), | |
|
227 | ] | |
|
228 | ||
|
229 | def initialize_options(self): | |
|
230 | self.install_dir = None | |
|
231 | ||
|
232 | def finalize_options(self): | |
|
233 | self.set_undefined_options('symlink', | |
|
234 | ('install_lib', 'install_dir'), | |
|
235 | ) | |
|
236 | ||
|
237 | def run(self): | |
|
238 | if sys.platform == 'win32': | |
|
239 | raise Exception("This doesn't work on Windows.") | |
|
240 | pkg = os.path.join(os.getcwd(), 'IPython') | |
|
241 | dest = os.path.join(self.install_dir, 'IPython') | |
|
242 | if os.path.islink(dest): | |
|
243 | print('removing existing symlink at %s' % dest) | |
|
244 | os.unlink(dest) | |
|
245 | print('symlinking %s -> %s' % (pkg, dest)) | |
|
246 | os.symlink(pkg, dest) | |
|
247 | ||
|
248 | class unsymlink(install): | |
|
249 | def run(self): | |
|
250 | dest = os.path.join(self.install_lib, 'IPython') | |
|
251 | if os.path.islink(dest): | |
|
252 | print('removing symlink at %s' % dest) | |
|
253 | os.unlink(dest) | |
|
254 | else: | |
|
255 | print('No symlink exists at %s' % dest) | |
|
256 | ||
|
257 | class install_symlinked(install): | |
|
258 | def run(self): | |
|
259 | if sys.platform == 'win32': | |
|
260 | raise Exception("This doesn't work on Windows.") | |
|
261 | ||
|
262 | # Run all sub-commands (at least those that need to be run) | |
|
263 | for cmd_name in self.get_sub_commands(): | |
|
264 | self.run_command(cmd_name) | |
|
265 | ||
|
266 | # 'sub_commands': a list of commands this command might have to run to | |
|
267 | # get its work done. See cmd.py for more info. | |
|
268 | sub_commands = [('install_lib_symlink', lambda self:True), | |
|
269 | ('install_scripts_sym', lambda self:True), | |
|
270 | ] | |
|
271 | ||
|
272 | class install_scripts_for_symlink(install_scripts): | |
|
273 | """Redefined to get options from 'symlink' instead of 'install'. | |
|
274 | ||
|
275 | I love distutils almost as much as I love setuptools. | |
|
276 | """ | |
|
277 | def finalize_options(self): | |
|
278 | self.set_undefined_options('build', ('build_scripts', 'build_dir')) | |
|
279 | self.set_undefined_options('symlink', | |
|
280 | ('install_scripts', 'install_dir'), | |
|
281 | ('force', 'force'), | |
|
282 | ('skip_build', 'skip_build'), | |
|
283 | ) | |
|
284 | ||
|
285 | ||
|
286 | 223 | #--------------------------------------------------------------------------- |
|
287 | 224 | # VCS related |
|
288 | 225 | #--------------------------------------------------------------------------- |
|
289 | 226 | |
|
290 | ||
|
291 | 227 | def git_prebuild(pkg_dir, build_cmd=build_py): |
|
292 | 228 | """Return extended build or sdist command class for recording commit |
|
293 | 229 |
General Comments 0
You need to be logged in to leave comments.
Login now