Clean up egg_info arg construction
@@ -12,7 +12,8 @@ from pip._internal.utils.typing import MYPY_CHECK_RUNNING
from pip._internal.vcs import vcs
if MYPY_CHECK_RUNNING:
- from typing import Callable, List
+ from typing import Callable, List, Optional
+
from pip._internal.req.req_install import InstallRequirement
logger = logging.getLogger(__name__)
@@ -104,22 +105,26 @@ def _generate_metadata_legacy(install_req):
if install_req.isolated:
base_cmd += ["--no-user-cfg"]
+ base_cmd += ["egg_info"]
+
+ egg_info_dir = None # type: Optional[str]
# For non-editable installs, don't put the .egg-info files at the root,
# to avoid confusion due to the source code being considered an installed
# egg.
- egg_base_option = [] # type: List[str]
if not install_req.editable:
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.
ensure_dir(egg_info_dir)
+ if egg_info_dir:
+ base_cmd += ['--egg-base', egg_info_dir]
+
with install_req.build_env:
call_subprocess(
- base_cmd + ["egg_info"] + egg_base_option,
+ base_cmd,
cwd=install_req.unpacked_source_directory,
command_desc='python setup.py egg_info',
)
