[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH RFC 1/6] experiment: add mkvenv install
From: |
John Snow |
Subject: |
[PATCH RFC 1/6] experiment: add mkvenv install |
Date: |
Tue, 20 Jun 2023 20:21:16 -0400 |
This is just so I can do "mkvenv install './python'" or "mkvenv install
file:python" to install the in-tree packages to pyvenv.
It probably isn't quite appropriate to bypass do_ensure in its entirety
like this because we miss out on a lot of error handling, but as a quick
proof of concept it works just fine.
Signed-off-by: John Snow <jsnow@redhat.com>
---
python/scripts/mkvenv.py | 40 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/python/scripts/mkvenv.py b/python/scripts/mkvenv.py
index a47f1eaf5d..ea8df34111 100644
--- a/python/scripts/mkvenv.py
+++ b/python/scripts/mkvenv.py
@@ -940,6 +940,35 @@ def _add_ensure_subcommand(subparsers: Any) -> None:
)
+def _add_install_subcommand(subparsers: Any) -> None:
+ subparser = subparsers.add_parser(
+ "install", help="Install the specified package."
+ )
+ subparser.add_argument(
+ "--online",
+ action="store_true",
+ help="Install packages from PyPI, if necessary.",
+ )
+ subparser.add_argument(
+ "--dir",
+ type=str,
+ action="store",
+ help="Path to vendored packages where we may install from.",
+ )
+ subparser.add_argument(
+ '--editable',
+ action="store_true",
+ help="Should package(s) be installed in editable mode?"
+ )
+ subparser.add_argument(
+ "dep_specs",
+ type=str,
+ action="store",
+ help="PEP 508 Dependency specification, e.g. 'meson>=0.61.5'",
+ nargs="+",
+ )
+
+
def main() -> int:
"""CLI interface to make_qemu_venv. See module docstring."""
if os.environ.get("DEBUG") or os.environ.get("GITLAB_CI"):
@@ -964,6 +993,7 @@ def main() -> int:
_add_create_subcommand(subparsers)
_add_post_init_subcommand(subparsers)
_add_ensure_subcommand(subparsers)
+ _add_install_subcommand(subparsers)
args = parser.parse_args()
try:
@@ -982,6 +1012,16 @@ def main() -> int:
wheels_dir=args.dir,
prog=args.diagnose,
)
+ if args.command == "install":
+ print(f"mkvenv: installing {', '.join(args.dep_specs)}",
file=sys.stderr)
+ pip_args = list(args.dep_specs)
+ if args.editable:
+ pip_args.insert(0, "--editable")
+ pip_install(
+ args=pip_args,
+ online=args.online,
+ wheels_dir=args.dir
+ )
logger.debug("mkvenv.py %s: exiting", args.command)
except Ouch as exc:
print("\n*** Ouch! ***\n", file=sys.stderr)
--
2.40.1
- [PATCH RFC 0/6] Switch iotests to pyvenv, John Snow, 2023/06/20
- [PATCH RFC 2/6] build, tests: Add qemu in-tree packages to pyvenv at configure time., John Snow, 2023/06/20
- [PATCH RFC 4/6] iotests: use the correct python to run linters, John Snow, 2023/06/20
- [PATCH RFC 6/6] iotests: don't add qemu.git/python to PYTHONPATH, John Snow, 2023/06/20
- [PATCH RFC 5/6] iotests: use pyvenv/bin/python3 to launch child test processes, John Snow, 2023/06/20
- [PATCH RFC 3/6] iotests: get rid of '..' in path environment output, John Snow, 2023/06/20
- [PATCH RFC 1/6] experiment: add mkvenv install,
John Snow <=
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, Paolo Bonzini, 2023/06/21
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, Paolo Bonzini, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, John Snow, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, Paolo Bonzini, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, John Snow, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, Paolo Bonzini, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, John Snow, 2023/06/22
- Re: [PATCH RFC 0/6] Switch iotests to pyvenv, Paolo Bonzini, 2023/06/22