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 os
|
||||||
|
import sys
|
||||||
from distutils.core import setup, Extension
|
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"]
|
libs = ["memcached"]
|
||||||
defs = []
|
defs = []
|
||||||
incdirs = []
|
incdirs = []
|
||||||
libdirs = []
|
libdirs = []
|
||||||
|
|
||||||
if "LIBMEMCACHED_DIR" in os.environ:
|
# Hack up sys.argv, yay
|
||||||
libdir = os.path.normpath(os.environ["LIBMEMCACHED_DIR"])
|
unprocessed = []
|
||||||
incdirs.append(os.path.join(libdir, "include"))
|
for arg in sys.argv[1:]:
|
||||||
libdirs.append(os.path.join(libdir, "lib"))
|
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:
|
if use_zlib:
|
||||||
libs.append("z")
|
libs.append("z")
|
||||||
|
Reference in New Issue
Block a user