Show More
@@ -252,12 +252,6 b" needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm'," | |||||
252 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', |
|
252 | 'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel', | |
253 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', |
|
253 | 'egg_info', 'easy_install', 'upload', 'install_egg_info', | |
254 | )) |
|
254 | )) | |
255 | if sys.platform == 'win32': |
|
|||
256 | # Depend on setuptools for install on *Windows only* |
|
|||
257 | # If we get script-installation working without setuptools, |
|
|||
258 | # then we can back off, but until then use it. |
|
|||
259 | # See Issue #369 on GitHub for more |
|
|||
260 | needs_setuptools.add('install') |
|
|||
261 |
|
255 | |||
262 | if len(needs_setuptools.intersection(sys.argv)) > 0: |
|
256 | if len(needs_setuptools.intersection(sys.argv)) > 0: | |
263 | import setuptools |
|
257 | import setuptools |
@@ -360,15 +360,14 b' def target_update(target,deps,cmd):' | |||||
360 | #--------------------------------------------------------------------------- |
|
360 | #--------------------------------------------------------------------------- | |
361 |
|
361 | |||
362 | def find_entry_points(): |
|
362 | def find_entry_points(): | |
363 | """Find IPython's scripts. |
|
363 | """Defines the command line entry points for IPython | |
364 |
|
364 | |||
365 | if entry_points is True: |
|
365 | This always uses setuptools-style entry points. When setuptools is not in | |
366 | return setuptools entry_point-style definitions |
|
366 | use, our own build_scripts_entrypt class below parses these and builds | |
367 | else: |
|
367 | command line scripts. | |
368 | return file paths of plain scripts [default] |
|
|||
369 |
|
368 | |||
370 | suffix is appended to script names if entry_points is True, so that the |
|
369 | Each of our entry points gets both a plain name, e.g. ipython, and one | |
371 | Python 3 scripts get named "ipython3" etc. |
|
370 | suffixed with the Python major version number, e.g. ipython3. | |
372 | """ |
|
371 | """ | |
373 | ep = [ |
|
372 | ep = [ | |
374 | 'ipython%s = IPython:start_ipython', |
|
373 | 'ipython%s = IPython:start_ipython', | |
@@ -388,6 +387,14 b" if __name__ == '__main__':" | |||||
388 | """ |
|
387 | """ | |
389 |
|
388 | |||
390 | class build_scripts_entrypt(build_scripts): |
|
389 | class build_scripts_entrypt(build_scripts): | |
|
390 | """Build the command line scripts | |||
|
391 | ||||
|
392 | Parse setuptools style entry points and write simple scripts to run the | |||
|
393 | target functions. | |||
|
394 | ||||
|
395 | On Windows, this also creates .cmd wrappers for the scripts so that you can | |||
|
396 | easily launch them from a command line. | |||
|
397 | """ | |||
391 | def run(self): |
|
398 | def run(self): | |
392 | self.mkpath(self.build_dir) |
|
399 | self.mkpath(self.build_dir) | |
393 | outfiles = [] |
|
400 | outfiles = [] | |
@@ -403,6 +410,16 b' class build_scripts_entrypt(build_scripts):' | |||||
403 | with open(outfile, 'w') as f: |
|
410 | with open(outfile, 'w') as f: | |
404 | f.write(script_src.format(executable=sys.executable, |
|
411 | f.write(script_src.format(executable=sys.executable, | |
405 | mod=mod, func=func)) |
|
412 | mod=mod, func=func)) | |
|
413 | ||||
|
414 | if sys.platform == 'win32': | |||
|
415 | # Write .cmd wrappers for Windows so 'ipython' etc. work at the | |||
|
416 | # command line | |||
|
417 | cmd_file = os.path.join(self.build_dir, name + '.cmd') | |||
|
418 | cmd = '@"{python}" "%~dp0\{script}" %*\r\n'.format( | |||
|
419 | python=sys.executable, script=name) | |||
|
420 | log.info("Writing %s wrapper script" % cmd_file) | |||
|
421 | with open(cmd_file, 'w') as f: | |||
|
422 | f.write(cmd) | |||
406 |
|
423 | |||
407 | return outfiles, outfiles |
|
424 | return outfiles, outfiles | |
408 |
|
425 |
General Comments 0
You need to be logged in to leave comments.
Login now