python: Fix configure generating setup.py.

* lang/python/setup.py.in: Handle the case, when substitutions
may be empty.

--

Reported-by: Andreas Metzler
Fixes-commit: ae9258fbf3
GnuPG-bug-id: 6204
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
NIIBE Yutaka 2022-10-26 11:02:36 +09:00
parent 830e017e5d
commit f1802682c3
No known key found for this signature in database
GPG Key ID: 640114AF89DE6054

View File

@ -68,13 +68,17 @@ if not gpgme_h:
gpgme_h = os.path.join('@prefix@', 'include', 'gpgme.h')
define_macros = []
if '@GPGME_CONFIG_LIBS@':
libs = '@GPGME_CONFIG_LIBS@'.split(' ')
else:
libs = []
# Define extra_macros for both the SWIG and C code
for k, v in extra_macros.items():
extra_swig_opts.append('-D{0}={1}'.format(k, v))
define_macros.append((k, str(v)))
if '@GPGME_CONFIG_CFLAGS@':
for item in '@GPGME_CONFIG_CFLAGS@'.split(' '):
if item.startswith('-I'):
include_dirs.append(item[2:])
@ -165,8 +169,9 @@ class BuildExtFirstHack(build):
def _generate_errors_i(self):
ge_cflags='@GPG_ERROR_CFLAGS@'
gpg_error_content = self._read_header(
'gpg-error.h', '@GPG_ERROR_CFLAGS@'.split(' '))
'gpg-error.h', ge_cflags.split(' ') if ge_cflags else [])
filter_re = re.compile(r'GPG_ERR_[^ ]* =')
rewrite_re = re.compile(r' *(.*) = .*')