File: setup_inner.py

package info (click to toggle)
python-threadpoolctl 3.1.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 324 kB
  • sloc: python: 1,230; sh: 134; makefile: 2
file content (40 lines) | stat: -rw-r--r-- 1,122 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import os
from distutils.core import setup
from Cython.Build import cythonize
from distutils.extension import Extension

from build_utils import set_cc_variables
from build_utils import get_openmp_flag


original_environ = os.environ.copy()
try:
    # Make it possible to compile the 2 OpenMP enabled Cython extensions
    # with different compilers and therefore different OpenMP runtimes.
    inner_loop_cc_var = set_cc_variables("CC_INNER_LOOP")
    openmp_flag = get_openmp_flag()

    ext_modules = [
        Extension(
            "openmp_helpers_inner",
            ["openmp_helpers_inner.pyx"],
            extra_compile_args=openmp_flag,
            extra_link_args=openmp_flag,
        )
    ]

    setup(
        name="_openmp_test_helper_inner",
        ext_modules=cythonize(
            ext_modules,
            compiler_directives={
                "language_level": 3,
                "boundscheck": False,
                "wraparound": False,
            },
            compile_time_env={"CC_INNER_LOOP": inner_loop_cc_var or "unknown"},
        ),
    )

finally:
    os.environ.update(original_environ)