Pregunta

I have several test folders set up to use tox. They all have pysqlite as a requirement, either for the package itself, or for the tests to run. I've been running these packages using tox, and recently, I've noticed tox fails when it tries to install pysqlite.

The issue comes from the pysqlite setup.cfg. By default it has the following lines:

[build_ext]
#define=
#include_dirs=/usr/local/include
#library_dirs=/usr/local/lib
libraries=sqlite3
define=SQLITE_OMIT_LOAD_EXTENSION

To install it properly, I go into this file and uncomment the three lines commented out. AFAIK this can't be automated via pip/tox.

I am aware of the sitepackages variable in the tox.ini, however enabling it causes some issues w/ incorrect versions being used in other packages.

Is there a way to install pysqlite to tox virtualenvs? If so, how?

¿Fue útil?

Solución

Found a solution for this.

Set up the tox.ini as follows:

[testenv]
setenv=LIBRARY_PATH=/usr/local/lib
       CPATH=/usr/local/include
deps=pysqlite

This will set the library_path and CPATH before tox sets up the virtualenv dependencies using pip. Everything runs smoothly afterwards.

Note: This requires tox 0.9 or better

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top