From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3A06945E1E; Tue, 3 Dec 2024 18:08:10 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1AF2C40270; Tue, 3 Dec 2024 18:08:10 +0100 (CET) Received: from mail-pf1-f177.google.com (mail-pf1-f177.google.com [209.85.210.177]) by mails.dpdk.org (Postfix) with ESMTP id D4D484025D for ; Tue, 3 Dec 2024 18:08:08 +0100 (CET) Received: by mail-pf1-f177.google.com with SMTP id d2e1a72fcca58-724e1742d0dso4814778b3a.0 for ; Tue, 03 Dec 2024 09:08:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1733245688; x=1733850488; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=DW9x8ARlvPjSIvvJ7DAfb+9UeY73wItCzOE0NGH+f2w=; b=YhyKrFdRrzCSinR9hx0ZzZYHCASrwc89MH7wjj7e2Fk2KpgKFz8bI1bYBLxGHdlQah j5iP/KMkEGrZOKC8atNvCbH3392BlZgTuD/onthwBFODc/Fr08HbjKExEN7e1iYd3lZE 2KGJRcFjxJakpfmzae/Q+cLhBFr9aopCgc4nihqNwc7TpM4C4GOzOH0VoKAva01IBWvd CFsnn+81GSo3gJoME2ndceY6FgLRMnymXQcHWknFyDONsVVtEpRi879U197mXxTT98pn zy5DHBsD7IRXa/bx377oPAxf99wqJU/cVnx3s42fhv9DsC5gaGZ5kTQciLRXf+OZMA/s 3sAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733245688; x=1733850488; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DW9x8ARlvPjSIvvJ7DAfb+9UeY73wItCzOE0NGH+f2w=; b=WP0x66r38VLiO7sjrG9twjkJMK1XNl6kKJXppBXEIj/hiUPxpqOSt3XNxD9+/fRR22 ymbuZUNIFxqYuHWtPYluv0FcLrr0Mcf4Bfk4d0H4sk9r5iALqXeiCZoxn5T8txDv8/Qr 3zUzdeXNx2CFw8Zy/lL4DKeum1CcNfs5VGnl7wVCDmXnmtTYUYD9clxgoL8oL4inFxzL /Lc2Pui9/TMuiz9C+vTkPn7Fn9PEAVEeyXuI31MoTD/42Qyy6VnOUBA6HCmyULjebaEu /nNQ/FWEwSV/EJfNiarHAvsuJx3vQOzNA1h7SDXL6JJqBydUQkbWG6GTniMqNV1mAr8J 12FQ== X-Gm-Message-State: AOJu0YxWGQA86D1mMzpsokFwT8MGYVS9dzgTInzzqOtJZNTsUVUSa2uj hf7vymzaX7naTIixQZZKQPq0pN2SAYGS3jAYH8jZoIRV72d2vbs+gC65/6iIUNg= X-Gm-Gg: ASbGnctg0x7rK9qeuZmhl2trfT8DVH9NRPBLIS4AG1OTVtYWCq6cNn2ayo+gAB9JLeN WHlYUnBxC8ioklaQJCI5ivCBJ/SZIwfZHN3HzQqTLvYUBcVdH026e3CeaJhrFV5bo9tCdOVaio1 Pbe0vSMctHLuN0AR8FeLM//MuDKHnmRbz7w0czcy1qvVdLsaB9qYK/ecc9tHcvLppvfKuPaeBRY Y50GWWr28l8nzw7/ui8vfQzvLIUbkJrW3pFSJ64iWl8qOBbsiS7h6PbMEDl55voG90t8Z7DcGpS zafUAddsEDy3Q7XZOkwO+TwXdQ8= X-Google-Smtp-Source: AGHT+IEyl04vv3Lho0T00GyDm7yoyq9ut1ho8Yl9KAiNdIu6qfHxq+GLXwLfKdYYg4uIAOB6NSeFiQ== X-Received: by 2002:a17:90b:540e:b0:2ee:f687:6ad3 with SMTP id 98e67ed59e1d1-2ef0125c454mr3796555a91.28.1733245688077; Tue, 03 Dec 2024 09:08:08 -0800 (PST) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2ee6580d9f7sm7982740a91.18.2024.12.03.09.08.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Dec 2024 09:08:07 -0800 (PST) Date: Tue, 3 Dec 2024 09:07:52 -0800 From: Stephen Hemminger To: Anatoly Burakov Cc: dev@dpdk.org, Robin Jarry Subject: Re: [PATCH v2 1/2] usertools/devbind: update coding style Message-ID: <20241203090752.39f9c89d@hermes.local> In-Reply-To: <236299d7081f4a06a6f6d06eb575539582c0344f.1733224995.git.anatoly.burakov@intel.com> References: <236299d7081f4a06a6f6d06eb575539582c0344f.1733224995.git.anatoly.burakov@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org On Tue, 3 Dec 2024 11:25:00 +0000 Anatoly Burakov wrote: > + > +def check_installed(program: str, package: str) -> None: > + """Check if a program is installed.""" > + if subprocess.call( > + ["which", program], stdout=3Dsubprocess.DEVNULL, stderr=3Dsubpro= cess.DEVNULL > + ): > + raise DevbindError(f"'{program}' not found - please install '{pa= ckage}'.") > + Apparently the posix way to do this is to use command -v not "which" command [-pVv] command [arg ...] Run command with args suppressing the normal shell func= tion lookup. Only builtin commands or commands found in the PATH = are executed. If the -p option is given, the search for comman= d is performed using a default value for PATH that is guaranteed= to find all of the standard utilities. If either the -V or -v= op=E2=80=90 tion is supplied, a description of command is printed. The= -v option causes a single word indicating the command or file= name used to invoke command to be displayed; the -V option produce= s a more verbose description. If the -V or -v option is suppl= ied, the exit status is 0 if command was found, and 1 if not. If = nei=E2=80=90 ther option is supplied and an error occurred or command ca= nnot be found, the exit status is 127. Otherwise, the exit statu= s of the command builtin is the exit status of command.