|
| 1 | +from pathlib import Path |
1 | 2 | from setuptools import setup
|
2 | 3 | from setuptools_rust import Binding, RustExtension
|
| 4 | +from subprocess import Popen, PIPE |
| 5 | + |
| 6 | +PKG_ROOT = Path(__file__).parent |
| 7 | +SETUP_REQUIRES = ["setuptools-rust", "wheel", "setuptools"] |
| 8 | +SHORT_DESCRIPTION = "JsonLogic implemented with a Rust backend" |
| 9 | +URL = "https://www.github.com/bestowinc/json-logic-rs" |
| 10 | +AUTHOR = "Matthew Planchard" |
| 11 | + |
| 12 | + |
| 13 | + |
| 14 | +def get_version(): |
| 15 | + proc = Popen(("cargo", "pkgid"), stdout=PIPE, stderr=PIPE) |
| 16 | + out, _err = tuple(map(bytes.decode, proc.communicate())) |
| 17 | + if proc.returncode != 0: |
| 18 | + raise RuntimeError("Could not get Cargo package info") |
| 19 | + version = out.split(":")[-1] |
| 20 | + return version.strip() |
| 21 | + |
| 22 | + |
| 23 | +with open(PKG_ROOT / "README.md") as readme_f: |
| 24 | + LONG_DESCRIPTION = readme_f.read() |
| 25 | + |
| 26 | +VERSION = get_version() |
3 | 27 |
|
4 |
| -setup_requires = ["setuptools-rust", "wheel", "setuptools"] |
5 | 28 |
|
6 | 29 | setup(
|
7 | 30 | name="jsonlogic-rs",
|
8 |
| - version="1.0", |
| 31 | + author=AUTHOR, |
| 32 | + version=VERSION, |
| 33 | + author_email=EMAIL, |
| 34 | + maintainer_email=EMAIL, |
| 35 | + url=URL, |
| 36 | + description=SHORT_DESCRIPTION, |
| 37 | + long_description=LONG_DESCRIPTION, |
| 38 | + long_description_content_type="text/markdown", |
| 39 | + keywords=["json", "jsonlogic", "s-expressions", "rust"], |
| 40 | + classifiers=[ |
| 41 | + # See https://pypi.python.org/pypi?%3Aaction=list_classifiers for all |
| 42 | + # available setup classifiers |
| 43 | + # "Development Status :: 1 - Planning", |
| 44 | + # 'Development Status :: 2 - Pre-Alpha', |
| 45 | + "Development Status :: 3 - Alpha", |
| 46 | + # "Development Status :: 4 - Beta", |
| 47 | + # 'Development Status :: 5 - Production/Stable', |
| 48 | + # 'Development Status :: 6 - Mature', |
| 49 | + # 'Framework :: AsyncIO', |
| 50 | + # 'Framework :: Flask', |
| 51 | + # 'Framework :: Sphinx', |
| 52 | + # 'Environment :: Web Environment', |
| 53 | + "Intended Audience :: Developers", |
| 54 | + # 'Intended Audience :: End Users/Desktop', |
| 55 | + # 'Intended Audience :: Science/Research', |
| 56 | + # 'Intended Audience :: System Administrators', |
| 57 | + # 'License :: Other/Proprietary License', |
| 58 | + # 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)', |
| 59 | + "License :: OSI Approved :: MIT License", |
| 60 | + # "License :: OSI Approved :: Apache Software License", |
| 61 | + "Natural Language :: English", |
| 62 | + "Operating System :: POSIX :: Linux", |
| 63 | + "Operating System :: MacOS :: MacOS X", |
| 64 | + "Operating System :: Microsoft :: Windows", |
| 65 | + "Programming Language :: Python", |
| 66 | + "Programming Language :: Python :: 3 :: Only", |
| 67 | + "Programming Language :: Python :: 3.6", |
| 68 | + "Programming Language :: Python :: 3.7", |
| 69 | + "Programming Language :: Python :: 3.8", |
| 70 | + "Programming Language :: Rust", |
| 71 | + # 'Programming Language :: Python :: Implementation :: PyPy', |
| 72 | + ], |
9 | 73 | rust_extensions=[
|
10 | 74 | RustExtension(
|
11 | 75 | # Python package name before the dot, name of C extension to
|
|
19 | 83 | packages=["jsonlogic_rs"],
|
20 | 84 | package_dir={"": "py"},
|
21 | 85 | include_package_data=True,
|
22 |
| - setup_requires=setup_requires, |
| 86 | + setup_requires=SETUP_REQUIRES, |
23 | 87 | # rust extensions are not zip safe, just like C-extensions.
|
24 | 88 | zip_safe=False,
|
25 | 89 | )
|
0 commit comments