spotify / dh-virtualenv

Python virtualenvs in Debian packages

Home Page:http://dh-virtualenv.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

When calling /opt/venv/bin/myscript PATH is not properly defined

ikus060 opened this issue · comments

Using dh-virtualenv to install a packages, command line entrypoint are properly created into the virtual env as /opt/venv/bin/myscript. For a user, it's possible to call then directly. But when doing so, the executable get started without the appropriate modification of PATH and PYTHONHOME. This can cause a problem for some project that expect to call executable. Someone would expect the executable to be loaded from the same virtualenv. But since PATH is not properly define to use the virtualenv, either the executable is not found or the wrong version is loaded from the operating system.

Expected behaviour.
In addition to shebang update, I would expect dh-virtualenv to update the script to define the PATH.

I would recommand replacing the shebang by something similar to

env PATH=/opt/venv/bin:$PATH python