-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
943ac77
commit a581dac
Showing
4 changed files
with
48 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# WARNING: This setup.py script is only for customizing the local version scheme with setuptools-scm. | ||
# All other project configuration must be provided in pyproject.toml. Use this script cautiously and | ||
# refer to the documentation for more details: https://setuptools-scm.readthedocs.io/en/latest/customizing/. | ||
|
||
from os import environ | ||
from setuptools import setup | ||
from setuptools_scm import ScmVersion | ||
|
||
|
||
def get_local_schema(version: ScmVersion) -> str: | ||
""" | ||
Generate a custom local version scheme for setuptools-scm. | ||
Generates a local version string based on environment variables. If RELEASE is unset, | ||
appends .dev<run_id> for development builds; otherwise, returns an empty string. The | ||
value of <run_id> is retrieved from the GITHUB_RUN_ID environment variable if it exists, | ||
otherwise the default value used is 0. | ||
Args: | ||
version: The ScmVersion object passed by setuptools-scm. | ||
Returns: | ||
The custom local version string. | ||
""" | ||
run_id = environ.get("GITHUB_RUN_ID", "0") | ||
release = environ.get("RELEASE", "") | ||
if not release: | ||
return f".dev{run_id}" | ||
return "" | ||
|
||
|
||
setup( | ||
use_scm_version={ | ||
"version_scheme": "post-release", | ||
"local_scheme": get_local_schema, | ||
"version_file": "src/armonik_cli/_version.py", | ||
} | ||
) |