aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlloyd <[email protected]>2011-02-18 16:33:24 +0000
committerlloyd <[email protected]>2011-02-18 16:33:24 +0000
commitdebeb26a1c2615d7dd61bce535f22133eec38b17 (patch)
tree46beec41371b82d48e5671a648c24cec544a610f
parent6f55420fd2e474bbde2555eac465e89c2e38e99c (diff)
Add a new option --link-method which allows the user to override the
method by which include files are linked into the build directory. Handy for working around bugs and corner cases.
-rwxr-xr-xconfigure.py39
1 files changed, 34 insertions, 5 deletions
diff --git a/configure.py b/configure.py
index 3d7cf5e40..b27f6250a 100755
--- a/configure.py
+++ b/configure.py
@@ -225,6 +225,10 @@ def process_command_line(args):
action='store_false', default=True,
help=SUPPRESS_HELP)
+ build_group.add_option('--link-method',
+ default=None,
+ help=SUPPRESS_HELP)
+
build_group.add_option('--distribution-info', metavar='STRING',
help='set distribution specific versioning',
default='unspecified')
@@ -1213,15 +1217,34 @@ Perform the filesystem operations needed to setup the build
def setup_build(build_config, options, template_vars):
"""
+ Choose the link method based on system availablity and user request
+ """
+ def choose_link_method(req_method):
+
+ def useable_methods():
+ if 'symlink' in os.__dict__:
+ yield 'symlink'
+ if 'link' in os.__dict__:
+ yield 'hardlink'
+ yield 'copy'
+
+ for method in useable_methods():
+ if req_method is None or req_method == method:
+ return method
+
+ logging.info('Could not use requested link method %s' % (req_method))
+ return 'copy'
+
+ """
Copy or link the file, depending on what the platform offers
"""
- def portable_symlink(filename, target_dir):
+ def portable_symlink(filename, target_dir, method):
if not os.access(filename, os.R_OK):
logging.warning('Missing file %s' % (filename))
return
- if 'symlink' in os.__dict__:
+ if method == 'symlink':
def count_dirs(dir, accum = 0):
if dir in ['', '/', os.path.curdir]:
return accum
@@ -1237,13 +1260,16 @@ def setup_build(build_config, options, template_vars):
os.symlink(source, target)
- elif 'link' in os.__dict__:
+ elif method == 'hardlink':
os.link(filename,
os.path.join(target_dir, os.path.basename(filename)))
- else:
+ elif method == 'copy':
shutil.copy(filename, target_dir)
+ else:
+ raise Exception('Unknown link method %s' % (method))
+
def choose_makefile_template(style):
if style == 'nmake':
return 'nmake.in'
@@ -1304,13 +1330,16 @@ def setup_build(build_config, options, template_vars):
finally:
f.close()
+ link_method = choose_link_method(options.link_method)
+ logging.info('Using %s to link files into build directory' % (link_method))
+
def link_headers(header_list, type, dir):
logging.debug('Linking %d %s header files in %s' % (
len(header_list), type, dir))
for header_file in header_list:
try:
- portable_symlink(header_file, dir)
+ portable_symlink(header_file, dir, link_method)
except OSError, e:
if e.errno != errno.EEXIST:
logging.error('Error linking %s into %s: %s' % (