From nobody Mon Nov 25 05:02:13 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1717661581; cv=none; d=zohomail.com; s=zohoarc; b=h5TojtvRoxVzblqt5R9zMWaDqDqv6JAJJUedbAE9FrLMOX//U/cK8RBptJk5NvudRzsG021YeXzfEfMOlBPxsLkDEyPR9T/y51MZHs/FkcKr21MBxGvcReVFh2IEU9CVIE900LwcFurX8FB4gUORLPuet7c91+AoW9O0Fi4Pt5E= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1717661581; h=Content-Type:Content-Transfer-Encoding:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To:Cc; bh=n5zvmcvef8pRBAw9VrXIyPOYRYeCWBajLWVRPej6rGM=; b=LNbQF10OFD4QevS//vAd/P3L6ZBJhNaTXe0jh3sve8a/4oLCj1pk314xmPFh9GqwRjK5ei1aVXfhskM97gANoRYb9OiiVJHvvmR3UREcc2PSKS4PFgvylXFKdh/+tKFgXJ/FBOJFTJBH7KKegPZrRSThDFUMsMBzEsKYGWQ1Z1g= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1717661581088783.8093271550982; Thu, 6 Jun 2024 01:13:01 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sF8EI-0007wj-Lk; Thu, 06 Jun 2024 04:12:14 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sF8ED-0007va-4P for qemu-devel@nongnu.org; Thu, 06 Jun 2024 04:12:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sF8EA-0007w9-Ik for qemu-devel@nongnu.org; Thu, 06 Jun 2024 04:12:08 -0400 Received: from mail-lj1-f197.google.com (mail-lj1-f197.google.com [209.85.208.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-636-23eKkELWPfq9D60w-1Tm3A-1; Thu, 06 Jun 2024 04:12:03 -0400 Received: by mail-lj1-f197.google.com with SMTP id 38308e7fff4ca-2ea95d34474so4202291fa.3 for ; Thu, 06 Jun 2024 01:12:03 -0700 (PDT) Received: from avogadro.local ([151.81.115.112]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-57aae2366a4sm655925a12.92.2024.06.06.01.12.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 06 Jun 2024 01:12:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1717661525; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=n5zvmcvef8pRBAw9VrXIyPOYRYeCWBajLWVRPej6rGM=; b=ilayfvd0oBpPPIJ/Iu3z2EXUEghORPvT7wm8nwZZ5vxmcBRa0VQRZPXbuM0/73KHXYoWbC 8rLgVL8PuxPMrqSMXrp2+209qJU5bj9/UT+OWVKospAdJcocchNRVd+yxn/B4ibbbOi9S7 s902pJi/k9PCrrCxS0K7tQQKgRnp0OI= X-MC-Unique: 23eKkELWPfq9D60w-1Tm3A-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717661522; x=1718266322; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n5zvmcvef8pRBAw9VrXIyPOYRYeCWBajLWVRPej6rGM=; b=hKP2jOw0qiwAiJRmDFcaFD0x16ahTlC7L/fCdRVfImniZWjL7zU6ElEfoo7e9bpZ+U ZmqTfYsQK2nS9iYlAn7PS84mjSNZVIXUvVI3pBcJ89QK/P5r/NpGKBS+RhqO3KwU2NRC de385k92ArCkhyQPTsb3BUnGfen0lqwiNKMwGyij3viStZVHEzsZNWTXuQ3p22vtgoTU priNr28/AdmDqz/KDcXEvA2vNTSRUYo2nwohVGhkemI8apor3sCqRb36itDj2BgJJYhy YxxUyvwk0fwGfejPVbcrZUHuPv2Aa3mfLDhp3xzI2hYutaxVGWexpDMYC6hGbwWd7RnP 2r4g== X-Gm-Message-State: AOJu0YxPHmthKZRcHGbN4DkCq3d2xXk5Fh+ypRnSlNU00sNomxK03EXR a0RnorKNIqL8nEkl84gTjUAFnP8N+LXxkb8NAYIBEDf5zOm2hVtKdI4hKsfvvoqkPruSJK5+XF+ sR519VmZHMsW2bkROeZYLR+nVgqYsX3qYjmaoXYusMKEAvyn9QeMW2QGRqroXah65aOwCKykEqn iHWI4FP6q2u4rMzjyBVYquOTD0MPL+eSlR96qo X-Received: by 2002:a05:651c:620:b0:2de:7cc5:7a27 with SMTP id 38308e7fff4ca-2eac798be90mr25030831fa.5.1717661521889; Thu, 06 Jun 2024 01:12:01 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFmakkqgc7o764yUdGvsO9f3ax402vAZueWz/bmREsNKJbkPCbylbUK3I5CHM0pqM0W89MNaQ== X-Received: by 2002:a05:651c:620:b0:2de:7cc5:7a27 with SMTP id 38308e7fff4ca-2eac798be90mr25030531fa.5.1717661521143; Thu, 06 Jun 2024 01:12:01 -0700 (PDT) From: Paolo Bonzini To: qemu-devel@nongnu.org Subject: [PATCH 2/2] python: mkvenv: remove ensure command Date: Thu, 6 Jun 2024 10:11:53 +0200 Message-ID: <20240606081153.2457559-3-pbonzini@redhat.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240606081153.2457559-1-pbonzini@redhat.com> References: <20240606081153.2457559-1-pbonzini@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=pbonzini@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1717661581609100003 Content-Type: text/plain; charset="utf-8" This was used to bootstrap the venv with a TOML parser, after which ensuregroup is used. Now that we expect it to be present as a system package (either tomli or, for Python 3.11, tomllib), it is not needed anymore. Note that this means that, when implemented, the hypothetical "isolated" mode that does not use any system packages will only work with Python 3.11+. Signed-off-by: Paolo Bonzini --- python/scripts/mkvenv.py | 105 --------------------------------------- 1 file changed, 105 deletions(-) diff --git a/python/scripts/mkvenv.py b/python/scripts/mkvenv.py index d0b9c215ca2..f2526af0a04 100644 --- a/python/scripts/mkvenv.py +++ b/python/scripts/mkvenv.py @@ -13,7 +13,6 @@ create create a venv post_init post-venv initialization - ensure Ensure that the specified package is installed. ensuregroup Ensure that the specified package group is installed. =20 @@ -36,18 +35,6 @@ =20 -------------------------------------------------- =20 -usage: mkvenv ensure [-h] [--online] [--dir DIR] dep_spec... - -positional arguments: - dep_spec PEP 508 Dependency specification, e.g. 'meson>=3D0.61.5' - -options: - -h, --help show this help message and exit - --online Install packages from PyPI, if necessary. - --dir DIR Path to vendored packages where we may install from. - --------------------------------------------------- - usage: mkvenv ensuregroup [-h] [--online] [--dir DIR] file group... =20 positional arguments: @@ -726,57 +713,6 @@ def _do_ensure( return None =20 =20 -def ensure( - dep_specs: Sequence[str], - online: bool =3D False, - wheels_dir: Optional[Union[str, Path]] =3D None, - prog: Optional[str] =3D None, -) -> None: - """ - Use pip to ensure we have the package specified by @dep_specs. - - If the package is already installed, do nothing. If online and - wheels_dir are both provided, prefer packages found in wheels_dir - first before connecting to PyPI. - - :param dep_specs: - PEP 508 dependency specifications. e.g. ['meson>=3D0.61.5']. - :param online: If True, fall back to PyPI. - :param wheels_dir: If specified, search this path for packages. - :param prog: - If specified, use this program name for error diagnostics that will - be presented to the user. e.g., 'sphinx-build' can be used as a - bellwether for the presence of 'sphinx'. - """ - - if not HAVE_DISTLIB: - raise Ouch("a usable distlib could not be found, please install it= ") - - # Convert the depspecs to a dictionary, as if they came - # from a section in a pythondeps.toml file - group: Dict[str, Dict[str, str]] =3D {} - for spec in dep_specs: - name =3D distlib.version.LegacyMatcher(spec).name - group[name] =3D {} - - spec =3D spec.strip() - pos =3D len(name) - ver =3D spec[pos:].strip() - if ver: - group[name]["accepted"] =3D ver - - if prog: - group[name]["canary"] =3D prog - prog =3D None - - result =3D _do_ensure(group, online, wheels_dir) - if result: - # Well, that's not good. - if result[1]: - raise Ouch(result[0]) - raise SystemExit(f"\n{result[0]}\n\n") - - def _parse_groups(file: str) -> Dict[str, Dict[str, Any]]: if not HAVE_TOMLLIB: if sys.version_info < (3, 11): @@ -888,39 +824,6 @@ def _add_ensuregroup_subcommand(subparsers: Any) -> No= ne: ) =20 =20 -def _add_ensure_subcommand(subparsers: Any) -> None: - subparser =3D subparsers.add_parser( - "ensure", help=3D"Ensure that the specified package is installed." - ) - subparser.add_argument( - "--online", - action=3D"store_true", - help=3D"Install packages from PyPI, if necessary.", - ) - subparser.add_argument( - "--dir", - type=3Dstr, - action=3D"store", - help=3D"Path to vendored packages where we may install from.", - ) - subparser.add_argument( - "--diagnose", - type=3Dstr, - action=3D"store", - help=3D( - "Name of a shell utility to use for " - "diagnostics if this command fails." - ), - ) - subparser.add_argument( - "dep_specs", - type=3Dstr, - action=3D"store", - help=3D"PEP 508 Dependency specification, e.g. 'meson>=3D0.61.5'", - nargs=3D"+", - ) - - def main() -> int: """CLI interface to make_qemu_venv. See module docstring.""" if os.environ.get("DEBUG") or os.environ.get("GITLAB_CI"): @@ -944,7 +847,6 @@ def main() -> int: =20 _add_create_subcommand(subparsers) _add_post_init_subcommand(subparsers) - _add_ensure_subcommand(subparsers) _add_ensuregroup_subcommand(subparsers) =20 args =3D parser.parse_args() @@ -957,13 +859,6 @@ def main() -> int: ) if args.command =3D=3D "post_init": post_venv_setup() - if args.command =3D=3D "ensure": - ensure( - dep_specs=3Dargs.dep_specs, - online=3Dargs.online, - wheels_dir=3Dargs.dir, - prog=3Dargs.diagnose, - ) if args.command =3D=3D "ensuregroup": ensure_group( file=3Dargs.file, --=20 2.45.1