Show More
@@ -12,18 +12,19 b' This includes:' | |||
|
12 | 12 | # Copyright (c) IPython Development Team. |
|
13 | 13 | # Distributed under the terms of the Modified BSD License. |
|
14 | 14 | |
|
15 | ||
|
16 | import re | |
|
17 | 15 | import os |
|
16 | import re | |
|
18 | 17 | import sys |
|
18 | from glob import glob | |
|
19 | from logging import log | |
|
20 | ||
|
21 | from setuptools import Command | |
|
22 | from setuptools.command.build_py import build_py | |
|
19 | 23 | |
|
20 | from distutils import log | |
|
21 | from distutils.command.build_py import build_py | |
|
24 | # TODO: Replacement for this? | |
|
22 | 25 | from distutils.command.build_scripts import build_scripts |
|
23 |
from |
|
|
24 |
from |
|
|
25 | from distutils.cmd import Command | |
|
26 | from glob import glob | |
|
26 | from setuptools.command.install import install | |
|
27 | from setuptools.command.install_scripts import install_scripts | |
|
27 | 28 | |
|
28 | 29 | from setupext import install_data_ext |
|
29 | 30 | |
@@ -115,14 +116,14 b' def find_package_data():' | |||
|
115 | 116 | """ |
|
116 | 117 | # This is not enough for these things to appear in an sdist. |
|
117 | 118 | # We need to muck with the MANIFEST to get this to work |
|
118 | ||
|
119 | ||
|
119 | 120 | package_data = { |
|
120 | 121 | 'IPython.core' : ['profile/README*'], |
|
121 | 122 | 'IPython.core.tests' : ['*.png', '*.jpg', 'daft_extension/*.py'], |
|
122 | 123 | 'IPython.lib.tests' : ['*.wav'], |
|
123 | 124 | 'IPython.testing.plugin' : ['*.txt'], |
|
124 | 125 | } |
|
125 | ||
|
126 | ||
|
126 | 127 | return package_data |
|
127 | 128 | |
|
128 | 129 | |
@@ -229,7 +230,7 b' def find_entry_points():' | |||
|
229 | 230 | command line scripts. |
|
230 | 231 | |
|
231 | 232 | Each of our entry points gets both a plain name, e.g. ipython, and one |
|
232 |
suffixed with the Python major version number, e.g. ipython3. |
|
|
233 | suffixed with the Python major version number, e.g. ipython3. | |
|
233 | 234 | """ |
|
234 | 235 | ep = [ |
|
235 | 236 | 'ipython%s = IPython:start_ipython', |
@@ -247,10 +248,10 b" if __name__ == '__main__':" | |||
|
247 | 248 | |
|
248 | 249 | class build_scripts_entrypt(build_scripts): |
|
249 | 250 | """Build the command line scripts |
|
250 | ||
|
251 | ||
|
251 | 252 | Parse setuptools style entry points and write simple scripts to run the |
|
252 | 253 | target functions. |
|
253 | ||
|
254 | ||
|
254 | 255 | On Windows, this also creates .cmd wrappers for the scripts so that you can |
|
255 | 256 | easily launch them from a command line. |
|
256 | 257 | """ |
@@ -269,7 +270,7 b' class build_scripts_entrypt(build_scripts):' | |||
|
269 | 270 | with open(outfile, 'w') as f: |
|
270 | 271 | f.write(script_src.format(executable=sys.executable, |
|
271 | 272 | mod=mod, func=func)) |
|
272 | ||
|
273 | ||
|
273 | 274 | if sys.platform == 'win32': |
|
274 | 275 | # Write .cmd wrappers for Windows so 'ipython' etc. work at the |
|
275 | 276 | # command line |
@@ -323,7 +324,7 b' class install_symlinked(install):' | |||
|
323 | 324 | # Run all sub-commands (at least those that need to be run) |
|
324 | 325 | for cmd_name in self.get_sub_commands(): |
|
325 | 326 | self.run_command(cmd_name) |
|
326 | ||
|
327 | ||
|
327 | 328 | # 'sub_commands': a list of commands this command might have to run to |
|
328 | 329 | # get its work done. See cmd.py for more info. |
|
329 | 330 | sub_commands = [('install_lib_symlink', lambda self:True), |
@@ -332,7 +333,7 b' class install_symlinked(install):' | |||
|
332 | 333 | |
|
333 | 334 | class install_scripts_for_symlink(install_scripts): |
|
334 | 335 | """Redefined to get options from 'symlink' instead of 'install'. |
|
335 | ||
|
336 | ||
|
336 | 337 | I love distutils almost as much as I love setuptools. |
|
337 | 338 | """ |
|
338 | 339 | def finalize_options(self): |
@@ -356,7 +357,7 b' def git_prebuild(pkg_dir, build_cmd=build_py):' | |||
|
356 | 357 | |
|
357 | 358 | for use in IPython.utils.sysinfo.sys_info() calls after installation. |
|
358 | 359 | """ |
|
359 | ||
|
360 | ||
|
360 | 361 | class MyBuildPy(build_cmd): |
|
361 | 362 | ''' Subclass to write commit data into installation tree ''' |
|
362 | 363 | def run(self): |
@@ -371,12 +372,12 b' def git_prebuild(pkg_dir, build_cmd=build_py):' | |||
|
371 | 372 | # this one will only fire for build commands |
|
372 | 373 | if hasattr(self, 'build_lib'): |
|
373 | 374 | self._record_commit(self.build_lib) |
|
374 | ||
|
375 | ||
|
375 | 376 | def make_release_tree(self, base_dir, files): |
|
376 | 377 | # this one will fire for sdist |
|
377 | 378 | build_cmd.make_release_tree(self, base_dir, files) |
|
378 | 379 | self._record_commit(base_dir) |
|
379 | ||
|
380 | ||
|
380 | 381 | def _record_commit(self, base_dir): |
|
381 | 382 | import subprocess |
|
382 | 383 | proc = subprocess.Popen('git rev-parse --short HEAD', |
@@ -385,14 +386,14 b' def git_prebuild(pkg_dir, build_cmd=build_py):' | |||
|
385 | 386 | shell=True) |
|
386 | 387 | repo_commit, _ = proc.communicate() |
|
387 | 388 | repo_commit = repo_commit.strip().decode("ascii") |
|
388 | ||
|
389 | ||
|
389 | 390 | out_pth = pjoin(base_dir, pkg_dir, 'utils', '_sysinfo.py') |
|
390 | 391 | if os.path.isfile(out_pth) and not repo_commit: |
|
391 | 392 | # nothing to write, don't clobber |
|
392 | 393 | return |
|
393 | ||
|
394 | ||
|
394 | 395 | print("writing git commit '%s' to %s" % (repo_commit, out_pth)) |
|
395 | ||
|
396 | ||
|
396 | 397 | # remove to avoid overwriting original via hard link |
|
397 | 398 | try: |
|
398 | 399 | os.remove(out_pth) |
General Comments 0
You need to be logged in to leave comments.
Login now