spotify / dh-virtualenv

Python virtualenvs in Debian packages
http://dh-virtualenv.readthedocs.io/en/latest/
GNU General Public License v2.0
1.61k stars 186 forks source link

Unable to use -extra-virtualenv-arg #175

Closed ethanaward closed 7 years ago

ethanaward commented 8 years ago

I am running into some conflicts in functionality when trying to build my package using dh-virtualenv version 0.11-1. I need to be able to both preinstall a package and pass some extra arguments to virtualenv. However, there doesn't seem to be a way to have both of these options work. If I use --with=python-virtualenv, I can preinstall packages, but trying to add virtualenv arguments results in dh_virtualenv: error: no such option: --extra-virtualenv-arg.

Similarly, if I use --buildsystem=dh_virtualenv, I can add virtualenv arguments by exporting DH_VIRTUALENV_ARGUMENTS, but there doesn't seem to be a documented way to preinstall a package with the buildsystem.

Any assistance would be appreciated here. Thanks!

nailor commented 8 years ago

Hi,

can you show the debian/control file you are using when getting the error? It would help debugging!

ethanaward commented 8 years ago

The debian/control file is here:

Source: mycroft-core
Section: misc
Priority: optional
Maintainer: Arron Atchison <arron.atchison@mycroft.ai>
Build-Depends: debhelper (>=9), python, dh-virtualenv, python-dev, python-setuptools, libffi-dev, libssl-dev, pulseaudio, portaudio19-dev, swig
Standards-Version: 3.9.7

Package: mycroft-core
Priority: optional
Architecture: any
Depends: portaudio19-dev, libglib2.0-0, flac, espeak, mpg123, mimic, python, ${python:Depends}, ${shlibs:Depends}
Description: The primary module that makes up the Mycroft Artificial Intelligence platform
 Mycroft makes use of the Adapt Intent Parser, Speech-to-Text software, and
 Text-to-Speech. The idea behind the platform is to be able to voice enable any
 device and turn it into a smart personal assistant, able to perform a variety
 of tasks

And the rules file is here:

#!/usr/bin/make -f

export DH_VERBOSE=1
#export PYBUILD_NAME=mycroft-core
export DH_VIRTUALENV_ARGUMENTS=--always-copy --clear --extra-search-dir=debian/pypi
export DH_PIP_EXTRA_ARGS="--no-index --find-links=debian/pypi"
#export DEB_BUILD_OPTIONS=nostrip
export DH_VIRTUALENV_INSTALL_ROOT=/usr/lib

%:
        dh $@ -S --buildsystem=dh_virtualenv --python=python2.7 --setuptools --no-test

override_dh_installinit:
        dh_installinit --name=mycroft-messagebus
        dh_installinit --name=mycroft-skills
        dh_installinit --name=mycroft-speech-client
        dh_installinit --name=mycroft-enclosure-client

override_dh_auto_install:
        dh_auto_install
        find debian/ -name '*.py[co]' -delete

override_dh_strip:
        dh_strip --exclude=_cffi_backend

And here's the rules file using --with python-virtualenv:

#!/usr/bin/make -f

export DH_VERBOSE=1
#export PYBUILD_NAME=mycroft-core
export DH_VIRTUALENV_ARGUMENTS=--always-copy --never-download --extra-search-dir=debian/pypi
export DH_PIP_EXTRA_ARGS="--no-index --find-links=debian/pypi"
#export DEB_BUILD_OPTIONS=nostrip
export DH_VIRTUALENV_INSTALL_ROOT=/usr/lib

%:
        dh $@ -S --with python-virtualenv --python=python2.7 --setuptools --no-test

override dh_virtualenv:
        dh_virtualenv --extra-pip-arg "--no-index" --extra-pip-arg "--find-links=debian/pypi"

override_dh_installinit:
        dh_installinit --name=mycroft-messagebus
        dh_installinit --name=mycroft-skills
        dh_installinit --name=mycroft-speech-client
        dh_installinit --name=mycroft-enclosure-client

override_dh_auto_install:
        dh_auto_install
        find debian/ -name '*.py[co]' -delete

override_dh_strip:
        dh_strip --exclude=_cffi_backend
ethanaward commented 8 years ago

Sorry, I was looking at the documentation for the apparently unreleased version. It looks like in version 0.11, there is no --extra-virtualenv-arg argument accepted, nor is DH_PIP_EXTRA_ARGS an accepted environment variable. This brings me to the same problem. When I run the first rules file above, I can add arguments to virtualenv, but not to pip. If I run the second rules file, I can pass arguments to pip using --extra-pip-arg, but there seems to be no way to pass virtualenv arguments - trying to use the --extra-virtual-env arg fails saying that there is no such option, and DH_VIRTUALENV_ARGUMENTS doesn't work when not using the buildsystem. Not using the buildsystem also seems to automatically add the --system-site-packages flag, as shown by the following error:

subprocess.CalledProcessError: Command '['virtualenv', '--system-site-packages', '--setuptools', '--verbose', '--python', 'python2.7', 'debian/mycroft-core/usr/lib/mycroft-core']' returned non-zero exit status 1

This problem seems to be fixed with the next release, if it will add the --extra-virtualenv-arg argument and DH_PIP_EXTRA_ARGS. Is there a timeline for that release, or is there a way to pass both virtualenv and pip flags now?

einarf commented 7 years ago

I suspect the 1.0 release is close considering #165 was merged recently.

nailor commented 7 years ago

Yeah, I'm hoping to push 1.0 out next week. There should not be any blockers for it anymore.

ethanaward commented 7 years ago

Is there an ETA for the 1.0 release? It wasn't released last week.

einarf commented 7 years ago

I guess as soon as #123 is squeezed in.

It's also fairly simple to just install the version currently in master. Example here.

ethanaward commented 7 years ago

Hey, it's been another week. Just wanted to check in and see where the release progress is.

nailor commented 7 years ago

Hi,

sorry, my bad here with the slack. The release is on its way! :)

nailor commented 7 years ago

Since this is fixed in master, I'll close the ticket

nailor commented 7 years ago

It's now released, whee 🎉