Skip to content

Commit

Permalink
ci/cd: fix version number for pypi
Browse files Browse the repository at this point in the history
Signed-off-by: Mimoja <[email protected]>
  • Loading branch information
Mimoja committed Jul 7, 2024
1 parent 18d90af commit b566a2d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/pypi_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
cibw_arch: ["x86_64", "aarch64"]
cibw_arch: ["x86_64"]
env:
CIBW_BEFORE_ALL_LINUX: "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- --default-toolchain stable -y"
CIBW_BUILD_VERBOSITY: "1"
CIBW_ENVIRONMENT: 'PATH="$PATH:$HOME/.cargo/bin"'

steps:
- uses: actions/checkout@v4
with:
fetch-tags: 'true'
fetch-depth: '0'

- name: "Install setuptools"
shell: bash
run: python3 -m pip install --upgrade setuptools>=61.2 setuptools_scm>=6.2

- name: Set up QEMU
if: matrix.os == 'ubuntu-latest' && matrix.cibw_arch == 'aarch64'
Expand Down Expand Up @@ -60,7 +67,7 @@ jobs:

- name: Build sdist
run: |
python -m pip install setuptools-rust setuptools wheel
python -m pip install setuptools-rust setuptools setuptools_scm wheel
cd python/
python setup.py sdist
Expand All @@ -76,7 +83,7 @@ jobs:
- uses: actions/download-artifact@v3
with:
name: dist
path: python/dist/
path: python/dist

- uses: pypa/[email protected]
with:
Expand Down
11 changes: 10 additions & 1 deletion python/lib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,16 @@
import sqlite3
from importlib.resources import files, as_file
from setuptools_scm import get_version

real_version = get_version(root="..")
pretend_version = get_version(root="..", local_scheme="no-local-version")
if pretend_version != real_version:
__version__ = pretend_version
else:
__version__ = real_version


def load(conn: sqlite3.Connection) -> None:
lib = next(x for x in files(__name__).iterdir() if x.name.startswith('lib'))
lib = next(x for x in files(__name__).iterdir() if x.name.startswith("lib"))
with as_file(lib) as ext:
conn.load_extension(str(ext))
3 changes: 3 additions & 0 deletions python/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ name = "sqlite-zstd-build"
requires-python = ">=3.9"
dynamic = ["version"]

[tool.setuptools.dynamic]
version = {attr = "sqlite_zstd.__version__"}

[project.readme]
file = "README.md"
content-type = "text/markdown"
Expand Down

0 comments on commit b566a2d

Please sign in to comment.