|
2 | 2 | import sys |
3 | 3 | from distutils.core import setup, Extension |
4 | 4 | import scorep.helper |
| 5 | +from scorep.instrumenter import has_c_instrumenter |
5 | 6 |
|
6 | 7 | if scorep.helper.get_scorep_version() < 5.0: |
7 | 8 | raise RuntimeError( |
|
25 | 26 | src_folder = os.path.abspath('src') |
26 | 27 | include += [src_folder] |
27 | 28 | sources = ['src/methods.cpp', 'src/scorep_bindings.cpp', 'src/scorepy/events.cpp'] |
28 | | -if sys.version_info.major >= 3: |
| 29 | +define_macros = [('PY_SSIZE_T_CLEAN', '1')] |
| 30 | +# We are using the UTF-8 string features from Python 3 |
| 31 | +# The C Instrumenter functions are not available on PyPy |
| 32 | +if has_c_instrumenter(): |
29 | 33 | sources.extend([ |
30 | 34 | 'src/classes.cpp', |
31 | 35 | 'src/scorepy/cInstrumenter.cpp', |
32 | 36 | 'src/scorepy/pythonHelpers.cpp', |
33 | 37 | 'src/scorepy/pathUtils.cpp', |
34 | 38 | ]) |
| 39 | + define_macros.append(('SCOREPY_ENABLE_CINSTRUMENTER', '1')) |
| 40 | +else: |
| 41 | + define_macros.append(('SCOREPY_ENABLE_CINSTRUMENTER', '0')) |
35 | 42 |
|
36 | 43 | cmodules.append(Extension('scorep._bindings', |
37 | 44 | include_dirs=include, |
38 | | - define_macros=[('PY_SSIZE_T_CLEAN', '1')], |
| 45 | + define_macros=define_macros, |
39 | 46 | extra_compile_args=["-std=c++11"], |
40 | 47 | sources=sources)) |
41 | 48 |
|
|
70 | 77 | 'Programming Language :: Python :: 3.8', |
71 | 78 | 'Programming Language :: Python :: 3.9', |
72 | 79 | 'Programming Language :: Python :: Implementation :: CPython', |
| 80 | + 'Programming Language :: Python :: Implementation :: PyPy', |
73 | 81 | 'Operating System :: POSIX', |
74 | 82 | 'Operating System :: Unix', |
75 | 83 | ], |
|
0 commit comments