File: setup.py

package info (click to toggle)
python-pytokens 0.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 184 kB
  • sloc: python: 1,159; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 554 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
from __future__ import annotations

import os
import platform

from setuptools import setup


if "PYTOKENS_USE_MYPYC" in os.environ:
    USE_MYPYC = os.environ["PYTOKENS_USE_MYPYC"] == "1"
else:
    USE_MYPYC = platform.python_implementation() == "CPython"


def get_ext_modules():
    if not USE_MYPYC:
        return []

    from mypyc.build import mypycify
    return mypycify(
        [
            "src/pytokens/__init__.py",
            "src/pytokens/_mypyc_dummy.py",
        ],
        opt_level="3",
    )


setup(ext_modules=get_ext_modules())