Specify deps via setup.py arguments.
This commit is contained in:
parent
c5590258fb
commit
1e4930aafe
32
setup.py
32
setup.py
@ -1,17 +1,39 @@
|
||||
import os
|
||||
import sys
|
||||
from distutils.core import setup, Extension
|
||||
|
||||
use_zlib = True # TODO Configurable somehow?
|
||||
# --with-zlib: use zlib for compressing and decompressing
|
||||
# --without-zlib: ^ negated
|
||||
# --with-zlib=<dir>: path to zlib if needed
|
||||
# --with-libmemcached=<dir>: path to libmemcached package if needed
|
||||
|
||||
use_zlib = True
|
||||
pkgdirs = [] # incdirs and libdirs get these
|
||||
libs = ["memcached"]
|
||||
defs = []
|
||||
incdirs = []
|
||||
libdirs = []
|
||||
|
||||
if "LIBMEMCACHED_DIR" in os.environ:
|
||||
libdir = os.path.normpath(os.environ["LIBMEMCACHED_DIR"])
|
||||
incdirs.append(os.path.join(libdir, "include"))
|
||||
libdirs.append(os.path.join(libdir, "lib"))
|
||||
# Hack up sys.argv, yay
|
||||
unprocessed = []
|
||||
for arg in sys.argv[1:]:
|
||||
if arg == "--with-zlib":
|
||||
use_zlib = True
|
||||
continue
|
||||
elif arg == "--without-zlib":
|
||||
use_zlib = False
|
||||
continue
|
||||
elif "=" in arg:
|
||||
if arg.startswith("--with-libmemcached=") or \
|
||||
arg.startswith("--with-zlib="):
|
||||
pkgdirs.append(arg.split("=", 1)[1])
|
||||
continue
|
||||
unprocessed.append(arg)
|
||||
sys.argv[1:] = unprocessed
|
||||
|
||||
for pkgdir in pkgdirs:
|
||||
incdirs.append(os.path.join(pkgdir, "include"))
|
||||
libdirs.append(os.path.join(pkgdir, "lib"))
|
||||
|
||||
if use_zlib:
|
||||
libs.append("z")
|
||||
|
Reference in New Issue
Block a user