Install on Windows without using setuptools

This creates batch files, with a .cmd extension, which can launch
IPython from 'ipython' at a command line, to replace the .exe files
created by setuptools.

This makes repeated installations much quicker on Windows.
This commit is contained in:
Thomas Kluyver 2014-11-11 10:38:05 -08:00
parent 28cc4e9c84
commit 37a2a8a6e5
2 changed files with 10 additions and 6 deletions

View File

@ -252,12 +252,6 @@ needs_setuptools = set(('develop', 'release', 'bdist_egg', 'bdist_rpm',
'bdist', 'bdist_dumb', 'bdist_wininst', 'bdist_wheel',
'egg_info', 'easy_install', 'upload', 'install_egg_info',
))
if sys.platform == 'win32':
# Depend on setuptools for install on *Windows only*
# If we get script-installation working without setuptools,
# then we can back off, but until then use it.
# See Issue #369 on GitHub for more
needs_setuptools.add('install')
if len(needs_setuptools.intersection(sys.argv)) > 0:
import setuptools

View File

@ -403,6 +403,16 @@ class build_scripts_entrypt(build_scripts):
with open(outfile, 'w') as f:
f.write(script_src.format(executable=sys.executable,
mod=mod, func=func))
if sys.platform == 'win32':
# Write .cmd wrappers for Windows so 'ipython' etc. work at the
# command line
cmd_file = os.path.join(self.build_dir, name + '.cmd')
cmd = '@"{python}" "%~dp0\{script}" %*\r\n'.format(
python=sys.executable, script=name)
log.info("Writing %s wrapper script" % cmd_file)
with open(cmd_file, 'w') as f:
f.write(cmd)
return outfiles, outfiles