diff options
author | Justus Winter <[email protected]> | 2016-09-16 10:32:24 +0000 |
---|---|---|
committer | Justus Winter <[email protected]> | 2016-09-16 13:56:47 +0000 |
commit | 6af7bee076bacbc0cdfe7de342bce43ca5671b3b (patch) | |
tree | eb6f1d9c0a6344c5b631fe23d674b8a2abc197c1 /lang/python/setup.py.in | |
parent | python: Adapt to 'gpgme_op_interact'. (diff) | |
download | gpgme-6af7bee076bacbc0cdfe7de342bce43ca5671b3b.tar.gz gpgme-6af7bee076bacbc0cdfe7de342bce43ca5671b3b.zip |
python: Release the GIL during calls into GPGME.
* lang/python/helpers.c (pyme_raise_callback_exception): Re-acquire
the Global Interpreter Lock.
(pyPassphraseCb, pyme_set_passphrase_cb, pyProgressCb,
pyme_set_progress_cb, pyStatusCb, pyme_set_status_cb,
_pyme_interact_cb, pyDataReadCb, pyDataWriteCb, pyDataSeekCb,
pyDataReleaseCb, pyme_data_new_from_cbs, _pyme_assuan_data_cb,
_pyme_assuan_inquire_cb, _pyme_assuan_status_cb): Likewise.
* lang/python/setup.py.in: Make 'gpgme-config' emit the correct
cflags, and SWIG generate code to release the GIL before calling us.
Co-authored-by: Kai Michaelis <[email protected]>
Signed-off-by: Justus Winter <[email protected]>
Diffstat (limited to 'lang/python/setup.py.in')
-rwxr-xr-x | lang/python/setup.py.in | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lang/python/setup.py.in b/lang/python/setup.py.in index 933e7806..d513c49d 100755 --- a/lang/python/setup.py.in +++ b/lang/python/setup.py.in @@ -24,8 +24,9 @@ import glob import subprocess # Out-of-tree build of the pyme3 bindings. -gpg_error_config = "gpg-error-config" -gpgme_config = "gpgme-config" +gpg_error_config = ["gpg-error-config"] +gpgme_config_flags = ["--thread=pthread"] +gpgme_config = ["gpgme-config"] + gpgme_config_flags gpgme_h = "" library_dirs = [] in_tree = False @@ -35,7 +36,7 @@ extra_macros = dict() if os.path.exists("../../src/gpgme-config"): # In-tree build. in_tree = True - gpgme_config = "../../src/gpgme-config" + gpgme_config = ["../../src/gpgme-config"] + gpgme_config_flags gpgme_h = "../../src/gpgme.h" library_dirs = ["../../src/.libs"] # XXX uses libtool internals extra_macros.update( @@ -49,21 +50,21 @@ else: devnull = open(os.devnull, "w") try: - subprocess.check_call([gpg_error_config, '--version'], + subprocess.check_call(gpg_error_config + ['--version'], stdout=devnull) except: sys.exit("Could not find gpg-error-config. " + "Please install the libgpg-error development package.") try: - subprocess.check_call([gpgme_config, '--version'], + subprocess.check_call(gpgme_config + ['--version'], stdout=devnull) except: sys.exit("Could not find gpgme-config. " + "Please install the libgpgme development package.") def getconfig(what, config=gpgme_config): - confdata = subprocess.Popen([config, "--%s" % what], + confdata = subprocess.Popen(config + ["--%s" % what], stdout=subprocess.PIPE).communicate()[0] return [x for x in confdata.decode('utf-8').split() if x != ''] @@ -151,7 +152,7 @@ class BuildExtFirstHack(build): build.run(self) swige = Extension("pyme._gpgme", ["gpgme.i", "helpers.c"], - swig_opts = ['-py3', '-builtin', + swig_opts = ['-py3', '-builtin', '-threads', '-outdir', 'pyme'] + extra_swig_opts, include_dirs = include_dirs, define_macros = define_macros, |