File: setup.py

package info (click to toggle)
logbook 1.7.0-1.0
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,140 kB
  • sloc: python: 6,558; makefile: 141
file content (36 lines) | stat: -rw-r--r-- 840 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
import os
import platform

from setuptools import Extension, setup

IS_CPYTHON = platform.python_implementation() == "CPython"
DISABLE_EXTENSION = bool(os.environ.get("DISABLE_LOGBOOK_CEXT"))


def status_msgs(*msgs):
    print("*" * 75)
    for msg in msgs:
        print(msg)
    print("*" * 75)


if not IS_CPYTHON:
    status_msgs(
        "WARNING: C extensions are not supported on this Python platform, "
        "speedups are not enabled.",
    )
    ext_modules = []
elif DISABLE_EXTENSION:
    status_msgs(
        "DISABLE_LOGBOOK_CEXT is set; not attempting to build C extensions.",
    )
    ext_modules = []
else:
    from Cython.Build import cythonize

    ext_modules = cythonize(
        [Extension("logbook._speedups", sources=["src/cython/speedups.pyx"])],
        language_level=3,
    )

setup(ext_modules=ext_modules)