Skip to content

Commit 94e26b2

Browse files
authored
Directory with an empty pyproject.toml files is built into an sdist+wheel by setuptools 64
Fixes pypa#3511
1 parent 975823a commit 94e26b2

File tree

4 files changed

+14
-25
lines changed

4 files changed

+14
-25
lines changed

.devcontainer/devcontainer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"image":"mcr.microsoft.com/devcontainers/universal:2"}

.vscode/launch.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"configurations":
3+
4+
]
5+
}

_distutils_hack/__init__.py

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
# don't import any costly modules
22
import sys
33
import os
4+
from _distutils_hack.clear_distutils import clear_distutils
5+
from _distutils_hack.is_pypy import is_pypy
46

5-
6-
is_pypy = '__pypy__' in sys.builtin_module_names
7+
from _distutils_hack.override import enabled
78

89

910
def warn_distutils_present():
@@ -25,29 +26,6 @@ def warn_distutils_present():
2526
)
2627

2728

28-
def clear_distutils():
29-
if 'distutils' not in sys.modules:
30-
return
31-
import warnings
32-
33-
warnings.warn("Setuptools is replacing distutils.")
34-
mods = [
35-
name
36-
for name in sys.modules
37-
if name == "distutils" or name.startswith("distutils.")
38-
]
39-
for name in mods:
40-
del sys.modules[name]
41-
42-
43-
def enabled():
44-
"""
45-
Allow selection of distutils by environment variable.
46-
"""
47-
which = os.environ.get('SETUPTOOLS_USE_DISTUTILS', 'local')
48-
return which == 'local'
49-
50-
5129
def ensure_local_distutils():
5230
import importlib
5331

@@ -220,3 +198,4 @@ def remove_shim():
220198
sys.meta_path.remove(DISTUTILS_FINDER)
221199
except ValueError:
222200
pass
201+

_distutils_hack/is_pypy.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from pkg_resources import new_func
2+
3+
4+
is_pypy = new_func()

0 commit comments

Comments
 (0)