Skip to content

Commit 61eb480

Browse files
authored
Merge pull request #17531 from anntzer/setupmulti
Remove unneeded check/comment re: multiprocessing in setup.py.
2 parents 71a6674 + 9ac9157 commit 61eb480

File tree

1 file changed

+107
-113
lines changed

1 file changed

+107
-113
lines changed

setup.py

+107-113
Original file line numberDiff line numberDiff line change
@@ -234,116 +234,110 @@ def run(self):
234234
cmdclass['develop'] = develop_with_jquery
235235

236236

237-
# One doesn't normally see `if __name__ == '__main__'` blocks in a setup.py,
238-
# however, this is needed on Windows to avoid creating infinite subprocesses
239-
# when using multiprocessing.
240-
if __name__ == '__main__':
241-
package_data = {} # Will be filled below by the various components.
242-
243-
# If the user just queries for information, don't bother figuring out which
244-
# packages to build or install.
245-
if not (any('--' + opt in sys.argv
246-
for opt in Distribution.display_option_names + ['help'])
247-
or 'clean' in sys.argv):
248-
# Go through all of the packages and figure out which ones we are
249-
# going to build/install.
250-
print_raw()
251-
print_raw("Edit setup.cfg to change the build options; "
252-
"suppress output with --quiet.")
253-
print_raw()
254-
print_raw("BUILDING MATPLOTLIB")
255-
256-
good_packages = []
257-
for package in mpl_packages:
258-
try:
259-
message = package.check()
260-
except setupext.Skipped as e:
261-
print_status(package.name, "no [{e}]".format(e=e))
262-
continue
263-
if message is not None:
264-
print_status(package.name,
265-
"yes [{message}]".format(message=message))
266-
good_packages.append(package)
267-
268-
print_raw()
269-
270-
# Now collect all of the information we need to build all of the
271-
# packages.
272-
for package in good_packages:
273-
# Extension modules only get added in build_ext, as numpy will have
274-
# been installed (as setup_requires) at that point.
275-
data = package.get_package_data()
276-
for key, val in data.items():
277-
package_data.setdefault(key, [])
278-
package_data[key] = list(set(val + package_data[key]))
279-
280-
# Write the default matplotlibrc file
281-
with open('matplotlibrc.template') as fd:
282-
template_lines = fd.read().splitlines(True)
283-
backend_line_idx, = [ # Also asserts that there is a single such line.
284-
idx for idx, line in enumerate(template_lines)
285-
if line.startswith('#backend:')]
286-
if setupext.options['backend']:
287-
template_lines[backend_line_idx] = (
288-
'backend: {}'.format(setupext.options['backend']))
289-
with open('lib/matplotlib/mpl-data/matplotlibrc', 'w') as fd:
290-
fd.write(''.join(template_lines))
291-
292-
# Finally, pass this all along to distutils to do the heavy lifting.
293-
setup(
294-
name="matplotlib",
295-
version=__version__,
296-
description="Python plotting package",
297-
author="John D. Hunter, Michael Droettboom",
298-
author_email="matplotlib-users@python.org",
299-
url="https://matplotlib.org",
300-
download_url="https://matplotlib.org/users/installing.html",
301-
project_urls={
302-
'Documentation': 'https://matplotlib.org',
303-
'Source Code': 'https://github.com/matplotlib/matplotlib',
304-
'Bug Tracker': 'https://github.com/matplotlib/matplotlib/issues',
305-
'Forum': 'https://discourse.matplotlib.org/',
306-
'Donate': 'https://numfocus.org/donate-to-matplotlib'
307-
},
308-
long_description=Path("README.rst").read_text(encoding="utf-8"),
309-
long_description_content_type="text/x-rst",
310-
license="PSF",
311-
platforms="any",
312-
classifiers=[
313-
'Development Status :: 5 - Production/Stable',
314-
'Framework :: Matplotlib',
315-
'Intended Audience :: Science/Research',
316-
'Intended Audience :: Education',
317-
'License :: OSI Approved :: Python Software Foundation License',
318-
'Programming Language :: Python',
319-
'Programming Language :: Python :: 3',
320-
'Programming Language :: Python :: 3.6',
321-
'Programming Language :: Python :: 3.7',
322-
'Programming Language :: Python :: 3.8',
323-
'Topic :: Scientific/Engineering :: Visualization',
324-
],
325-
326-
package_dir={"": "lib"},
327-
packages=find_packages("lib"),
328-
namespace_packages=["mpl_toolkits"],
329-
py_modules=["pylab"],
330-
# Dummy extension to trigger build_ext, which will swap it out with
331-
# real extensions that can depend on numpy for the build.
332-
ext_modules=[Extension("", [])],
333-
package_data=package_data,
334-
335-
python_requires='>={}'.format('.'.join(str(n) for n in min_version)),
336-
setup_requires=[
337-
"numpy>=1.15",
338-
],
339-
install_requires=[
340-
"cycler>=0.10",
341-
"kiwisolver>=1.0.1",
342-
"numpy>=1.15",
343-
"pillow>=6.2.0",
344-
"pyparsing>=2.0.3,!=2.0.4,!=2.1.2,!=2.1.6",
345-
"python-dateutil>=2.1",
346-
],
347-
348-
cmdclass=cmdclass,
349-
)
237+
package_data = {} # Will be filled below by the various components.
238+
239+
# If the user just queries for information, don't bother figuring out which
240+
# packages to build or install.
241+
if not (any('--' + opt in sys.argv
242+
for opt in Distribution.display_option_names + ['help'])
243+
or 'clean' in sys.argv):
244+
# Go through all of the packages and figure out which ones we are
245+
# going to build/install.
246+
print_raw()
247+
print_raw("Edit setup.cfg to change the build options; "
248+
"suppress output with --quiet.")
249+
print_raw()
250+
print_raw("BUILDING MATPLOTLIB")
251+
252+
good_packages = []
253+
for package in mpl_packages:
254+
try:
255+
message = package.check()
256+
except setupext.Skipped as e:
257+
print_status(package.name, "no [{e}]".format(e=e))
258+
continue
259+
if message is not None:
260+
print_status(package.name,
261+
"yes [{message}]".format(message=message))
262+
good_packages.append(package)
263+
264+
print_raw()
265+
266+
# Now collect all of the information we need to build all of the packages.
267+
for package in good_packages:
268+
# Extension modules only get added in build_ext, as numpy will have
269+
# been installed (as setup_requires) at that point.
270+
data = package.get_package_data()
271+
for key, val in data.items():
272+
package_data.setdefault(key, [])
273+
package_data[key] = list(set(val + package_data[key]))
274+
275+
# Write the default matplotlibrc file
276+
with open('matplotlibrc.template') as fd:
277+
template_lines = fd.read().splitlines(True)
278+
backend_line_idx, = [ # Also asserts that there is a single such line.
279+
idx for idx, line in enumerate(template_lines)
280+
if line.startswith('#backend:')]
281+
if setupext.options['backend']:
282+
template_lines[backend_line_idx] = (
283+
'backend: {}'.format(setupext.options['backend']))
284+
with open('lib/matplotlib/mpl-data/matplotlibrc', 'w') as fd:
285+
fd.write(''.join(template_lines))
286+
287+
setup( # Finally, pass this all along to distutils to do the heavy lifting.
288+
name="matplotlib",
289+
version=__version__,
290+
description="Python plotting package",
291+
author="John D. Hunter, Michael Droettboom",
292+
author_email="matplotlib-users@python.org",
293+
url="https://matplotlib.org",
294+
download_url="https://matplotlib.org/users/installing.html",
295+
project_urls={
296+
'Documentation': 'https://matplotlib.org',
297+
'Source Code': 'https://github.com/matplotlib/matplotlib',
298+
'Bug Tracker': 'https://github.com/matplotlib/matplotlib/issues',
299+
'Forum': 'https://discourse.matplotlib.org/',
300+
'Donate': 'https://numfocus.org/donate-to-matplotlib'
301+
},
302+
long_description=Path("README.rst").read_text(encoding="utf-8"),
303+
long_description_content_type="text/x-rst",
304+
license="PSF",
305+
platforms="any",
306+
classifiers=[
307+
'Development Status :: 5 - Production/Stable',
308+
'Framework :: Matplotlib',
309+
'Intended Audience :: Science/Research',
310+
'Intended Audience :: Education',
311+
'License :: OSI Approved :: Python Software Foundation License',
312+
'Programming Language :: Python',
313+
'Programming Language :: Python :: 3',
314+
'Programming Language :: Python :: 3.6',
315+
'Programming Language :: Python :: 3.7',
316+
'Programming Language :: Python :: 3.8',
317+
'Topic :: Scientific/Engineering :: Visualization',
318+
],
319+
320+
package_dir={"": "lib"},
321+
packages=find_packages("lib"),
322+
namespace_packages=["mpl_toolkits"],
323+
py_modules=["pylab"],
324+
# Dummy extension to trigger build_ext, which will swap it out with
325+
# real extensions that can depend on numpy for the build.
326+
ext_modules=[Extension("", [])],
327+
package_data=package_data,
328+
329+
python_requires='>={}'.format('.'.join(str(n) for n in min_version)),
330+
setup_requires=[
331+
"numpy>=1.15",
332+
],
333+
install_requires=[
334+
"cycler>=0.10",
335+
"kiwisolver>=1.0.1",
336+
"numpy>=1.15",
337+
"pillow>=6.2.0",
338+
"pyparsing>=2.0.3,!=2.0.4,!=2.1.2,!=2.1.6",
339+
"python-dateutil>=2.1",
340+
],
341+
342+
cmdclass=cmdclass,
343+
)

0 commit comments

Comments
 (0)