##// END OF EJS Templates
Remove duplicate code in setup2/3 and move it to setupbase.
Fernando Perez -
Show More
@@ -61,6 +61,7 b' from setupbase import ('
61 find_data_files,
61 find_data_files,
62 check_for_dependencies,
62 check_for_dependencies,
63 record_commit_info,
63 record_commit_info,
64 bdist_wininst_options,
64 )
65 )
65 from setupext import setupext
66 from setupext import setupext
66
67
@@ -197,27 +198,16 b" if 'setuptools' in sys.modules:"
197 if not setupext.check_for_readline():
198 if not setupext.check_for_readline():
198 if sys.platform == 'darwin':
199 if sys.platform == 'darwin':
199 requires.append('readline')
200 requires.append('readline')
200 elif sys.platform.startswith('win') and sys.maxsize < 2**32:
201 elif sys.platform.startswith('win') and \
201 # only require pyreadline on 32b Windows, due to 64b bug in pyreadline:
202 not 'bdist_wininst' in sys.argv:
202 # https://bugs.launchpad.net/pyreadline/+bug/787574
203 # We must avoid listing pyreadline when *building* the binary windows
203 requires.append('pyreadline')
204 # installers, because if we do so, then at runtime ipython will fail
205 # to find a pyreadline that could have been installed without
206 # setuptools (such as the one from the binary pyreadline installer).
207 requires.append('pyreadline')
204 else:
208 else:
205 pass
209 pass
206 # do we want to install readline here?
210 setup_args.update(bdist_wininst_options())
207
208 # Script to be run by the windows binary installer after the default setup
209 # routine, to add shortcuts and similar windows-only things. Windows
210 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
211 # doesn't find them.
212 if 'bdist_wininst' in sys.argv:
213 if len(sys.argv) > 2 and \
214 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
215 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
216 sys.exit(1)
217 setup_args['scripts'] = [pjoin('scripts','ipython_win_post_install.py')]
218 setup_args['options'] = {"bdist_wininst":
219 {"install_script":
220 "ipython_win_post_install.py"}}
221 else:
211 else:
222 # If we are running without setuptools, call this function which will
212 # If we are running without setuptools, call this function which will
223 # check for dependencies an inform the user what is needed. This is
213 # check for dependencies an inform the user what is needed. This is
@@ -235,9 +225,11 b" setup_args['package_data'] = package_data"
235 setup_args['data_files'] = data_files
225 setup_args['data_files'] = data_files
236 setup_args.update(setuptools_extra_args)
226 setup_args.update(setuptools_extra_args)
237
227
228
238 def main():
229 def main():
239 setup(**setup_args)
230 setup(**setup_args)
240 cleanup()
231 cleanup()
241
232
233
242 if __name__ == '__main__':
234 if __name__ == '__main__':
243 main()
235 main()
@@ -8,26 +8,16 b' from setupbase import (setup_args,'
8 find_packages,
8 find_packages,
9 find_package_data,
9 find_package_data,
10 record_commit_info,
10 record_commit_info,
11 bdist_wininst_options,
11 )
12 )
12
13
13 setup_args['entry_points'] = find_scripts(True, suffix='3')
14 setup_args['entry_points'] = find_scripts(True, suffix='3')
14 setup_args['packages'] = find_packages()
15 setup_args['packages'] = find_packages()
15 setup_args['package_data'] = find_package_data()
16 setup_args['package_data'] = find_package_data()
16 setup_args['cmdclass'] = {'build_py': record_commit_info('IPython', build_cmd=build_py)}
17 setup_args['cmdclass'] = {'build_py':
18 record_commit_info('IPython', build_cmd=build_py)}
17
19
18 # Script to be run by the windows binary installer after the default setup
20 setup_args.update(bdist_wininst_options())
19 # routine, to add shortcuts and similar windows-only things. Windows
20 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
21 # doesn't find them.
22 if 'bdist_wininst' in sys.argv:
23 if len(sys.argv) > 2 and \
24 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
25 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
26 sys.exit(1)
27 setup_args['scripts'] = [os.path.join('scripts','ipython_win_post_install.py')]
28 setup_args['options'] = {"bdist_wininst":
29 {"install_script":
30 "ipython_win_post_install.py"}}
31
21
32 def main():
22 def main():
33 setup(use_2to3 = True, **setup_args)
23 setup(use_2to3 = True, **setup_args)
@@ -358,3 +358,32 b' def record_commit_info(pkg_dir, build_cmd=build_py):'
358 'commit = "%s"\n' % repo_commit.decode('ascii'),
358 'commit = "%s"\n' % repo_commit.decode('ascii'),
359 ])
359 ])
360 return MyBuildPy
360 return MyBuildPy
361
362 #-----------------------------------------------------------------------------
363 # Misc. utilities common to setup2/3
364 #-----------------------------------------------------------------------------
365
366 def bdist_wininst_options():
367 """Options to setup specific to the creation of Windows binary installer.
368 """
369
370 setup_args = {}
371
372 if 'bdist_wininst' not in sys.argv:
373 return setup_args
374
375 # If we're building a binary Windows installer, a few extra flags are
376 # needed. Script to be run by the installer after the default setup
377 # routine, to add shortcuts and similar windows-only things. Windows
378 # post-install scripts MUST reside in the scripts/ dir, otherwise distutils
379 # doesn't find them.
380 if len(sys.argv) > 2 and \
381 ('sdist' in sys.argv or 'bdist_rpm' in sys.argv):
382 print >> sys.stderr, "ERROR: bdist_wininst must be run alone. Exiting."
383 sys.exit(1)
384 setup_args['scripts'] = [os.path.join('scripts',
385 'ipython_win_post_install.py')]
386 setup_args['options'] = {"bdist_wininst":
387 {"install_script":
388 "ipython_win_post_install.py"}}
389 return setup_args
General Comments 0
You need to be logged in to leave comments. Login now