|
1 | 1 | #!/usr/bin/env python
|
2 | 2 |
|
3 |
| -""" |
4 |
| -Setuptools bootstrapping installer, reliant on pip and providing |
5 |
| -nominal compatibility with the prior interface. |
6 |
| -
|
7 |
| -Maintained at https://github.com/pypa/setuptools/tree/bootstrap. |
8 |
| -
|
9 |
| -Don't use this script. Instead, just invoke pip commands to install |
10 |
| -or update setuptools. |
11 |
| -""" |
12 |
| - |
13 |
| -import sys |
14 |
| -import warnings |
15 |
| - |
16 |
| - |
17 |
| -def use_setuptools(version=None, **kwargs): |
18 |
| - """ |
19 |
| - A minimally-compatible version of ez_setup.use_setuptools |
20 |
| - """ |
21 |
| - if kwargs: |
22 |
| - msg = "ignoring arguments: {keys}".format(keys=list(kwargs.keys())) |
23 |
| - warnings.warn(msg) |
24 |
| - |
25 |
| - requirement = _requirement(version) |
26 |
| - _pip_install(requirement) |
27 |
| - |
28 |
| - # ensure that the package resolved satisfies the requirement |
29 |
| - __import__('pkg_resources').require(requirement) |
30 |
| - |
31 |
| - |
32 |
| -def download_setuptools(*args, **kwargs): |
33 |
| - msg = ( |
34 |
| - "download_setuptools is no longer supported; " |
35 |
| - "use `pip download setuptools` instead." |
36 |
| - ) |
37 |
| - raise NotImplementedError(msg) |
38 |
| - |
39 |
| - |
40 |
| -def _requirement(version): |
41 |
| - req = 'setuptools' |
42 |
| - if version: |
43 |
| - req += '>=' + version |
44 |
| - return req |
45 |
| - |
46 |
| - |
47 |
| -def _pip_install(*args): |
48 |
| - args = ('install', '--upgrade') + args |
49 |
| - __import__('pip').main(list(args)) |
50 |
| - |
51 |
| - |
52 |
| -def _check_sys_argv(): |
53 |
| - if not sys.argv[1:]: |
54 |
| - return |
55 |
| - |
56 |
| - msg = ( |
57 |
| - "parameters to ez_setup are no longer supported; " |
58 |
| - "invoke pip directly to customize setuptools install." |
59 |
| - ) |
60 |
| - raise NotImplementedError(msg) |
61 |
| - |
62 |
| - |
63 |
| -if __name__ == '__main__': |
64 |
| - _check_sys_argv() |
65 |
| - raise SystemExit(_pip_install('setuptools')) |
| 3 | +raise NotImplementedError("ez_setup is deprecated; use pip to bootstrap") |
0 commit comments