diff options
author | lloyd <[email protected]> | 2012-04-05 01:18:10 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2012-04-05 01:18:10 +0000 |
commit | f4ae793a4af5d0c9883a2a1555a539c925982239 (patch) | |
tree | e694abb6a5140cebdf2f16a3b493805744aee8cd /configure.py | |
parent | fedd69e75ffe23c6249d49e4d23cc1b4ae2823aa (diff) | |
parent | cdde9a171e3fcb164e7946c198ba4d8f9ef486fb (diff) |
propagate from branch 'net.randombit.botan' (head 91305e3daaae9ea8a1786daf058d961991c68251)
to branch 'net.randombit.botan.tls-state-machine' (head 474a00b316f5b21a4e56033d4d990d87d9d3eed6)
Diffstat (limited to 'configure.py')
-rwxr-xr-x | configure.py | 54 |
1 files changed, 35 insertions, 19 deletions
diff --git a/configure.py b/configure.py index 3c7457113..affa56333 100755 --- a/configure.py +++ b/configure.py @@ -45,20 +45,27 @@ def get_vc_revision(): try: mtn = subprocess.Popen(['mtn', 'automate', 'heads'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE) + stderr=subprocess.PIPE, + universal_newlines=True) (stdout, stderr) = mtn.communicate() - if(stderr != ''): - logging.debug('Error getting rev from monotone - %s' % (stderr)) + if mtn.returncode != 0: + logging.debug('Error getting rev from monotone - %d (%s)' + % (mtn.returncode, stderr)) return 'unknown' - logging.debug('Monotone reported revision ' + stdout.strip()) + rev = str(stdout).strip() + logging.debug('Monotone reported revision %s' % (rev)) - return 'mtn:' + stdout.strip() + return 'mtn:' + rev except OSError as e: logging.debug('Error getting rev from monotone - %s' % (e[1])) return 'unknown' + except Exception as e: + logging.debug('Error getting rev from monotone - %s' % (e)) + return 'unknown' + class BuildConfigurationInformation(object): @@ -531,6 +538,7 @@ def force_to_dict(l): Represents the information about a particular module """ class ModuleInfo(object): + def __init__(self, infofile): lex_me_harder(infofile, self, @@ -544,21 +552,22 @@ class ModuleInfo(object): 'need_isa': None, 'mp_bits': 0 }) - if self.source == [] and \ - self.header_internal == [] and \ - self.header_public == []: - - for (dirpath, dirnames, filenames) in os.walk(self.lives_in): - if dirpath == self.lives_in: + def extract_files_matching(basedir, suffixes): + for (dirpath, dirnames, filenames) in os.walk(basedir): + if dirpath == basedir: for filename in filenames: if filename.startswith('.'): continue - if filename.endswith('.cpp') or \ - filename.endswith('.S'): - self.source.append(filename) - elif filename.endswith('.h'): - self.header_public.append(filename) + for suffix in suffixes: + if filename.endswith(suffix): + yield filename + + if self.source == []: + self.source = list(extract_files_matching(self.lives_in, ['.cpp', '.S'])) + + if self.header_internal == [] and self.header_public == []: + self.header_public = list(extract_files_matching(self.lives_in, ['.h'])) # Coerce to more useful types def convert_lib_list(l): @@ -1761,12 +1770,19 @@ def main(argv = None): def get_gcc_version(gcc_bin): try: - subproc_result = subprocess.Popen( + gcc_proc = subprocess.Popen( gcc_bin.split(' ') + ['-dumpversion'], stdout=subprocess.PIPE, - stderr=subprocess.PIPE).communicate() + stderr=subprocess.PIPE, + universal_newlines=True) + + (stdout, stderr) = gcc_proc.communicate() + + if gcc_proc.returncode != 0: + logging.warning("GCC returned non-zero result %s" % (stderr)) + return None - gcc_version = ''.join(map(str, subproc_result)).strip() + gcc_version = stdout.strip() logging.info('Detected gcc version %s' % (gcc_version)) return gcc_version |