-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup.py
97 lines (72 loc) · 3.17 KB
/
setup.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# import os
# import sys
# from setuptools import setup
# from setuptools_rust import Binding, RustExtension
# from setuptools.command.test import test as TestCommand
# from setuptools.command.sdist import sdist as SdistCommand
# from typing import List
# class PyTest(TestCommand):
# user_options: List[str] = []
# def run(self):
# self.run_command("test_rust")
# import subprocess
# errno = subprocess.call(["pytest", "tests"])
# raise SystemExit(errno)
# class CargoModifiedSdist(SdistCommand):
# """Modifies Cargo.toml to use an absolute rather than a relative path
# The current implementation of PEP 517 in pip always does builds in an
# isolated temporary directory. This causes problems with the build, because
# Cargo.toml necessarily refers to the current version of pyo3 by a relative
# path.
# Since these sdists are never meant to be used for anything other than
# tox / pip installs, at sdist build time, we will modify the Cargo.toml
# in the sdist archive to include an *absolute* path to pyo3.
# """
# def make_release_tree(self, base_dir, files):
# """Stages the files to be included in archives"""
# super().make_release_tree(base_dir, files)
# import toml
# # Cargo.toml is now staged and ready to be modified
# cargo_loc = os.path.join(base_dir, "Cargo.toml")
# assert os.path.exists(cargo_loc)
# with open(cargo_loc, "r") as f:
# cargo_toml = toml.load(f)
# rel_pyo3_path = cargo_toml["dependencies"]["pyo3"]["path"]
# base_path = os.path.dirname(__file__)
# abs_pyo3_path = os.path.abspath(os.path.join(base_path, rel_pyo3_path))
# cargo_toml["dependencies"]["pyo3"]["path"] = abs_pyo3_path
# with open(cargo_loc, "w") as f:
# toml.dump(cargo_toml, f)
# try:
# from setuptools_rust import RustExtension
# except ImportError:
# import subprocess
# errno = subprocess.call([sys.executable, "-m", "pip", "install", "setuptools-rust"])
# if errno:
# print("Please install setuptools-rust package")
# raise SystemExit(errno)
# else:
# from setuptools_rust import RustExtension
# setup_requires = ["setuptools-rust>=0.10.1", "wheel"]
# install_requires: List[str] = []
# tests_require = install_requires + ["pytest", "pytest-benchmark"]
# setup(name='datapan',
# author="Brendan Knapp",
# author_email="brendan.knapp@nps.edu",
# url='http://github.com/knapply/datapan/',
# description="datapan filters big files.",
# long_description=open("README.md").read(),
# version="0.1.0",
# rust_extensions=[RustExtension('datapan', 'Cargo.toml', binding=Binding.PyO3)],
# test_suite="tests",
# license="GPL-3.0",
# classifiers=[
# "Development Status :: 3 - Alpha",
# "Topic :: Software Development :: Libraries",
# "Topic :: Utilities"],
# install_requires=install_requires,
# tests_require=tests_require,
# setup_requires=setup_requires,
# include_package_data=True,
# zip_safe=False,
# cmdclass={"test": PyTest, "sdist": CargoModifiedSdist})