|
25 | 25 | if os.path.exists('MANIFEST'): os.remove('MANIFEST')
|
26 | 26 |
|
27 | 27 |
|
28 |
| -from distutils.core import setup |
29 | 28 | from distutils.cmd import Command
|
30 | 29 | from distutils.command.build_py import build_py
|
31 | 30 | from distutils.command.sdist import sdist
|
32 |
| -from distutils.dist import Distribution |
33 | 31 | from distutils import log
|
34 | 32 |
|
| 33 | +from setuptools.command.develop import develop |
| 34 | +from setuptools.command.bdist_egg import bdist_egg |
| 35 | + |
35 | 36 | try:
|
36 | 37 | from wheel.bdist_wheel import bdist_wheel
|
37 | 38 | except ImportError:
|
@@ -69,11 +70,6 @@ def list2cmdline(cmd_list):
|
69 | 70 | skip_npm = False
|
70 | 71 |
|
71 | 72 |
|
72 |
| -# For some commands, use setuptools. Note that we do NOT list install here! |
73 |
| -if 'develop' in sys.argv or any(a.startswith('bdist') for a in sys.argv): |
74 |
| - import setuptools |
75 |
| - |
76 |
| - |
77 | 73 | # ---------------------------------------------------------------------------
|
78 | 74 | # Public Functions
|
79 | 75 | # ---------------------------------------------------------------------------
|
@@ -127,6 +123,17 @@ def update_package_data(distribution):
|
127 | 123 | build_py.finalize_options()
|
128 | 124 |
|
129 | 125 |
|
| 126 | +class bdist_egg_disabled(bdist_egg): |
| 127 | + """Disabled version of bdist_egg |
| 128 | +
|
| 129 | + Prevents setup.py install performing setuptools' default easy_install, |
| 130 | + which it should never ever do. |
| 131 | + """ |
| 132 | + def run(self): |
| 133 | + sys.exit("Aborting implicit building of eggs. Use `pip install .` " |
| 134 | + " to install from source.") |
| 135 | + |
| 136 | + |
130 | 137 | def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
|
131 | 138 | data_files_spec=None):
|
132 | 139 | """Create a command class with the given optional prerelease class.
|
@@ -162,18 +169,22 @@ def create_cmdclass(prerelease_cmd=None, package_data_spec=None,
|
162 | 169 | wrapper = functools.partial(_wrap_command, wrapped)
|
163 | 170 | handle_files = _get_file_handler(package_data_spec, data_files_spec)
|
164 | 171 |
|
| 172 | + if 'bdist_egg' in sys.argv: |
| 173 | + egg = wrapper(bdist_egg, strict=True) |
| 174 | + else: |
| 175 | + egg = bdist_egg_disabled |
| 176 | + |
165 | 177 | cmdclass = dict(
|
166 | 178 | build_py=wrapper(build_py, strict=is_repo),
|
| 179 | + bdist_egg=egg, |
167 | 180 | sdist=wrapper(sdist, strict=True),
|
168 |
| - handle_files=handle_files |
| 181 | + handle_files=handle_files, |
169 | 182 | )
|
170 | 183 |
|
171 | 184 | if bdist_wheel:
|
172 | 185 | cmdclass['bdist_wheel'] = wrapper(bdist_wheel, strict=True)
|
173 | 186 |
|
174 |
| - if 'develop' in sys.argv: |
175 |
| - from setuptools.command.develop import develop |
176 |
| - cmdclass['develop'] = wrapper(develop, strict=True) |
| 187 | + cmdclass['develop'] = wrapper(develop, strict=True) |
177 | 188 | return cmdclass
|
178 | 189 |
|
179 | 190 |
|
@@ -231,6 +242,7 @@ def combine_commands(*commands):
|
231 | 242 | """Return a Command that combines several commands."""
|
232 | 243 |
|
233 | 244 | class CombinedCommand(Command):
|
| 245 | + user_options = [] |
234 | 246 |
|
235 | 247 | def initialize_options(self):
|
236 | 248 | self.commands = []
|
|
0 commit comments