[virt-tools-list] [virt-bootstrap] [PATCH v4 07/26] tox: Enable sitepackages

Cedric Bosdonnat cbosdonnat at suse.com
Thu Aug 3 13:43:03 UTC 2017


On Thu, 2017-08-03 at 14:13 +0100, Radostin Stoyanov wrote:
> Set sitepackages[1] to True to allow virtual environments to also have
> access to globally installed packages.
> 
> [1] http://tox.readthedocs.io/en/latest/config.html#confval-sitepackages=True|False
> ---
>  tox.ini | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/tox.ini b/tox.ini
> index e3f35cc..2447889 100644
> --- a/tox.ini
> +++ b/tox.ini
> @@ -20,4 +20,6 @@
>  envlist = py27,py3
>  
>  [testenv]
> +# Virtual environments will also have access to globally installed packages.
> +sitepackages=True 
>  commands={envpython} {toxinidir}/setup.py test

I got tox working with the guestfs dependency with this patch:

------- %< -------
diff --git a/requirements.txt b/requirements.txt
new file mode 100644
index 0000000..ae7132f
--- /dev/null
+++ b/requirements.txt
@@ -0,0 +1,8 @@
+--index-url https://pypi.python.org/simple/
+
+passlib>=1.6.1
+guestfs
+
+--find-links 'http://download.libguestfs.org/python#egg=guestfs'
+--trusted-host 'download.libguestfs.org'
+-e .
diff --git a/setup.py b/setup.py
index b12e92c..0d047c3 100755
--- a/setup.py
+++ b/setup.py
@@ -113,16 +113,6 @@ setuptools.setup(
         'pylint': CheckPylint
     },
 
-    # virt-bootstrap uses passlib to compute the hash of
-    # root password for root file system.
-    install_requires=[
-        'passlib>=1.6.1',
-        'guestfs'
-    ],
-    dependency_links=[
-        'http://download.libguestfs.org/python#guestfs'
-    ],
-
     tests_require=['mock>=2.0'],
 
     extras_require={
diff --git a/tox.ini b/tox.ini
index e3f35cc..67a7f2d 100644
--- a/tox.ini
+++ b/tox.ini
@@ -21,3 +21,4 @@ envlist = py27,py3
 
 [testenv]
 commands={envpython} {toxinidir}/setup.py test
+deps=-rrequirements.txt^M
------- %< -------

The good thing is that tox works and 'python setup.py install' too as long as the
dependencies are already installed.

A user should install 'virt-bootstrap with pip install -rrequirements.txt -e .'
Obviously if the python libguestfs binding are installed using the distro package
they would be used (as long as the distro ships the egg-info).

--
Cedric




More information about the virt-tools-list mailing list