Skip to content

Avoid using private _config_vars #4228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion setuptools/_distutils/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def environment(monkeypatch):
monkeypatch.setattr(os.path, 'join', os.path.join)
monkeypatch.setattr(os.path, 'isabs', os.path.isabs)
monkeypatch.setattr(os.path, 'splitdrive', os.path.splitdrive)
monkeypatch.setattr(sysconfig, '_config_vars', copy(sysconfig._config_vars))
monkeypatch.setattr(sysconfig, 'get_config_vars', sysconfig.get_config_vars)
Copy link
Contributor

@abravalheri abravalheri Feb 21, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes in setuptools/_distutils/tests/test_util.py are overwritten every time setuptools syncs up with pypa/distutils, so probably they have to be proposed in the pypa/distutils repository first and later merged here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I can go make the changes upstream to the right place.



@pytest.mark.usefixtures('save_env')
Expand Down
6 changes: 2 additions & 4 deletions setuptools/command/build_ext.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

from distutils.command.build_ext import build_ext as _du_build_ext
from distutils.ccompiler import new_compiler
from distutils.sysconfig import customize_compiler, get_config_var
from distutils.sysconfig import customize_compiler, get_config_var, get_config_vars
from distutils import log

from setuptools.errors import BaseError
Expand All @@ -24,9 +24,7 @@
except ImportError:
_build_ext = _du_build_ext

# make sure _config_vars is initialized
get_config_var("LDSHARED")
from distutils.sysconfig import _config_vars as _CONFIG_VARS # noqa
_CONFIG_VARS = get_config_vars()


def _customize_compiler_for_shlib(compiler):
Expand Down