Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python: alter setup.py to search local file system directory for required dependencies

My project depends on lots of packages. Some are listed on pypi, some are not.

I now have a folder named "external-packages" where I keep .tar.gz files of the packages that I need that are not on pypi.

I want to alter setup.py so that when it reads the install_requires section and finds a package that is not yet installed, first, it should look in the "external-packages" folder, and then if that fails, then it should go search on pypi.

Is this possible? How to do this?

Thanks for the help.

like image 280
W. Matthew Wilson Avatar asked Nov 14 '22 00:11

W. Matthew Wilson


1 Answers

It seems you use setuptools/distribute (indicated by install_requires option). You could use dependency_links setting in setup.py but it limits your options to distribute your package. For example, you might use one set of dependencies for development, several sets for testing, yet another set for a debian package, etc.

Both easy_install, pip install provide --find-links, --index options that you could specify at the command-line, in config files. It allows to use the right set of requirements for each specific case without editing setup.py.

You could also use requirements files to specify what versions should be installed and where to get them.

like image 57
jfs Avatar answered Dec 06 '22 23:12

jfs