-
-
Notifications
You must be signed in to change notification settings - Fork 433
Expand file tree
/
Copy pathsetup.py
More file actions
executable file
·60 lines (49 loc) · 1.67 KB
/
Copy pathsetup.py
File metadata and controls
executable file
·60 lines (49 loc) · 1.67 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
50
51
52
53
54
55
56
57
58
59
60
#!/usr/bin/python3
# Setup file for dulwich
# Copyright (C) 2008-2022 Jelmer Vernooij <jelmer@jelmer.uk>
# SPDX-License-Identifier: Apache-2.0 OR GPL-2.0-or-later
import os
import sys
from setuptools import setup
tests_require = ["fastimport"]
if "__pypy__" not in sys.modules and sys.platform != "win32":
tests_require.extend(["gevent", "geventhttpclient", "setuptools>=17.1"])
optional = os.environ.get("CIBUILDWHEEL", "0") != "1"
# Ideally, setuptools would just provide a way to do this
if "PURE" in os.environ or "--pure" in sys.argv:
if "--pure" in sys.argv:
sys.argv.remove("--pure")
setup_requires = []
rust_extensions = [] # type: list["RustExtension"]
else:
setup_requires = ["setuptools_rust"]
# We check for egg_info since that indicates we are running prepare_metadata_for_build_*
if "egg_info" in sys.argv:
rust_extensions = []
else:
from setuptools_rust import Binding, RustExtension
rust_extensions = [
RustExtension(
"dulwich._objects",
"crates/objects/Cargo.toml",
binding=Binding.PyO3,
optional=optional,
),
RustExtension(
"dulwich._pack",
"crates/pack/Cargo.toml",
binding=Binding.PyO3,
optional=optional,
),
RustExtension(
"dulwich._diff_tree",
"crates/diff-tree/Cargo.toml",
binding=Binding.PyO3,
optional=optional,
),
]
setup(
package_data={"": ["py.typed"]},
rust_extensions=rust_extensions,
setup_requires=setup_requires,
)