Skip to content
This repository has been archived by the owner on Jan 9, 2024. It is now read-only.

Local identifiers for python in non tagged builds #54

Merged
merged 12 commits into from
Jan 26, 2022
12 changes: 11 additions & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}


- name: Install Dependencies
run: |-
sudo apt-get update
Expand Down Expand Up @@ -97,6 +96,12 @@ jobs:
run: |-
ccache -s # Print current cache stats
ccache -z # Zero cache entry

- name: Inject local version identifier for non tag builds
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |-
echo "PYTHON_LOCAL_VERSION_IDENTIFIER=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: setup.py
run: |-
python3 -m pip install wheel
Expand Down Expand Up @@ -185,6 +190,11 @@ jobs:
run: |-
echo "MACOSX_DEPLOYMENT_TARGET=10.15" >> $GITHUB_ENV

- name: Inject local version identifier for non tag builds
if: ${{ !startsWith(github.ref, 'refs/tags/v') }}
run: |-
echo "PYTHON_LOCAL_VERSION_IDENTIFIER=$(git rev-parse --short HEAD)" >> $GITHUB_ENV

- name: setup.py
run: |-
python3 -m pip install --upgrade packaging wheel
Expand Down
3 changes: 3 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,9 @@ def build_extension(self, ext):
version = None
with open(os.path.join(here, "lemonade.version")) as f:
version = f.read().strip()
suffix = os.environ.get("PYTHON_LOCAL_VERSION_IDENTIFIER", None)
if suffix is not None:
version = "{}+{}".format(version, suffix)


class UploadCommand(Command):
Expand Down