From 77ff58537777daef1c47f753b8e9389a70936dc5 Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Fri, 10 Oct 2008 13:57:10 +0200 Subject: [PATCH] Added --include to support building against cross-compiled python --- setup.py | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 2c1dde7..411eddf 100755 --- a/setup.py +++ b/setup.py @@ -12,13 +12,15 @@ if sys.version_info[:2] < (2,2): # Defaults lflags_arg = [] libname = ['rsync'] -incdir_list = libdir_list = None +libdir_list = None +incdir_list = [] extra_options = {} if os.name == 'posix' or os.name == 'nt': LIBRSYNC_DIR = os.environ.get('LIBRSYNC_DIR', '') LFLAGS = os.environ.get('LFLAGS', []) LIBS = os.environ.get('LIBS', []) + INCLUDE = os.environ.get('INCLUDE', []) # Handle --librsync-dir=[PATH] and --lflags=[FLAGS] args = sys.argv[:] @@ -32,13 +34,20 @@ if os.name == 'posix' or os.name == 'nt': elif arg.startswith('--libs='): LIBS = arg.split('=')[1].split() sys.argv.remove(arg) + elif arg.startswith('--include='): + INCLUDE=arg.split('=')[1].split() + sys.argv.remove(arg) + if LFLAGS or LIBS: lflags_arg = LFLAGS + LIBS if LIBRSYNC_DIR: - incdir_list = [os.path.join(LIBRSYNC_DIR, 'include')] + incdir_list.append(os.path.join(LIBRSYNC_DIR, 'include')) libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')] + if INCLUDE: + incdir_list.append(INCLUDE) + INCLUDE = None if '-lrsync' in LIBS: libname = [] @@ -65,7 +74,8 @@ setup(name="rdiff-backup", author_email="address@hidden", url="http://rdiff-backup.nongnu.org/", packages = ['rdiff_backup'], - ext_modules = [Extension("rdiff_backup.C", ["cmodule.c"]), + ext_modules = [Extension("rdiff_backup.C", ["cmodule.c"], + include_dirs=incdir_list), Extension("rdiff_backup._librsync", ["_librsyncmodule.c"], include_dirs=incdir_list, -- 1.5.6.3