0

I would like to use distutils (setup.py) to be able to install a python package (from a local repository), which requires another package from a different local repository. Since I am lacking decent documentation of the setup command (I only found some examples here and here, confused by setup-terms extras_require, install_require and dependency_links found here and here), does anyone have a complete setup.py file that shows how this can be handled, i.e. that distutils handles the installation of a package found in some SVN repository, when the main package I am installing right now requires that?

More detailed explanation: I have two local svn (or git) repositories basicmodule and extendedmodule. Now I checkout extendedmodule and run python setup.py install. This setup.py files knows that extendedmodule requires basicmodule, and automatically downloads it from the repository and installs it (in case it is not installed yet). How can I solve this with setup.py? Or maybe there is another, better way to do this?


EDIT: Followup question

Based on the answer by Tom I have tried to use a setup.py as follows:

from setuptools import setup
setup(
    name = "extralibs",
    version = "0.0.2",
    description = ("Some extra libs."),
    packages=['extralib'],
    install_requires = "basiclib==1.9dev-r1234",
    dependency_links = ["https://source.company.xy/svn/MainDir/SVNDir/basiclib/trunk@20479#egg=basiclib-1.9dev-r1234"]

)

When trying to install this as a normal user I get the following error:

error: Can't download https://source.company.xy/svn/MainDir/SVNDir/basiclib/trunk@20479: 401 Authorization Required

But when I do a normal svn checkout with the exact same link it works:

svn co https://source.company.xy/svn/MainDir/SVNDir/basiclib/trunk@20479

Any suggestion how to solve this without changing ANY configuration of the svn repository?

Community
  • 1
  • 1
Alex
  • 41,580
  • 88
  • 260
  • 469

2 Answers2

0

Check out the answers to these two questions. They both give specific examples on how install_requires and dependency_links work together to achieve what you want.

Community
  • 1
  • 1
Tom Offermann
  • 1,391
  • 12
  • 12
0

I think the problem is that your svn client is authentified (caching realm somewhere in ~/.subversion directory) what your distutils http client don't know how to do.

Distutils supports svn+http link type in dependency links. So you may try adding "svn+" before your dependency link providing username and password:

dependency_links = ["svn+https://user:password@source.company.xy/svn/MainDir/SVNDir/basiclib/trunk@20479#egg=basiclib-1.9dev-r1234"]

For security reasons you should not put your username and password in your setup.py file. One way to do that it fetching authentication information from an environment variable or event try to fetch it from your subversion configuration directory (~/.subversion)

Hope that help

fvisconte
  • 186
  • 1
  • 5