-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsetup.py
More file actions
49 lines (43 loc) · 1.33 KB
/
setup.py
File metadata and controls
49 lines (43 loc) · 1.33 KB
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
41
42
43
44
45
46
47
48
49
import sys
import tomllib
from typing import Final
with open("pyproject.toml", "rb") as f:
pyproject_content = tomllib.load(f)
BUILD_REQUIREMENTS: Final = (
pyproject_content["build-system"]["requires"]
+ pyproject_content["dependency-groups"]["translate"]
+ pyproject_content["dependency-groups"]["man"]
)
LINT_REQUIREMENTS: Final = pyproject_content["dependency-groups"]["lint"]
TEST_REQUIREMENTS: Final = pyproject_content["dependency-groups"]["test"]
INSTALL_REQUIREMENTS: Final = pyproject_content["project"]["dependencies"]
if "--build-requirements" in sys.argv:
print(" ".join(BUILD_REQUIREMENTS))
sys.exit(0)
if "--lint-requirements" in sys.argv:
print(" ".join(LINT_REQUIREMENTS))
sys.exit(0)
if "--test-requirements" in sys.argv:
print(" ".join(TEST_REQUIREMENTS))
sys.exit(0)
if "--install-requirements" in sys.argv:
print(" ".join(INSTALL_REQUIREMENTS))
sys.exit(0)
try:
from Cython.Build import cythonize
from setuptools import Extension, setup
except ModuleNotFoundError:
print(
"For the correct build install required build dependencies: "
f"'{' '.join(BUILD_REQUIREMENTS)}'."
)
sys.exit(1)
setup(
platforms=["linux"],
ext_modules=cythonize(
[
Extension("*", ["src/codeplag/**/*.py"]),
],
language_level=3,
),
)