Package: virtualenvwrapper
Version: 4.8.4-4
Severity: normal
Tags: patch upstream
X-Debbugs-Cc: deb...@microjoe.org

Dear Maintainer,

The usage of `which` is now deprecated on Debian unstable:

> usr/bin/which: this version of `which' is deprecated; use `command -v'
> in scripts instead.

The attached patch should prevent this warning message from appearing
when sourcing `virtualenvwrapper.sh`. Note that latest upstream release
5.0.0 is still using `which`, so this patch should be carried (or
forwarded) for future releases.

-- System Information:
Debian Release: bookworm/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 5.10.0-8-amd64 (SMP w/4 CPU threads)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Versions of packages virtualenvwrapper depends on:
ii  python3-virtualenvwrapper  4.8.4-4
ii  virtualenv                 20.4.0+ds-2

Versions of packages virtualenvwrapper recommends:
ii  bash-completion  1:2.11-3

Versions of packages virtualenvwrapper suggests:
pn  virtualenvwrapper-doc  <none>

-- no debconf information
From: Romain Porte <micro...@microjoe.org>
Date: Mon, 20 Sep 2021 21:29:04 +0200
Subject: virtualenvwrapper.sh: use command -v instead of which

This commit fixes the following new warning when sourcing
virtualenvwrapper.sh:

> /usr/bin/which: this version of `which' is deprecated;
> use `command -v' in scripts instead.
---
 virtualenvwrapper.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/virtualenvwrapper.sh b/virtualenvwrapper.sh
index 6da6536..b7029f6 100644
--- a/virtualenvwrapper.sh
+++ b/virtualenvwrapper.sh
@@ -47,7 +47,7 @@
 # Locate the global Python where virtualenvwrapper is installed.
 if [ "${VIRTUALENVWRAPPER_PYTHON:-}" = "" ]
 then
-    VIRTUALENVWRAPPER_PYTHON="$(command \which python3)"
+    VIRTUALENVWRAPPER_PYTHON="$(command -v python3)"
 fi
 
 # Set the name of the virtualenv app to use.
@@ -319,7 +319,7 @@ function virtualenvwrapper_initialize {
 
 # Verify that the passed resource is in path and exists
 function virtualenvwrapper_verify_resource {
-    typeset exe_path="$(command \which "$1" | (unset GREP_OPTIONS; command 
\grep -v "not found"))"
+    typeset exe_path="$(command -v "$1" | (unset GREP_OPTIONS; command \grep 
-v "not found"))"
     if [ "$exe_path" = "" ]
     then
         echo "ERROR: virtualenvwrapper could not find $1 in your path" >&2

Reply via email to