Reputation: 41
I would like to put the IP2Location Python library on a local Pypi / Cheeseshop server that I have running, so that I can use buildout to automatically include it in a project.
First, I tested out the library by installing it the way that is explained in IP2Location's (terse) documentation: 1) Download the IP2Location C library and compile it 2) Run python setup.py build && python setup.py install
in the IP2Location Python library.
I got that working, so then I tried to upload the Python library to my local pypi server by running:
python setup.py register -r local sdist upload -r local
It uploaded a package to my local pypi server, but the package only contained the Python part of the library, not the C part. I'd like the C library to also be included and then automatically compiled when a tool like buildout downloads it from my local pypi server.
I'm pretty new to pypi. Is what I'm trying to do even possible? If so, how?
Thanks, Scott
Upvotes: 4
Views: 792
Reputation: 13105
Unfortunately no, at least not the way setup.py is structured in the python library. You might have some luck getting repeatability by trying the following though (note that I have not tried this, IP2Location is a proprietary library):
Build the C library in your buildout by means of zc.recipe.cmmi. A section similar to the following should do the job.
[iplocationc]
recipe = zc.recipe.cmmi
url = http://www.ip2location.com/downloads/ip2location-c-4.0.2.tar.gz
Then, install the python counterpart as an egg using zc.recipe.egg:
[iplocation]
recipe = zc.recipe.egg:custom
eggs = iplocation
include-dirs = ${buildout:directory}/parts/iplocationc/includes_dir_goes_here
rpath = ${buildout:directory}/parts/iplocationc/libs_dir_location_goes_here
You might have to modify the recipe parameters a bit and probably fiddle with the setup.py but hopefully this should do it.
Upvotes: 2