aboutsummaryrefslogtreecommitdiffstats
path: root/lang/python/examples/howto/advanced
diff options
context:
space:
mode:
Diffstat (limited to 'lang/python/examples/howto/advanced')
-rwxr-xr-xlang/python/examples/howto/advanced/cython/keycount.pyx16
-rw-r--r--lang/python/examples/howto/advanced/cython/setup.py2
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)
)