##// END OF EJS Templates
Fix IPython.utils.sysinfo for Python 3.
Thomas Kluyver -
Show More
@@ -70,9 +70,13 b' def pkg_commit_hash(pkg_path):'
70 70 raise IOError('Missing commit info file %s' % pth)
71 71 cfg_parser = ConfigParser()
72 72 cfg_parser.read(pth)
73 archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')
74 if not archive_subst.startswith('$Format'): # it has been substituted
75 return 'archive substitution', archive_subst
73 try:
74 archive_subst = cfg_parser.get('commit hash', 'archive_subst_hash')
75 except Exception:
76 pass
77 else:
78 if not archive_subst.startswith('$Format'): # it has been substituted
79 return 'archive substitution', archive_subst
76 80 install_subst = cfg_parser.get('commit hash', 'install_hash')
77 81 if install_subst != '':
78 82 return 'installation', install_subst
@@ -1,15 +1,18 b''
1 1 import os.path
2 2 from setuptools import setup
3 from setuptools.command.build_py import build_py
3 4
4 5 from setupbase import (setup_args,
5 6 find_scripts,
6 7 find_packages,
7 8 find_package_data,
9 record_commit_info,
8 10 )
9 11
10 12 setup_args['entry_points'] = find_scripts(True, suffix='3')
11 13 setup_args['packages'] = find_packages()
12 14 setup_args['package_data'] = find_package_data()
15 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
13 16
14 17 def main():
15 18 setup(use_2to3 = True, **setup_args)
@@ -359,7 +359,7 b' def record_commit_info(pkg_dir, build_cmd=build_py):'
359 359 class MyBuildPy(build_cmd):
360 360 ''' Subclass to write commit data into installation tree '''
361 361 def run(self):
362 build_py.run(self)
362 build_cmd.run(self)
363 363 import subprocess
364 364 proc = subprocess.Popen('git rev-parse --short HEAD',
365 365 stdout=subprocess.PIPE,
@@ -369,7 +369,7 b' def record_commit_info(pkg_dir, build_cmd=build_py):'
369 369 # We write the installation commit even if it's empty
370 370 cfg_parser = ConfigParser()
371 371 cfg_parser.read(pjoin(pkg_dir, '.git_commit_info.ini'))
372 cfg_parser.set('commit hash', 'install_hash', repo_commit)
372 cfg_parser.set('commit hash', 'install_hash', repo_commit.decode('ascii'))
373 373 out_pth = pjoin(self.build_lib, pkg_dir, '.git_commit_info.ini')
374 374 out_file = open(out_pth, 'wt')
375 375 cfg_parser.write(out_file)
General Comments 0
You need to be logged in to leave comments. Login now