This is a very small shim for
dh-virtualenv
to allow it to use
pipenv
when installing
dependencies.
We know when dh-virtualenv
is trying to installing dependencies because
they'll call the pip-tool
with -r <requirements_file>
. When we see that
pattern, we remove -r <requirements_file>
from the cmd args as well as other
parameters that are incompatible with pipenv
.
Parameters we are currently filtering out include
--log
- passed by default fromdh-virtualenv
--index-url
- someone might want to specify this for their pre-install packages, your Pipfile.lock should specify any specific indexes when installing viapipenv
--extra-index-url
(required for installingdh-pipenv
when running locally)
To get it to work on a package that uses dh-virtualenv
add these lines to
your debian/rules
file.
override_dh_virtualenv:
dh_virtualenv \
--preinstall pipenv==9.0.1 \
--preinstall dh-pipenv==0.1.1 \
--pip-tool dh-pipenv
It simply ensures that dh-pipenv
and pipenv
are installed, and then asks
dh-virtualenv
to install with dh-pipenv
instead of default pip
.
dh-pipenv needs to be accessible via pypi
, to avoid spamming pypi with broken
builds I used pypi-server
to run a
local pypi server. Then my development workflow looked like this
- Edit
dh-pipenv
- Run
python setup.py sdist upload -r localpypi
- Attempt to run
dh-virtualenv
in a repo that had it enabled
Setup of pypi server was done by following the docs here. Then I ran it with:
pypi-server -p 8080 --overwrite -P .htpasswd packages
-p 8080
specifies the port--overwrite
allows packages of the same version to overwrite themselves (very handy for development)-P .htpasswd
referenced a password file that was generated for this pypi so that I could upload packages to it