2018-04-03 13:33:05 +00:00
|
|
|
import sys
|
2019-04-23 11:18:42 +00:00
|
|
|
import platform
|
2018-04-03 13:33:05 +00:00
|
|
|
|
|
|
|
from setuptools import setup
|
|
|
|
from setuptools.command.test import test as TestCommand
|
2018-08-08 13:31:41 +00:00
|
|
|
from setuptools_rust import RustExtension
|
2018-04-03 13:33:05 +00:00
|
|
|
|
|
|
|
|
|
|
|
class PyTest(TestCommand):
|
|
|
|
user_options = []
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
self.run_command("test_rust")
|
|
|
|
|
|
|
|
import subprocess
|
2018-11-11 11:25:53 +00:00
|
|
|
|
|
|
|
errno = subprocess.call(["pytest", "tests"])
|
2018-04-03 13:33:05 +00:00
|
|
|
raise SystemExit(errno)
|
|
|
|
|
|
|
|
|
2018-08-08 13:31:41 +00:00
|
|
|
def get_py_version_cfgs():
|
|
|
|
# For now each Cfg Py_3_X flag is interpreted as "at least 3.X"
|
|
|
|
version = sys.version_info[0:2]
|
|
|
|
py3_min = 5
|
|
|
|
out_cfg = []
|
2018-11-11 11:24:24 +00:00
|
|
|
for minor in range(py3_min, version[1] + 1):
|
2018-11-11 11:25:53 +00:00
|
|
|
out_cfg.append("--cfg=Py_3_%d" % minor)
|
2018-08-08 13:31:41 +00:00
|
|
|
|
2019-04-23 11:18:42 +00:00
|
|
|
if platform.python_implementation() == "PyPy":
|
|
|
|
out_cfg.append("--cfg=PyPy")
|
|
|
|
|
2018-08-08 13:31:41 +00:00
|
|
|
return out_cfg
|
|
|
|
|
2018-11-11 11:24:24 +00:00
|
|
|
|
2018-04-03 13:33:05 +00:00
|
|
|
install_requires = []
|
2018-11-11 11:25:53 +00:00
|
|
|
tests_require = install_requires + ["pytest", "pytest-benchmark"]
|
2018-04-03 13:33:05 +00:00
|
|
|
|
|
|
|
setup(
|
2018-11-11 11:25:53 +00:00
|
|
|
name="rustapi-module",
|
|
|
|
version="0.1.0",
|
2018-04-03 13:33:05 +00:00
|
|
|
classifiers=[
|
2018-11-11 11:25:53 +00:00
|
|
|
"License :: OSI Approved :: MIT License",
|
|
|
|
"Development Status :: 3 - Alpha",
|
|
|
|
"Intended Audience :: Developers",
|
|
|
|
"Programming Language :: Python",
|
|
|
|
"Programming Language :: Rust",
|
|
|
|
"Operating System :: POSIX",
|
|
|
|
"Operating System :: MacOS :: MacOS X",
|
|
|
|
],
|
|
|
|
packages=["rustapi_module"],
|
|
|
|
rust_extensions=[
|
|
|
|
RustExtension(
|
|
|
|
"rustapi_module.othermod", "Cargo.toml", rustc_flags=get_py_version_cfgs()
|
|
|
|
),
|
|
|
|
RustExtension(
|
|
|
|
"rustapi_module.datetime", "Cargo.toml", rustc_flags=get_py_version_cfgs()
|
|
|
|
),
|
|
|
|
RustExtension(
|
|
|
|
"rustapi_module.subclassing",
|
|
|
|
"Cargo.toml",
|
|
|
|
rustc_flags=get_py_version_cfgs(),
|
|
|
|
),
|
2018-11-12 15:24:59 +00:00
|
|
|
RustExtension(
|
2018-11-12 15:53:06 +00:00
|
|
|
"rustapi_module.test_dict",
|
2018-11-12 15:24:59 +00:00
|
|
|
"Cargo.toml",
|
|
|
|
rustc_flags=get_py_version_cfgs(),
|
|
|
|
),
|
2018-04-03 13:33:05 +00:00
|
|
|
],
|
|
|
|
install_requires=install_requires,
|
|
|
|
tests_require=tests_require,
|
|
|
|
include_package_data=True,
|
|
|
|
zip_safe=False,
|
2018-11-11 11:25:53 +00:00
|
|
|
cmdclass=dict(test=PyTest),
|
2018-04-03 13:33:05 +00:00
|
|
|
)
|