diff options
author | NIIBE Yutaka <[email protected]> | 2022-10-26 02:02:36 +0000 |
---|---|---|
committer | NIIBE Yutaka <[email protected]> | 2022-10-26 02:02:36 +0000 |
commit | f1802682c3c8794edaca37966405bd1f070f5e01 (patch) | |
tree | 0064a493a8d02b30ed7038e025d4edc213cc6c79 | |
parent | core: Protect against a theoretical integer overflow in parsetlv.c (diff) | |
download | gpgme-f1802682c3c8794edaca37966405bd1f070f5e01.tar.gz gpgme-f1802682c3c8794edaca37966405bd1f070f5e01.zip |
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: ae9258fbf3b9d434495ef11fc184a91fe7c4ca57
GnuPG-bug-id: 6204
Signed-off-by: NIIBE Yutaka <[email protected]>
-rwxr-xr-x | lang/python/setup.py.in | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 6741d3c8..6f36861d 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -68,22 +68,26 @@ if not gpgme_h: gpgme_h = os.path.join('@prefix@', 'include', 'gpgme.h') define_macros = [] -libs = '@GPGME_CONFIG_LIBS@'.split(' ') +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))) -for item in '@GPGME_CONFIG_CFLAGS@'.split(' '): - if item.startswith('-I'): - include_dirs.append(item[2:]) - elif item.startswith('-D'): - defitem = item[2:].split('=', 1) - if len(defitem) == 2: - define_macros.append((defitem[0], defitem[1])) - else: - define_macros.append((defitem[0], None)) +if '@GPGME_CONFIG_CFLAGS@': + for item in '@GPGME_CONFIG_CFLAGS@'.split(' '): + if item.startswith('-I'): + include_dirs.append(item[2:]) + elif item.startswith('-D'): + defitem = item[2:].split('=', 1) + if len(defitem) == 2: + define_macros.append((defitem[0], defitem[1])) + else: + define_macros.append((defitem[0], None)) # Adjust include and library locations in case of win32 uname_s = os.popen('uname -s').read() @@ -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' *(.*) = .*') |