pyo3/examples/word-count/setup.py

56 lines
1.5 KiB
Python
Raw Normal View History

2017-07-23 05:32:18 +00:00
import sys
from setuptools import setup
from setuptools.command.test import test as TestCommand
try:
from setuptools_rust import RustExtension
except ImportError:
import subprocess
2018-07-30 20:52:22 +00:00
errno = subprocess.call([sys.executable, "-m", "pip", "install", "setuptools-rust"])
2017-07-23 05:32:18 +00:00
if errno:
print("Please install setuptools-rust package")
raise SystemExit(errno)
else:
from setuptools_rust import RustExtension
class PyTest(TestCommand):
user_options = []
def run(self):
self.run_command("test_rust")
import subprocess
import sys
2018-07-30 20:52:22 +00:00
2018-08-04 17:55:15 +00:00
subprocess.check_call([sys.executable, "-m", "pytest", "tests"])
2017-07-23 05:32:18 +00:00
2018-07-30 20:52:22 +00:00
setup_requires = ["setuptools-rust>=0.10.1", "wheel"]
2017-07-23 05:32:18 +00:00
install_requires = []
2018-07-30 20:52:22 +00:00
tests_require = install_requires + ["pytest", "pytest-benchmark"]
2017-07-23 05:32:18 +00:00
setup(
2018-07-30 20:52:22 +00:00
name="word-count",
version="0.1.0",
2017-07-23 05:32:18 +00:00
classifiers=[
2018-07-30 20:52:22 +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",
2017-07-23 05:32:18 +00:00
],
2018-07-30 20:52:22 +00:00
packages=["word_count"],
rust_extensions=[RustExtension("word_count.word_count", "Cargo.toml")],
2017-07-23 05:32:18 +00:00
install_requires=install_requires,
tests_require=tests_require,
setup_requires=setup_requires,
include_package_data=True,
zip_safe=False,
2018-07-30 20:52:22 +00:00
cmdclass=dict(test=PyTest),
2017-07-23 05:32:18 +00:00
)