Skip to content

Commit

Permalink
Merge pull request #1350 from sonos/fix-py-sdist
Browse files Browse the repository at this point in the history
Fix py sdist
  • Loading branch information
kali authored Mar 11, 2024
2 parents 881c544 + 10c7ddd commit 43b3a66
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 2 additions & 0 deletions api/py/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ __pycache__
*.onnx
build
mobilenet_v2_1.0.onnx.nnef.tgz
rust-workspace
dist

2 changes: 2 additions & 0 deletions api/py/MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
graft rust-workspace
graft docs
6 changes: 3 additions & 3 deletions api/py/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
numpy==1.25.2
setuptools==68.1.2
setuptools_rust==1.6.0
numpy==1.26.4
setuptools==69.1.1
setuptools_rust==1.9.0
toml==0.10.2
13 changes: 11 additions & 2 deletions api/py/setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
from setuptools import setup
from setuptools_rust import Binding, RustExtension
import shutil
import toml
import re
import os

version = toml.load("../Cargo.toml")["package"]["version"]
if not os.path.exists("rust-workspace"):
shutil.copytree(
"../..",
"rust-workspace",
ignore = shutil.ignore_patterns(".cached", "target", ".git", "issue-*", ".travis", "assets", ".github", "py")
)

version = toml.load("rust-workspace/api/Cargo.toml")["package"]["version"]
version = re.sub("\-alpha\.", "a", version)
version = re.sub("\-.*", ".dev", version)

Expand Down Expand Up @@ -38,7 +47,7 @@
"License :: OSI Approved :: Apache Software License",
"License :: OSI Approved :: MIT License"
],
rust_extensions=[RustExtension("tract.tract", binding=Binding.NoBinding, path="../ffi/Cargo.toml")],
rust_extensions=[RustExtension("tract.tract", binding=Binding.NoBinding, path="rust-workspace/api/ffi/Cargo.toml")],
packages=["tract"],
zip_safe=False,
python_requires=">=3.7",
Expand Down

0 comments on commit 43b3a66

Please sign in to comment.