Skip to content

Commit 66c3e60

Browse files
committed
Move arg builder functions to setuptools_build
1 parent 3d93138 commit 66c3e60

File tree

2 files changed

+44
-41
lines changed

2 files changed

+44
-41
lines changed

src/pip/_internal/utils/setuptools_build.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,44 @@ def make_setuptools_shim_args(
4747
return args
4848

4949

50+
def make_setuptools_bdist_wheel_args(
51+
setup_py_path, # type: str
52+
global_options, # type: Sequence[str]
53+
build_options, # type: Sequence[str]
54+
destination_dir, # type: str
55+
python_tag, # type: Optional[str]
56+
):
57+
# type: (...) -> List[str]
58+
# NOTE: Eventually, we'd want to also -S to the flags here, when we're
59+
# isolating. Currently, it breaks Python in virtualenvs, because it
60+
# relies on site.py to find parts of the standard library outside the
61+
# virtualenv.
62+
args = make_setuptools_shim_args(
63+
setup_py_path,
64+
global_options=global_options,
65+
unbuffered_output=True
66+
)
67+
args += ["bdist_wheel", "-d", destination_dir]
68+
args += build_options
69+
if python_tag is not None:
70+
args += ["--python-tag", python_tag]
71+
return args
72+
73+
74+
def make_setuptools_clean_args(
75+
setup_py_path, # type: str
76+
global_options, # type: Sequence[str]
77+
):
78+
# type: (...) -> List[str]
79+
args = make_setuptools_shim_args(
80+
setup_py_path,
81+
global_options=global_options,
82+
unbuffered_output=True
83+
)
84+
args += ["clean", "--all"]
85+
return args
86+
87+
5088
def make_setuptools_develop_args(
5189
setup_py_path, # type: str
5290
global_options, # type: Sequence[str]

src/pip/_internal/wheel.py

Lines changed: 6 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,10 @@
3939
from pip._internal.utils.logging import indent_log
4040
from pip._internal.utils.marker_files import has_delete_marker_file
4141
from pip._internal.utils.misc import captured_stdout, ensure_dir, read_chunks
42-
from pip._internal.utils.setuptools_build import make_setuptools_shim_args
42+
from pip._internal.utils.setuptools_build import (
43+
make_setuptools_bdist_wheel_args,
44+
make_setuptools_clean_args,
45+
)
4346
from pip._internal.utils.subprocess import (
4447
LOG_DIVIDER,
4548
call_subprocess,
@@ -957,44 +960,6 @@ def _build_one_inside_env(self, req, output_dir, python_tag=None):
957960
self._clean_one(req)
958961
return None
959962

960-
def _make_setuptools_bdist_wheel_args(
961-
self,
962-
setup_py_path, # type: str
963-
global_options, # type: Sequence[str]
964-
build_options, # type: Sequence[str]
965-
destination_dir, # type: str
966-
python_tag, # type: Optional[str]
967-
):
968-
# type: (...) -> List[str]
969-
# NOTE: Eventually, we'd want to also -S to the flags here, when we're
970-
# isolating. Currently, it breaks Python in virtualenvs, because it
971-
# relies on site.py to find parts of the standard library outside the
972-
# virtualenv.
973-
args = make_setuptools_shim_args(
974-
setup_py_path,
975-
global_options=global_options,
976-
unbuffered_output=True
977-
)
978-
args += ["bdist_wheel", "-d", destination_dir]
979-
args += build_options
980-
if python_tag is not None:
981-
args += ["--python-tag", python_tag]
982-
return args
983-
984-
def _make_setuptools_clean_args(
985-
self,
986-
setup_py_path, # type: str
987-
global_options, # type: Sequence[str]
988-
):
989-
# type: (...) -> List[str]
990-
args = make_setuptools_shim_args(
991-
setup_py_path,
992-
global_options=global_options,
993-
unbuffered_output=True
994-
)
995-
args += ["clean", "--all"]
996-
return args
997-
998963
def _build_one_pep517(self, req, tempd, python_tag=None):
999964
"""Build one InstallRequirement using the PEP 517 build process.
1000965
@@ -1039,7 +1004,7 @@ def _build_one_legacy(self, req, tempd, python_tag=None):
10391004
10401005
Returns path to wheel if successfully built. Otherwise, returns None.
10411006
"""
1042-
wheel_args = self._make_setuptools_bdist_wheel_args(
1007+
wheel_args = make_setuptools_bdist_wheel_args(
10431008
req.setup_py_path,
10441009
global_options=self.global_options,
10451010
build_options=self.build_options,
@@ -1073,7 +1038,7 @@ def _build_one_legacy(self, req, tempd, python_tag=None):
10731038
return wheel_path
10741039

10751040
def _clean_one(self, req):
1076-
clean_args = self._make_setuptools_clean_args(
1041+
clean_args = make_setuptools_clean_args(
10771042
req.setup_py_path,
10781043
global_options=self.global_options,
10791044
)

0 commit comments

Comments
 (0)