Commit 5c45252a authored by Link Mauve's avatar Link Mauve

Abort if Python.h isn’t found.

Fixes #3254.
parent 4e5a1c65
......@@ -36,6 +36,30 @@ def find_doc(before, path):
_files.append((join(before, relative_root), files_path))
return _files
def check_include(library_name, header):
command = [os.environ.get('PKG_CONFIG', 'pkg-config'), '--cflags', library_name]
cflags = check_output(command).decode('utf-8').split()
except FileNotFoundError:
print('pkg-config not found.')
return False
except CalledProcessError:
# pkg-config already prints the missing libraries on stderr.
return False
command = [os.environ.get('CC', 'cc')] + cflags + ['-E', '-']
with TemporaryFile('w+') as c_file:
c_file.write('#include <%s>' % header)
return call(command, stdin=c_file, stdout=DEVNULL, stderr=DEVNULL) == 0
except FileNotFoundError:
print('%s headers not found.' % library_name)
return False
if not check_include('python3', 'Python.h'):
import sys
module_poopt = Extension('poezio.poopt',
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