Skip to content

Commit a930461

Browse files
authored
Merge pull request #14170 from anntzer/inline-packages
In setup.py, inline the packages that need to be installed into setup().
2 parents 89db355 + c60df5e commit a930461

File tree

2 files changed

+7
-52
lines changed

2 files changed

+7
-52
lines changed

setup.py

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import os
2424
from zipfile import ZipFile
2525

26-
from setuptools import setup, Extension
26+
from setuptools import setup, find_packages, Extension
2727
from setuptools.command.build_ext import build_ext as BuildExtCommand
2828
from setuptools.command.develop import develop as DevelopCommand
2929
from setuptools.command.install_lib import install_lib as InstallLibCommand
@@ -169,12 +169,7 @@ def run(self):
169169
# however, this is needed on Windows to avoid creating infinite subprocesses
170170
# when using multiprocessing.
171171
if __name__ == '__main__':
172-
# These are distutils.setup parameters that the various packages add
173-
# things to.
174-
packages = []
175-
namespace_packages = []
176-
py_modules = []
177-
package_data = {}
172+
package_data = {} # Will be filled below by the various components.
178173

179174
# If the user just queries for information, don't bother figuring out which
180175
# packages to build or install.
@@ -224,9 +219,6 @@ def run(self):
224219
# Now collect all of the information we need to build all of the
225220
# packages.
226221
for package in good_packages:
227-
packages.extend(package.get_packages())
228-
namespace_packages.extend(package.get_namespace_packages())
229-
py_modules.extend(package.get_py_modules())
230222
# Extension modules only get added in build_ext, as numpy will have
231223
# been installed (as setup_requires) at that point.
232224
data = package.get_package_data()
@@ -267,14 +259,14 @@ def run(self):
267259
interfaces and hardcopy output formats.
268260
""",
269261
license="PSF",
270-
packages=packages,
271-
namespace_packages=namespace_packages,
272-
platforms='any',
273-
py_modules=py_modules,
262+
platforms="any",
263+
package_dir={"": "lib"},
264+
packages=find_packages("lib"),
265+
namespace_packages=["mpl_toolkits"],
266+
py_modules=["pylab"],
274267
# Dummy extension to trigger build_ext, which will swap it out with
275268
# real extensions that can depend on numpy for the build.
276269
ext_modules=[Extension("", [])],
277-
package_dir={"": "lib"},
278270
package_data=package_data,
279271
classifiers=classifiers,
280272

setupext.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
import os
99
import pathlib
1010
import platform
11-
import setuptools
1211
import shlex
1312
import shutil
1413
import subprocess
@@ -310,30 +309,6 @@ def check(self):
310309
"""
311310
pass
312311

313-
def get_packages(self):
314-
"""
315-
Get a list of package names to add to the configuration.
316-
These are added to the `packages` list passed to
317-
`distutils.setup`.
318-
"""
319-
return []
320-
321-
def get_namespace_packages(self):
322-
"""
323-
Get a list of namespace package names to add to the configuration.
324-
These are added to the `namespace_packages` list passed to
325-
`distutils.setup`.
326-
"""
327-
return []
328-
329-
def get_py_modules(self):
330-
"""
331-
Get a list of top-level modules to add to the configuration.
332-
These are added to the `py_modules` list passed to
333-
`distutils.setup`.
334-
"""
335-
return []
336-
337312
def get_package_data(self):
338313
"""
339314
Get a package data dictionary to add to the configuration.
@@ -485,15 +460,6 @@ class Matplotlib(SetupPackage):
485460
def check(self):
486461
return versioneer.get_version()
487462

488-
def get_packages(self):
489-
return setuptools.find_packages("lib", exclude=["*.tests"])
490-
491-
def get_namespace_packages(self):
492-
return ['mpl_toolkits']
493-
494-
def get_py_modules(self):
495-
return ['pylab']
496-
497463
def get_package_data(self):
498464
return {
499465
'matplotlib': [
@@ -525,9 +491,6 @@ class Tests(OptionalPackage):
525491
name = "tests"
526492
default_config = False
527493

528-
def get_packages(self):
529-
return setuptools.find_packages("lib", include=["*.tests"])
530-
531494
def get_package_data(self):
532495
return {
533496
'matplotlib': [

0 commit comments

Comments
 (0)