Skip to content

Commit 93b5c0f

Browse files
committed
Move setup.cfg to mplsetup.cfg.
... in order to avoid having to jump through hoops to work around the fact that distutils/setuptools also intend to use setup.cfg just for themselves.
1 parent ca275dc commit 93b5c0f

File tree

13 files changed

+34
-39
lines changed

13 files changed

+34
-39
lines changed

.github/workflows/cibuildwheel.yml

-4
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,6 @@ jobs:
6060
CIBW_BUILD: "cp37-* cp38-*"
6161
CIBW_ARCHS: aarch64
6262

63-
- name: Copy setup.cfg to configure wheel
64-
run: |
65-
cp setup.cfg.template setup.cfg
66-
6763
- name: Build wheels for CPython 3.9
6864
run: |
6965
python -m cibuildwheel --output-dir dist

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ dist
4141
pip-wheel-metadata/*
4242
# tox testing tool
4343
.tox
44-
setup.cfg
44+
mplsetup.cfg
4545
# generated by setuptools_scm
4646
lib/matplotlib/_version.py
4747

ci/check_wheel_licenses.py

-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
included.
66
77
To run:
8-
$ cp setup.cfg.template setup.cfg
98
$ python3 setup.py bdist_wheel
109
$ ./ci/check_wheel_licenses.py
1110
"""
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Matplotlib-specific build options have moved from ``setup.cfg`` to ``mplsetup.cfg``
2+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3+
... in order to avoid conflicting with the use of :file:`setup.cfg` by
4+
``setuptools``.
5+
6+
Note that the path to this configuration file can still be set via the
7+
:envvar:`MPLSETUPCFG` environment variable, which allows one to keep using the
8+
same file before and after this change.

doc/devel/dependencies.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ rasterize characters differently) and of Qhull. As an exception, Matplotlib
104104
defaults to the system version of FreeType on AIX.
105105

106106
To force Matplotlib to use a copy of FreeType or Qhull already installed in
107-
your system, create a :file:`setup.cfg` file with the following contents:
107+
your system, create a :file:`mplsetup.cfg` file with the following contents:
108108

109109
.. code-block:: cfg
110110

doc/faq/environment_variables_faq.rst

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ Environment variables
2929

3030
.. envvar:: MPLSETUPCFG
3131

32-
This optional variable can be set to the full path of a :file:`setup.cfg`
32+
This optional variable can be set to the full path of a :file:`mplsetup.cfg`
3333
configuration file used to customize the Matplotlib build. By default, a
34-
:file:`setup.cfg` file in the root of the Matplotlib source tree will be
35-
read. Supported build options are listed in :file:`setup.cfg.template`.
34+
:file:`mplsetup.cfg` file in the root of the Matplotlib source tree will be
35+
read. Supported build options are listed in :file:`mplsetup.cfg.template`.
3636

3737
.. envvar:: PATH
3838

doc/users/installing_source.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,12 @@ docs.
6565
If you would like to build from a tarball, grab the latest *tar.gz* release
6666
file from `the PyPI files page <https://pypi.org/project/matplotlib/>`_.
6767

68-
We provide a `setup.cfg`_ file which you can use to customize the build
68+
We provide a `mplsetup.cfg`_ file which you can use to customize the build
6969
process. For example, which default backend to use, whether some of the
7070
optional libraries that Matplotlib ships with are installed, and so on. This
7171
file will be particularly useful to those packaging Matplotlib.
7272

73-
.. _setup.cfg: https://raw.githubusercontent.com/matplotlib/matplotlib/master/setup.cfg.template
73+
.. _mplsetup.cfg: https://raw.githubusercontent.com/matplotlib/matplotlib/master/mplsetup.cfg.template
7474

7575
If you are building your own Matplotlib wheels (or sdists) on Windows, note
7676
that any DLLs that you copy into the source tree will be packaged too.

lib/matplotlib/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1204,7 +1204,7 @@ def _init_tests():
12041204
_log.warning(
12051205
f"Matplotlib is not built with the correct FreeType version to "
12061206
f"run tests. Rebuild without setting system_freetype=1 in "
1207-
f"setup.cfg. Expect many image comparison failures below. "
1207+
f"mplsetup.cfg. Expect many image comparison failures below. "
12081208
f"Expected freetype version {LOCAL_FREETYPE_VERSION}. "
12091209
f"Found freetype version {ft2font.__freetype_version__}. "
12101210
"Freetype build type is {}local".format(

setup.cfg.template renamed to mplsetup.cfg.template

+1-6
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
# Rename this file to setup.cfg to modify Matplotlib's build options.
2-
3-
[metadata]
4-
license_files = LICENSE/*
5-
6-
[egg_info]
1+
# Rename this file to mplsetup.cfg to modify Matplotlib's build options.
72

83
[libs]
94
# By default, Matplotlib builds with LTO, which may be slow if you re-compile

setup.cfg

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# NOTE: Matplotlib-specific configuration options have been moved to
2+
# mplsetup.cfg.template.
3+
4+
[metadata]
5+
license_files = LICENSE/*

setup.py

+3-11
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
2-
The matplotlib build options can be modified with a setup.cfg file. See
3-
setup.cfg.template for more information.
2+
The Matplotlib build options can be modified with a mplsetup.cfg file. See
3+
mplsetup.cfg.template for more information.
44
"""
55

66
# NOTE: This file must remain Python 2 compatible for the foreseeable future,
@@ -35,14 +35,6 @@
3535
import setuptools.command.test
3636
import setuptools.command.sdist
3737

38-
# The setuptools version of sdist adds a setup.cfg file to the tree.
39-
# We don't want that, so we simply remove it, and it will fall back to
40-
# vanilla distutils.
41-
try:
42-
del setuptools.command.sdist.sdist.make_release_tree
43-
except AttributeError:
44-
pass
45-
4638
from distutils.errors import CompileError
4739
from distutils.dist import Distribution
4840

@@ -250,7 +242,7 @@ def make_release_tree(self, base_dir, files):
250242
# Go through all of the packages and figure out which ones we are
251243
# going to build/install.
252244
print_raw()
253-
print_raw("Edit setup.cfg to change the build options; "
245+
print_raw("Edit mplsetup.cfg to change the build options; "
254246
"suppress output with --quiet.")
255247
print_raw()
256248
print_raw("BUILDING MATPLOTLIB")

setupext.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,17 @@ def get_and_extract_tarball(urls, sha, dirname):
177177
LOCAL_QHULL_VERSION = '2020.2'
178178

179179

180-
# Matplotlib build options, which can be altered using setup.cfg
181-
setup_cfg = os.environ.get('MPLSETUPCFG') or 'setup.cfg'
180+
# Matplotlib build options, which can be altered using mplsetup.cfg
181+
mplsetup_cfg = os.environ.get('MPLSETUPCFG') or 'mplsetup.cfg'
182182
config = configparser.ConfigParser()
183-
if os.path.exists(setup_cfg):
184-
config.read(setup_cfg)
183+
if os.path.exists(mplsetup_cfg):
184+
config.read(mplsetup_cfg)
185185
options = {
186186
'backend': config.get('rc_options', 'backend', fallback=None),
187187
'system_freetype': config.getboolean(
188188
'libs', 'system_freetype', fallback=sys.platform.startswith('aix')),
189-
'system_qhull': config.getboolean('libs', 'system_qhull',
190-
fallback=False),
189+
'system_qhull': config.getboolean(
190+
'libs', 'system_qhull', fallback=False),
191191
}
192192

193193

@@ -323,7 +323,7 @@ class OptionalPackage(SetupPackage):
323323

324324
def check(self):
325325
"""
326-
Check whether ``setup.cfg`` requests this package to be installed.
326+
Check whether ``mplsetup.cfg`` requests this package to be installed.
327327
328328
May be overridden by subclasses for additional checks.
329329
"""

src/checkdep_freetype2.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifdef __has_include
22
#if !__has_include(<ft2build.h>)
33
#error "FreeType version 2.3 or higher is required. \
4-
You may unset the system_freetype entry in setup.cfg to let Matplotlib download it."
4+
You may unset the system_freetype entry in mplsetup.cfg to let Matplotlib download it."
55
#endif
66
#endif
77

@@ -15,5 +15,5 @@ You may unset the system_freetype entry in setup.cfg to let Matplotlib download
1515
XSTR(FREETYPE_MAJOR) "." XSTR(FREETYPE_MINOR) "." XSTR(FREETYPE_PATCH) ".")
1616
#if FREETYPE_MAJOR << 16 + FREETYPE_MINOR << 8 + FREETYPE_PATCH < 0x020300
1717
#error "FreeType version 2.3 or higher is required. \
18-
You may unset the system_freetype entry in setup.cfg to let Matplotlib download it."
18+
You may unset the system_freetype entry in mplsetup.cfg to let Matplotlib download it."
1919
#endif

0 commit comments

Comments
 (0)