editable_legacy.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. """Legacy editable installation process, i.e. `setup.py develop`.
  2. """
  3. import logging
  4. from typing import Optional, Sequence
  5. from pip._internal.build_env import BuildEnvironment
  6. from pip._internal.utils.logging import indent_log
  7. from pip._internal.utils.setuptools_build import make_setuptools_develop_args
  8. from pip._internal.utils.subprocess import call_subprocess
  9. logger = logging.getLogger(__name__)
  10. def install_editable(
  11. *,
  12. global_options: Sequence[str],
  13. prefix: Optional[str],
  14. home: Optional[str],
  15. use_user_site: bool,
  16. name: str,
  17. setup_py_path: str,
  18. isolated: bool,
  19. build_env: BuildEnvironment,
  20. unpacked_source_directory: str,
  21. ) -> None:
  22. """Install a package in editable mode. Most arguments are pass-through
  23. to setuptools.
  24. """
  25. logger.info("Running setup.py develop for %s", name)
  26. args = make_setuptools_develop_args(
  27. setup_py_path,
  28. global_options=global_options,
  29. no_user_config=isolated,
  30. prefix=prefix,
  31. home=home,
  32. use_user_site=use_user_site,
  33. )
  34. with indent_log():
  35. with build_env:
  36. call_subprocess(
  37. args,
  38. command_desc="python setup.py develop",
  39. cwd=unpacked_source_directory,
  40. )