Reputation: 329
I'm building a set of Python extensions with distutils. The extensions depend on external libraries (unrelated to Python) which are normally built from source using Makefiles. Those external libs are unlikely to change often.
To ease the users' pain, my setup.py scripts fetch the libraries from the web using urllib.urlretrieve(), parse the Makefiles to collect the list of relevant source files, and build using config.add_library(). That works fine and all is well.
My question is: what is the best/recommended way to cache the downloaded source files so that distutils does not download them all over again when I rebuild? Is it possible to store them in, say, the build/src.macosx-10.6-x86_64-2.7 or build/temp.macosx-10.6-x86_64-2.7 folders created by distutils? If so, how does one query distutils for the name of those folders?
Thanks in advance!
Upvotes: 3
Views: 254
Reputation: 6434
It should be possible to use those folders, here's how to get those names from distutils. However, those folders are pretty volatile. I'd suggest having an empty directory on the source distribution for receiving these downloads, with a README file explaining its role as a build cache.
Upvotes: 1