##// END OF EJS Templates
Fix renaming scripts with 3 suffix on Python 3
Thomas Kluyver -
Show More
@@ -59,6 +59,7 b' from setupbase import ('
59 find_packages,
59 find_packages,
60 find_package_data,
60 find_package_data,
61 find_scripts,
61 find_scripts,
62 build_scripts_rename,
62 find_data_files,
63 find_data_files,
63 check_for_dependencies,
64 check_for_dependencies,
64 git_prebuild,
65 git_prebuild,
@@ -315,7 +316,10 b' else:'
315 # check for dependencies an inform the user what is needed. This is
316 # check for dependencies an inform the user what is needed. This is
316 # just to make life easy for users.
317 # just to make life easy for users.
317 check_for_dependencies()
318 check_for_dependencies()
318 setup_args['scripts'] = find_scripts(False, suffix = '3' if PY3 else '')
319 setup_args['scripts'] = find_scripts(False)
320 if PY3:
321 # Rename scripts with '3' suffix
322 setup_args['cmdclass']['build_scripts'] = build_scripts_rename
319
323
320 #---------------------------------------------------------------------------
324 #---------------------------------------------------------------------------
321 # Do the actual setup now
325 # Do the actual setup now
@@ -28,6 +28,7 b' try:'
28 except:
28 except:
29 from ConfigParser import ConfigParser
29 from ConfigParser import ConfigParser
30 from distutils.command.build_py import build_py
30 from distutils.command.build_py import build_py
31 from distutils.command.build_scripts import build_scripts
31 from distutils.cmd import Command
32 from distutils.cmd import Command
32 from glob import glob
33 from glob import glob
33 from subprocess import call
34 from subprocess import call
@@ -347,6 +348,19 b" def find_scripts(entry_points=False, suffix=''):"
347 ]
348 ]
348 return scripts
349 return scripts
349
350
351 class build_scripts_rename(build_scripts):
352 """Use this on Python 3 to rename scripts to ipython3 etc."""
353 _suffix = '3'
354
355 def copy_scripts(self):
356 outfiles, updated_files = super(build_scripts_rename, self).copy_scripts()
357 new_outfiles = [p + self._suffix for p in outfiles]
358 updated_files = [p + self._suffix for p in updated_files]
359 for old, new in zip(outfiles, new_outfiles):
360 self.move_file(old, new)
361 return new_outfiles, updated_files
362
363
350 #---------------------------------------------------------------------------
364 #---------------------------------------------------------------------------
351 # Verify all dependencies
365 # Verify all dependencies
352 #---------------------------------------------------------------------------
366 #---------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now