Skip to content

Commit

Permalink
Change build system to use maturin instead of setuptools-rust
Browse files Browse the repository at this point in the history
  • Loading branch information
althonos committed Jan 9, 2025
1 parent 7d9ea17 commit ea94107
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 21 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ __pycache__/

# Distribution / packaging
.Python
pyproject.toml
build/
develop-eggs/
dist/
Expand Down
61 changes: 59 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,61 @@
[build-system]
requires = ['setuptools', 'setuptools_rust']
build-backend = "setuptools.build_meta"
requires = ["maturin ~=1.2"]
build-backend = "maturin"

[project]
name = "sphinxcontrib-svgbob"
dynamic = ["version"]
description = "A Sphinx extension to convert ASCII diagrams to SVGs with Svgbob."
readme = "README.md"
requires-python = ">=3.7"
license = { file = "COPYING" }
authors = [
{ name = "Martin Larralde", email = "[email protected]" },
]
keywords = ["sphinx", "documentation", "svg", "diagram", "ascii"]
classifiers = [
"Development Status :: 4 - Beta",
"Framework :: Sphinx :: Extension",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Rust",
"Topic :: Documentation :: Sphinx",
"Topic :: Software Development :: Documentation",
"Topic :: Text Processing",
"Typing :: Typed",
]

[project.urls]
"Bug Tracker" = "https://github.com/sphinx-contrib/svgbob/issues"
"Changelog" = "https://github.com/sphinx-contrib/svgbob/blob/master/CHANGELOG.md"
"PyPI" = "https://pypi.org/project/sphinxcontrib-svgbob"

[tool.maturin]
manifest-path = "sphinxcontrib/svgbob/_svgbob/Cargo.toml"
features = ["extension-module"]
module-name = "sphinxcontrib.svgbob._svgbob"

[tool.cibuildwheel]
skip = ["*-musllinux_i686"]
before-build = "pip install setuptools-rust"
test-command = "python -m unittest lightmotif.tests -v"
build-verbosity = 1
free-threaded-support = false

[tool.cibuildwheel.linux]
environment = { PATH="$HOME/.cargo/bin:$PATH" }
before-all = "curl -sSf https://sh.rustup.rs | sh -s -- -y"

[tool.cibuildwheel.macos]
before-all = [
"curl -sSf https://sh.rustup.rs | sh -s -- -y",
"rustup target add aarch64-apple-darwin"
]
19 changes: 1 addition & 18 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,6 @@ def run(self):
)



class sdist(_sdist):
"""A `sdist` that generates a `pyproject.toml` on the fly.
"""

def run(self):
# build `pyproject.toml` from `setup.cfg`
c = configparser.ConfigParser()
c.add_section("build-system")
c.set("build-system", "requires", str(self.distribution.setup_requires))
c.set("build-system", 'build-backend', '"setuptools.build_meta"')
with open("pyproject.toml", "w") as pyproject:
c.write(pyproject)
# run the rest of the packaging
_sdist.run(self)


class build_rust(_build_rust):

def run(self):
Expand Down Expand Up @@ -132,7 +115,7 @@ def setup_temp_rustc_unix(self, toolchain, profile):


setuptools.setup(
cmdclass=dict(build_rust=build_rust, sdist=sdist, vendor=vendor),
cmdclass=dict(build_rust=build_rust, vendor=vendor),
rust_extensions=[
setuptools_rust.RustExtension(
"sphinxcontrib.svgbob._svgbob",
Expand Down

0 comments on commit ea94107

Please sign in to comment.