Skip to content

Commit

Permalink
NFI Why packaging is not working...
Browse files Browse the repository at this point in the history
  • Loading branch information
smashedr committed Jul 2, 2024
1 parent 162505b commit 37e8209
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:
run: |
python -m pip install -U pip
python -m pip install -Ur requirements.txt
python -m build
python -m build --no-isolation
ls -lAh
- name: "Upload to Actions"
uses: actions/upload-artifact@v4
Expand Down
3 changes: 3 additions & 0 deletions project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools", "wheel", "packaging"]
build-backend = "setuptools.build_meta"
25 changes: 18 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
import os
import re
from setuptools import setup
from packaging.version import parse, InvalidVersion
# from packaging.version import parse, InvalidVersion


def get_version() -> str:
try:
ref = os.environ.get('GITHUB_REF_NAME', '0.0.1')
version = parse(ref)
return version.public
except InvalidVersion:
# def get_version() -> str:
# try:
# ref = os.environ.get('GITHUB_REF_NAME', '0.0.1')
# version = parse(ref)
# return version.public
# except InvalidVersion:
# return '0.0.1'


def get_version():
version = os.environ.get('GITHUB_REF_NAME', '0.0.1')
pattern = r'^(\d+)\.(\d+)\.(\d+)(?:-(\w+|\d+)\.(\w+|\d+))?$'
match = re.match(pattern, version)
if match:
return version
else:
return '0.0.1'


Expand Down

0 comments on commit 37e8209

Please sign in to comment.