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 List, 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. install_options: List[str],
  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. install_options=install_options,
  30. no_user_config=isolated,
  31. prefix=prefix,
  32. home=home,
  33. use_user_site=use_user_site,
  34. )
  35. with indent_log():
  36. with build_env:
  37. call_subprocess(
  38. args,
  39. cwd=unpacked_source_directory,
  40. )