Skip to content

Commit

Permalink
Go back to setuptools instead of hatchling
Browse files Browse the repository at this point in the history
  • Loading branch information
cboulay committed Dec 12, 2024
1 parent 1ec12ca commit d64afe8
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 29 deletions.
20 changes: 5 additions & 15 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,11 @@ jobs:
architecture: ${{ matrix.config.pyarch }}
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Build Package
- name: Build Package (Linux)
if: matrix.config.os != 'windows-latest'
run: uv build
- name: (Windows x64) Retarget wheel
if: matrix.config.name == 'windows-x64'
run: |
rm dist/*.tar.gz
uv run python -m ensurepip
uv run python -m pip install wheel
for f in dist/pylsl*.whl; do uv run wheel tags --platform-tag win_amd64 "$f" && rm "$f"; done
- name: (Windows 32) Retarget wheel
if: matrix.config.name == 'windows-x86'
run: |
rm dist/*.tar.gz
uv run python -m ensurepip
uv run python -m pip install wheel
for f in dist/pylsl*.whl; do uv run wheel tags --platform-tag win32 "$f" && rm "$f"; done
- name: Build Package (Windows)
if: matrix.config.os == 'windows-latest'
run: uv build --wheel
- name: Publish package distributions to PyPI
run: uv publish
20 changes: 6 additions & 14 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,19 +55,11 @@ dev = [
]

[build-system]
requires = ["hatchling", "hatch-vcs"]
build-backend = "hatchling.build"
requires = ["setuptools>=64", "setuptools-scm>=8"]
build-backend = "setuptools.build_meta"

[tool.hatch.version]
source = "vcs"
[tool.setuptools_scm]
version_file = "src/pylsl/__version__.py"

[tool.hatch.build.hooks.vcs]
version-file = "src/pylsl/__version__.py"

[tool.hatch.build.targets.wheel]
packages = ["src/pylsl"]
artifacts = ["*.dll"]

#package_data={
# "pylsl": ["lib/*.dll"],
# }
[tool.setuptools.package-data]
pylsl = ["lib/*.dll"]
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import sys

from setuptools import setup
# from setuptools.dist import Distribution


# class BinaryDistribution(Distribution):
# """Distribution which always forces a binary package with platform name"""
# def has_ext_modules(foo):
# return sys.platform.startswith("win")

try:
from wheel.bdist_wheel import bdist_wheel as _bdist_wheel
class bdist_wheel(_bdist_wheel):
def finalize_options(self):
super().finalize_options()
self.root_is_pure = not sys.platform.startswith("win")
def get_tag(self):
python, abi, plat = _bdist_wheel.get_tag(self)
# We don't contain any python source
python, abi = 'py2.py3', 'none'
return python, abi, plat
except ImportError:
bdist_wheel = None


setup(
# distclass=BinaryDistribution,
cmdclass={"bdist_wheel": bdist_wheel},
)

0 comments on commit d64afe8

Please sign in to comment.