Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2256fad

Browse files
committed
In setup.py, inline the packages that need to be installed into setup().
... instead of hiding that behind a function call in setupext. Also always install the test source files -- setting `tests = False` in setup.cfg now only ignores the test data (this is also consistent with the contents of `matplotlib/tests/__init__.py which is clearly intended to handle the case where the test source files are installed but not the baseline images). This is done for simplicity of implementation and also to make it possibly easier to separately install the baseline images (as these are now pure "data") in the future.
1 parent 28e32c6 commit 2256fad

File tree

2 files changed

+6
-47
lines changed

2 files changed

+6
-47
lines changed

setup.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import urllib.request
2727
from zipfile import ZipFile
2828

29-
from setuptools import setup, Extension
29+
from setuptools import setup, find_packages, Extension
3030
from setuptools.command.build_ext import build_ext as BuildExtCommand
3131
from setuptools.command.develop import develop as DevelopCommand
3232
from setuptools.command.install_lib import install_lib as InstallLibCommand
@@ -182,7 +182,6 @@ def run(self):
182182
# extensions that can depend on numpy for the build.
183183
ext_modules = [Extension('', [])]
184184
package_data = {}
185-
package_dir = {'': 'lib'}
186185
install_requires = []
187186
setup_requires = []
188187

@@ -236,9 +235,6 @@ def run(self):
236235
# Now collect all of the information we need to build all of the
237236
# packages.
238237
for package in good_packages:
239-
packages.extend(package.get_packages())
240-
namespace_packages.extend(package.get_namespace_packages())
241-
py_modules.extend(package.get_py_modules())
242238
# Extension modules only get added in build_ext, as numpy will have
243239
# been installed (as setup_requires) at that point.
244240
data = package.get_package_data()
@@ -275,12 +271,12 @@ def run(self):
275271
interfaces and hardcopy output formats.
276272
""",
277273
license="PSF",
278-
packages=packages,
279-
namespace_packages=namespace_packages,
280-
platforms='any',
281-
py_modules=py_modules,
274+
platforms="any",
275+
package_dir={"": "lib"},
276+
packages=find_packages("lib"),
277+
namespace_packages=["mpl_toolkits"],
278+
py_modules=["pylab"],
282279
ext_modules=ext_modules,
283-
package_dir=package_dir,
284280
package_data=package_data,
285281
classifiers=classifiers,
286282
download_url="https://matplotlib.org/users/installing.html",

setupext.py

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import os
1111
import pathlib
1212
import platform
13-
import setuptools
1413
import shlex
1514
import shutil
1615
import subprocess
@@ -313,30 +312,6 @@ def check(self):
313312
"""
314313
pass
315314

316-
def get_packages(self):
317-
"""
318-
Get a list of package names to add to the configuration.
319-
These are added to the `packages` list passed to
320-
`distutils.setup`.
321-
"""
322-
return []
323-
324-
def get_namespace_packages(self):
325-
"""
326-
Get a list of namespace package names to add to the configuration.
327-
These are added to the `namespace_packages` list passed to
328-
`distutils.setup`.
329-
"""
330-
return []
331-
332-
def get_py_modules(self):
333-
"""
334-
Get a list of top-level modules to add to the configuration.
335-
These are added to the `py_modules` list passed to
336-
`distutils.setup`.
337-
"""
338-
return []
339-
340315
def get_package_data(self):
341316
"""
342317
Get a package data dictionary to add to the configuration.
@@ -524,15 +499,6 @@ class Matplotlib(SetupPackage):
524499
def check(self):
525500
return versioneer.get_version()
526501

527-
def get_packages(self):
528-
return setuptools.find_packages("lib", exclude=["*.tests"])
529-
530-
def get_namespace_packages(self):
531-
return ['mpl_toolkits']
532-
533-
def get_py_modules(self):
534-
return ['pylab']
535-
536502
def get_package_data(self):
537503
return {
538504
'matplotlib': [
@@ -572,9 +538,6 @@ class Tests(OptionalPackage):
572538
name = "tests"
573539
default_config = False
574540

575-
def get_packages(self):
576-
return setuptools.find_packages("lib", include=["*.tests"])
577-
578541
def get_package_data(self):
579542
return {
580543
'matplotlib': [

0 commit comments

Comments
 (0)