mirror of https://github.com/pypa/pip
Rename {setup_py_dir -> unpacked_source_directory} (#7086)
This commit is contained in:
commit
33b0240082
|
@ -41,7 +41,9 @@ def _generate_metadata_legacy(install_req):
|
|||
# egg.
|
||||
egg_base_option = [] # type: List[str]
|
||||
if not install_req.editable:
|
||||
egg_info_dir = os.path.join(install_req.setup_py_dir, 'pip-egg-info')
|
||||
egg_info_dir = os.path.join(
|
||||
install_req.unpacked_source_directory, 'pip-egg-info',
|
||||
)
|
||||
egg_base_option = ['--egg-base', egg_info_dir]
|
||||
|
||||
# setuptools complains if the target directory does not exist.
|
||||
|
@ -50,7 +52,7 @@ def _generate_metadata_legacy(install_req):
|
|||
with install_req.build_env:
|
||||
call_subprocess(
|
||||
base_cmd + ["egg_info"] + egg_base_option,
|
||||
cwd=install_req.setup_py_dir,
|
||||
cwd=install_req.unpacked_source_directory,
|
||||
command_desc='python setup.py egg_info',
|
||||
)
|
||||
|
||||
|
|
|
@ -21,9 +21,9 @@ def _is_list_of_str(obj):
|
|||
)
|
||||
|
||||
|
||||
def make_pyproject_path(setup_py_dir):
|
||||
def make_pyproject_path(unpacked_source_directory):
|
||||
# type: (str) -> str
|
||||
path = os.path.join(setup_py_dir, 'pyproject.toml')
|
||||
path = os.path.join(unpacked_source_directory, 'pyproject.toml')
|
||||
|
||||
# Python2 __file__ should not be unicode
|
||||
if six.PY2 and isinstance(path, six.text_type):
|
||||
|
|
|
@ -485,7 +485,7 @@ class InstallRequirement(object):
|
|||
|
||||
# Things valid for sdists
|
||||
@property
|
||||
def setup_py_dir(self):
|
||||
def unpacked_source_directory(self):
|
||||
# type: () -> str
|
||||
return os.path.join(
|
||||
self.source_dir,
|
||||
|
@ -495,8 +495,7 @@ class InstallRequirement(object):
|
|||
def setup_py_path(self):
|
||||
# type: () -> str
|
||||
assert self.source_dir, "No source dir for %s" % self
|
||||
|
||||
setup_py = os.path.join(self.setup_py_dir, 'setup.py')
|
||||
setup_py = os.path.join(self.unpacked_source_directory, 'setup.py')
|
||||
|
||||
# Python2 __file__ should not be unicode
|
||||
if six.PY2 and isinstance(setup_py, six.text_type):
|
||||
|
@ -508,8 +507,7 @@ class InstallRequirement(object):
|
|||
def pyproject_toml_path(self):
|
||||
# type: () -> str
|
||||
assert self.source_dir, "No source dir for %s" % self
|
||||
|
||||
return make_pyproject_path(self.setup_py_dir)
|
||||
return make_pyproject_path(self.unpacked_source_directory)
|
||||
|
||||
def load_pyproject_toml(self):
|
||||
# type: () -> None
|
||||
|
@ -535,7 +533,9 @@ class InstallRequirement(object):
|
|||
requires, backend, check = pyproject_toml_data
|
||||
self.requirements_to_check = check
|
||||
self.pyproject_requires = requires
|
||||
self.pep517_backend = Pep517HookCaller(self.setup_py_dir, backend)
|
||||
self.pep517_backend = Pep517HookCaller(
|
||||
self.unpacked_source_directory, backend
|
||||
)
|
||||
|
||||
# Use a custom function to call subprocesses
|
||||
self.spin_message = ""
|
||||
|
@ -665,7 +665,7 @@ class InstallRequirement(object):
|
|||
base = self.source_dir
|
||||
filenames = locate_editable_egg_info(base)
|
||||
else:
|
||||
base = os.path.join(self.setup_py_dir, 'pip-egg-info')
|
||||
base = os.path.join(self.unpacked_source_directory, 'pip-egg-info')
|
||||
filenames = os.listdir(base)
|
||||
|
||||
if not filenames:
|
||||
|
@ -770,8 +770,7 @@ class InstallRequirement(object):
|
|||
base_cmd +
|
||||
['develop', '--no-deps'] +
|
||||
list(install_options),
|
||||
|
||||
cwd=self.setup_py_dir,
|
||||
cwd=self.unpacked_source_directory,
|
||||
)
|
||||
|
||||
self.install_succeeded = True
|
||||
|
@ -883,7 +882,9 @@ class InstallRequirement(object):
|
|||
archive_path, 'w', zipfile.ZIP_DEFLATED, allowZip64=True,
|
||||
)
|
||||
with zip_output:
|
||||
dir = os.path.normcase(os.path.abspath(self.setup_py_dir))
|
||||
dir = os.path.normcase(
|
||||
os.path.abspath(self.unpacked_source_directory)
|
||||
)
|
||||
for dirpath, dirnames, filenames in os.walk(dir):
|
||||
if 'pip-egg-info' in dirnames:
|
||||
dirnames.remove('pip-egg-info')
|
||||
|
@ -956,7 +957,7 @@ class InstallRequirement(object):
|
|||
with self.build_env:
|
||||
call_subprocess(
|
||||
install_args + install_options,
|
||||
cwd=self.setup_py_dir,
|
||||
cwd=self.unpacked_source_directory,
|
||||
spinner=spinner,
|
||||
)
|
||||
|
||||
|
|
|
@ -1019,12 +1019,16 @@ class WheelBuilder(object):
|
|||
wheel_args += ["--python-tag", python_tag]
|
||||
|
||||
try:
|
||||
output = call_subprocess(wheel_args, cwd=req.setup_py_dir,
|
||||
spinner=spinner)
|
||||
output = call_subprocess(
|
||||
wheel_args,
|
||||
cwd=req.unpacked_source_directory,
|
||||
spinner=spinner,
|
||||
)
|
||||
except Exception:
|
||||
spinner.finish("error")
|
||||
logger.error('Failed building wheel for %s', req.name)
|
||||
return None
|
||||
|
||||
names = os.listdir(tempd)
|
||||
wheel_path = get_legacy_build_wheel_path(
|
||||
names=names,
|
||||
|
|
Loading…
Reference in New Issue