Setuptools is overkill for me since my program's usage is quite limited, so here's my homegrown alternative.
I bundle a "third-party" directory that includes all prerequisites, and use site.addsitedir so they don't need to be installed globally.
# program startup code
import os
import sys
import site
path = os.path.abspath(os.path.dirname(__file__))
ver = 'python%d.%d' % sys.version_info[:2]
thirdparty = os.path.join(path, 'third-party', 'lib', ver, 'site-packages')
site.addsitedir(thirdparty)
Most of my prereqs have setup.py installers. Each bundled module gets its own "install" process, so any customized stuff (e.g. ./configure) can be run automatically. My install script runs this makefile as part of the install process.
# sample third-party/Makefile
PYTHON_VER = `python -c "import sys; \
print 'python%d.%d' % sys.version_info[:2]"`
PYTHON_PATH = lib/$(PYTHON_VER)/site-packages
MODS = egenix-mx-base-3.0.0 # etc
.PHONY: all init clean realclean $(MODS)
all: $(MODS)
$(MODS): init
init:
mkdir -p bin
mkdir -p $(PYTHON_PATH)
clean:
rm -rf $(MODS)
realclean: clean
rm -rf bin
rm -rf lib
egenix-mx-base-3.0.0:
tar xzf [email protected]
cd $@ && python setup.py install --prefix=..
rm -rf $@