Commit 46d20ef1 authored by bescoto's avatar bescoto

Added Albert Chin-A-Young's setup.py code to check options/environment variables


git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup@297 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
parent dc909f36
...@@ -9,6 +9,38 @@ if sys.version_info[:2] < (2,2): ...@@ -9,6 +9,38 @@ if sys.version_info[:2] < (2,2):
print "Sorry, rdiff-backup requires version 2.2 or later of python" print "Sorry, rdiff-backup requires version 2.2 or later of python"
sys.exit(1) sys.exit(1)
# Defaults
lflags_arg = []
libname = ['rsync']
incdir_list = libdir_list = None
if os.name == 'posix':
LIBRSYNC_DIR = os.environ.get('LIBRSYNC_DIR', '')
LFLAGS = os.environ.get('LFLAGS', [])
LIBS = os.environ.get('LIBS', [])
# Handle --librsync-dir=[PATH] and --lflags=[FLAGS]
args = sys.argv[:]
for arg in args:
if arg.startswith('--librsync-dir='):
LIBRSYNC_DIR = arg.split('=')[1]
sys.argv.remove(arg)
elif arg.startswith('--lflags='):
LFLAGS = arg.split('=')[1].split()
sys.argv.remove(arg)
elif arg.startswith('--libs='):
LIBS = 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')]
libdir_list = [os.path.join(LIBRSYNC_DIR, 'lib')]
if '-lrsync' in LIBS:
libname = []
setup(name="rdiff-backup", setup(name="rdiff-backup",
version=version_string, version=version_string,
description="Local/remote mirroring+incremental backup", description="Local/remote mirroring+incremental backup",
...@@ -19,11 +51,12 @@ setup(name="rdiff-backup", ...@@ -19,11 +51,12 @@ setup(name="rdiff-backup",
ext_modules = [Extension("rdiff_backup.C", ["cmodule.c"]), ext_modules = [Extension("rdiff_backup.C", ["cmodule.c"]),
Extension("rdiff_backup._librsync", Extension("rdiff_backup._librsync",
["_librsyncmodule.c"], ["_librsyncmodule.c"],
libraries=["rsync"])], include_dirs=incdir_list,
library_dirs=libdir_list,
libraries=libname,
extra_link_args=lflags_arg)],
scripts = ['rdiff-backup'], scripts = ['rdiff-backup'],
data_files = [('share/man/man1', ['rdiff-backup.1']), data_files = [('share/man/man1', ['rdiff-backup.1']),
('share/doc/rdiff-backup-%s' % version_string, ('share/doc/rdiff-backup-%s' % (version_string,),
['CHANGELOG', 'COPYING', 'README', 'FAQ.html'])]) ['CHANGELOG', 'COPYING', 'README', 'FAQ.html'])])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment