mirror of
https://github.com/jupyter/notebook.git
synced 2025-02-17 12:39:54 +08:00
Fix renaming scripts with 3 suffix on Python 3
This commit is contained in:
parent
27c8c81c05
commit
432377439b
6
setup.py
6
setup.py
@ -59,6 +59,7 @@ from setupbase import (
|
||||
find_packages,
|
||||
find_package_data,
|
||||
find_scripts,
|
||||
build_scripts_rename,
|
||||
find_data_files,
|
||||
check_for_dependencies,
|
||||
git_prebuild,
|
||||
@ -315,7 +316,10 @@ else:
|
||||
# check for dependencies an inform the user what is needed. This is
|
||||
# just to make life easy for users.
|
||||
check_for_dependencies()
|
||||
setup_args['scripts'] = find_scripts(False, suffix = '3' if PY3 else '')
|
||||
setup_args['scripts'] = find_scripts(False)
|
||||
if PY3:
|
||||
# Rename scripts with '3' suffix
|
||||
setup_args['cmdclass']['build_scripts'] = build_scripts_rename
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Do the actual setup now
|
||||
|
14
setupbase.py
14
setupbase.py
@ -28,6 +28,7 @@ try:
|
||||
except:
|
||||
from ConfigParser import ConfigParser
|
||||
from distutils.command.build_py import build_py
|
||||
from distutils.command.build_scripts import build_scripts
|
||||
from distutils.cmd import Command
|
||||
from glob import glob
|
||||
from subprocess import call
|
||||
@ -347,6 +348,19 @@ def find_scripts(entry_points=False, suffix=''):
|
||||
]
|
||||
return scripts
|
||||
|
||||
class build_scripts_rename(build_scripts):
|
||||
"""Use this on Python 3 to rename scripts to ipython3 etc."""
|
||||
_suffix = '3'
|
||||
|
||||
def copy_scripts(self):
|
||||
outfiles, updated_files = super(build_scripts_rename, self).copy_scripts()
|
||||
new_outfiles = [p + self._suffix for p in outfiles]
|
||||
updated_files = [p + self._suffix for p in updated_files]
|
||||
for old, new in zip(outfiles, new_outfiles):
|
||||
self.move_file(old, new)
|
||||
return new_outfiles, updated_files
|
||||
|
||||
|
||||
#---------------------------------------------------------------------------
|
||||
# Verify all dependencies
|
||||
#---------------------------------------------------------------------------
|
||||
|
Loading…
Reference in New Issue
Block a user