Package: dh-virtualenv
Version: 1.2.2-3
Severity: normal

dh_virtualenv rewrites the VIRTUAL_ENV assignments in bin/activate,
bin/activate.csh and bin/activate.fish with regular expressions anchored
at the start of the line (^VIRTUAL_ENV=, ^setenv VIRTUAL_ENV,
^set -gx VIRTUAL_ENV).

Recent versions of venv (Python >= 3.12) and virtualenv (>= 20.36)
indent the assignment in bin/activate inside a case or if block, so it
is no longer matched and the installed script still points to the build
directory, e.g.:

    VIRTUAL_ENV=/build/foo/debian/foo/opt/venvs/foo

With virtualenv 21.5.1 in unstable, sourcing the installed
/opt/venvs/foo/bin/activate prints

    Virtual environment directory /build/foo/debian/foo/opt/venvs/foo does not 
exist!

and python from the virtualenv is not put in PATH. The csh and fish
patterns also match the VIRTUAL_ENV_PROMPT lines and overwrite them with
the VIRTUAL_ENV assignment.

Steps to reproduce: build any package with
"dh $@ --with python-virtualenv", install it and source
/opt/venvs/<package>/bin/activate in bash.

Replacing the build path of the virtualenv in all the bin/activate*
scripts, instead of matching each assignment, works for every shell and
script layout.



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

Kernel: Linux 7.2.9+deb14-amd64 (SMP w/12 CPU threads; PREEMPT)
Locale: LANG=it_IT.UTF-8, LC_CTYPE=it_IT.UTF-8 (charmap=UTF-8), LANGUAGE=it
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
LSM: AppArmor: enabled

Reply via email to