diff options
author | Ben McGinnes <[email protected]> | 2018-09-17 22:32:30 +0000 |
---|---|---|
committer | Ben McGinnes <[email protected]> | 2018-09-17 22:32:30 +0000 |
commit | 362caaf02f3a25b7e626572aa30b87771c2c8f4d (patch) | |
tree | c510bee6320c6d2696f85e60c47419c5be6f5099 /lang/python/examples/howto/advanced/cython | |
parent | docs: python bindings howto (diff) | |
download | gpgme-362caaf02f3a25b7e626572aa30b87771c2c8f4d.tar.gz gpgme-362caaf02f3a25b7e626572aa30b87771c2c8f4d.zip |
docs: python bindings
* Updated the Cython example code slightly, along with the
corresponding explanation.
Diffstat (limited to 'lang/python/examples/howto/advanced/cython')
-rwxr-xr-x | lang/python/examples/howto/advanced/cython/keycount.pyx | 16 | ||||
-rw-r--r-- | lang/python/examples/howto/advanced/cython/setup.py | 2 |
2 files changed, 14 insertions, 4 deletions
diff --git a/lang/python/examples/howto/advanced/cython/keycount.pyx b/lang/python/examples/howto/advanced/cython/keycount.pyx index f0097db2..2aa636d5 100755 --- a/lang/python/examples/howto/advanced/cython/keycount.pyx +++ b/lang/python/examples/howto/advanced/cython/keycount.pyx @@ -1,3 +1,6 @@ +from __future__ import absolute_import + +import cython import gpg c = gpg.Context() @@ -10,7 +13,14 @@ secnum = len(seclist) publist = list(pubkeys) pubnum = len(publist) +if cython.compiled is True: + cc = "Powered by Cython compiled C code." +else: + cc = "Powered by Python." + print(""" -Number of secret keys: {0} -Number of public keys: {1} -""".format(secnum, pubnum)) + Number of secret keys: {0} + Number of public keys: {1} + + {2} +""".format(secnum, pubnum, cc)) diff --git a/lang/python/examples/howto/advanced/cython/setup.py b/lang/python/examples/howto/advanced/cython/setup.py index 0d0be01e..f8dce034 100644 --- a/lang/python/examples/howto/advanced/cython/setup.py +++ b/lang/python/examples/howto/advanced/cython/setup.py @@ -2,5 +2,5 @@ from distutils.core import setup from Cython.Build import cythonize setup( - ext_modules = cythonize("keycount.pyx") + ext_modules = cythonize("keycount.pyx", annotate=True) ) |