12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879 |
- import os
- import sys
- from setuptools import setup
- if sys.platform == "darwin" and os.path.exists("/usr/bin/xcodebuild"):
-
-
- import subprocess
- p = subprocess.Popen(
- ["/usr/bin/xcodebuild", "-version"],
- stdout=subprocess.PIPE,
- stderr=subprocess.PIPE,
- env={},
- )
- out, err = p.communicate()
- for line in out.splitlines():
- line = line.decode("utf8")
-
- if line.startswith("Xcode") and int(line.split()[1].split(".")[0]) >= 4:
- os.environ["ARCHFLAGS"] = ""
- 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"
- if "PURE" in os.environ or "--pure" in sys.argv:
- if "--pure" in sys.argv:
- sys.argv.remove("--pure")
- setup_requires = []
- rust_extensions = []
- else:
- setup_requires = ["setuptools_rust"]
-
- 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,
- tests_require=tests_require,
- )
|