Changeset 088760e for python/lib/gen_external.py
- Timestamp:
- Oct 31, 2018, 10:26:52 PM (5 years ago)
- Branches:
- feature/constantq
- Children:
- c03d191
- Parents:
- 45c2c5c (diff), 7a54b37 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/gen_external.py
r45c2c5c r088760e 78 78 cpp_cmd = os.environ.get('CC', 'cc').split() 79 79 cpp_cmd += ['-E'] 80 cpp_cmd += ['-x', 'c'] # force C language (emcc defaults to c++) 80 if 'emcc' in cpp_cmd: 81 cpp_cmd += ['-x', 'c'] # emcc defaults to c++, force C language 81 82 return cpp_cmd 82 83 … … 85 86 ''' return a dense and preprocessed string of all c declarations implied by aubio.h 86 87 ''' 88 cpp_output = get_cpp_output(header=header, usedouble=usedouble) 89 return filter_cpp_output (cpp_output) 90 91 92 def get_cpp_output(header=header, usedouble=False): 93 ''' find and run a C pre-processor on aubio.h ''' 87 94 cpp_cmd = get_preprocessor() 88 95 … … 105 112 cpp_output = proc.stdout.read() 106 113 err_output = proc.stderr.read() 114 if err_output: 115 print("Warning: preprocessor produced errors or warnings:\n%s" \ 116 % err_output.decode('utf8')) 107 117 if not cpp_output: 108 raise Exception("preprocessor output is empty:\n%s" % err_output) 109 elif err_output: 110 print("Warning: preprocessor produced warnings:\n%s" % err_output) 118 raise_msg = "preprocessor output is empty! Running command " \ 119 + "\"%s\" failed" % " ".join(cpp_cmd) 120 if err_output: 121 raise_msg += " with stderr: \"%s\"" % err_output.decode('utf8') 122 else: 123 raise_msg += " with no stdout or stderr" 124 raise Exception(raise_msg) 111 125 if not isinstance(cpp_output, list): 112 126 cpp_output = [l.strip() for l in cpp_output.decode('utf8').split('\n')] 113 127 114 cpp_output = filter(lambda y: len(y) > 1, cpp_output) 128 return cpp_output 129 130 def filter_cpp_output(cpp_raw_output): 131 ''' prepare cpp-output for parsing ''' 132 cpp_output = filter(lambda y: len(y) > 1, cpp_raw_output) 115 133 cpp_output = list(filter(lambda y: not y.startswith('#'), cpp_output)) 116 134
Note: See TracChangeset
for help on using the changeset viewer.