Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I convince setuptools to use a temporary directory for requires packages from setup_require or tests_require?

Inside the setup.py I have something like this:

setup_requires=['nose>=1.0'],
tests_require=[],

The problem is that when I run ./setup.py test it will download and unpack these modules in the directory with setup.py.

How can I convince it to use a temporary directory for this, I do not want to polute the source control system with these, and I do not want to start adding lots and lots of exlude patters.

like image 740
sorin Avatar asked Nov 14 '22 05:11

sorin


1 Answers

If the problem is the source tree of your project you should probably make a script to delete all "dist" and "build" directories created by distutils at the end of the setup test. Downloaded packages are usually *.egg folders in your source tree.

You are not polluting your distribution.

From setuptools documentation :

setup_requires will NOT be automatically installed on the system where the setup script is being run. They are simply downloaded to the setup directory if they’re not locally available already. If you want them to be installed, as well as being available when the setup script is run, you should add them to install_requires and setup_requires.)

and

tests_require If your project’s tests need one or more additional packages besides those needed to install it, you can use this option to specify them. It should be a string or list of strings specifying what other distributions need to be present for the package’s tests to run. When you run the test command, setuptools will attempt to obtain these (even going so far as to download them using EasyInstall). Note that these required projects will not be installed on the system where the tests are run, but only downloaded to the project’s setup directory if they’re not already installed locally.

http://packages.python.org/distribute/setuptools.html

If you have installed some package and you need to remove it, just find your package in the subfolder "site-packages" of your python distribution and delete it. Finally remove the package reference in the easy-install.pth file which is usually located in the same "site-packages" dir.

like image 53
J_Zar Avatar answered Dec 18 '22 11:12

J_Zar