Skip to content
This repository was archived by the owner on Aug 4, 2023. It is now read-only.

Commit 79b7a56

Browse files
Renamed all occurences of to
1 parent a6ae372 commit 79b7a56

File tree

8 files changed

+54
-20
lines changed

8 files changed

+54
-20
lines changed

.gitlab-ci.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
if PredefinedVariables.CI_COMMIT_TAG:
2222
pipeline.add_children(
23-
python.evaluate_git_tag_pep404_conformity(),
23+
python.evaluate_git_tag_pep440_conformity(),
2424
python.twine_upload(),
2525
)
2626

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Changed
1515

16-
* **BREAKING:** The signature of `gcip.addons.python.jobs.twine_upload() has changed. The parameters `twine_repository_url`,
16+
* **BREAKING:** The signature of `gcip.addons.python.jobs.twine_upload()` has changed. The parameters `twine_repository_url`,
1717
`twine_username_env_var` and `twine_username_env_var` substitute the parameters `repository_url`, `user` and `varname_password`.
1818
Check the API documentation for the new parameters.
19+
* **BREAKING:** Renamed all occurences of `pep404` to `pep440` as PEP 440 is the right specification number.
1920

2021
## [Template]
2122

gcip/addons/python/jobs.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,17 +89,17 @@ def pytest() -> Job:
8989
)
9090

9191

92-
def evaluate_git_tag_pep404_conformity() -> Job:
92+
def evaluate_git_tag_pep440_conformity() -> Job:
9393
"""
9494
Checks if the current pipelines `$CI_COMMIT_TAG` validates to a valid Python package version according to
9595
https://www.python.org/dev/peps/pep-0440
9696
9797
This job already contains a rule to only run when a `$CI_COMMIT_TAG` is present (`rules.only_tags()`).
9898
"""
9999
job = Job(
100-
name="evaluate_git_tag_pep404_conformity",
100+
name="evaluate_git_tag_pep440_conformity",
101101
namespace="test",
102-
script="python3 -m gcip.tools.evaluate_git_tag_pep404_conformity",
102+
script="python3 -m gcip.tools.evaluate_git_tag_pep440_conformity",
103103
)
104104
job.append_rules(rules.on_tags())
105105
job.set_image("thomass/gcip:0.3.0")

gcip/addons/python/sequences.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def full_stack(
4444
python.isort(),
4545
python.flake8(),
4646
python.pytest(),
47-
python.evaluate_git_tag_pep404_conformity(),
47+
python.evaluate_git_tag_pep440_conformity(),
4848
python.bdist_wheel(),
4949
)
5050

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import os
2+
import re
3+
import sys
4+
5+
__author__ = "Thomas Steinbach"
6+
__copyright__ = "Copyright 2020 DB Systel GmbH"
7+
__credits__ = ["Thomas Steinbach"]
8+
# SPDX-License-Identifier: Apache-2.0
9+
__license__ = 'Apache-2.0'
10+
__maintainer__ = 'Thomas Steinbach'
11+
__email__ = 'thomas.t.steinbach@deutschebahn.com'
12+
13+
14+
# https://www.python.org/dev/peps/pep-0440/#appendix-b-parsing-version-strings-with-regular-expressions
15+
def is_canonical(version: str) -> bool:
16+
return re.match(
17+
r'^([1-9][0-9]*!)?(0|[1-9][0-9]*)(\.(0|[1-9][0-9]*))*((a|b|rc)(0|[1-9][0-9]*))?(\.post(0|[1-9][0-9]*))?(\.dev(0|[1-9][0-9]*))?$',
18+
version
19+
) is not None
20+
21+
22+
if __name__ == "__main__":
23+
ci_commit_tag = os.getenv('CI_COMMIT_TAG')
24+
25+
if ci_commit_tag is None:
26+
raise ValueError("Environment variable CI_COMMIT_TAG must be set.")
27+
28+
if is_canonical(ci_commit_tag):
29+
sys.exit()
30+
31+
print(f"'{ci_commit_tag}' is not a valid Python package version.")
32+
print('See https://www.python.org/dev/peps/pep-0440')
33+
sys.exit(1)

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import setuptools
44

55
from gcip.tools import (
6-
evaluate_git_tag_pep404_conformity as pep404,
6+
evaluate_git_tag_pep440_conformity as pep440,
77
)
88

99
__author__ = "Thomas Steinbach"
@@ -17,7 +17,7 @@
1717

1818
def get_version() -> str:
1919
ci_commit_tag = os.getenv("CI_COMMIT_TAG")
20-
if ci_commit_tag is not None and pep404.is_canonical(ci_commit_tag):
20+
if ci_commit_tag is not None and pep440.is_canonical(ci_commit_tag):
2121
return ci_commit_tag
2222

2323
version_from_pipeline = os.getenv('GCIP_VERSION')

tests/unit/comparison_files/test_python_full_stack_test.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ test-pytest:
1818
script:
1919
- pip3 install --upgrade -v -r requirements.txt
2020
- pytest
21-
test-evaluate-git-tag-pep404-conformity:
21+
test-evaluate-git-tag-pep440-conformity:
2222
image:
2323
name: thomass/gcip:0.3.0
2424
stage: test
2525
script:
26-
- python3 -m gcip.tools.evaluate_git_tag_pep404_conformity
26+
- python3 -m gcip.tools.evaluate_git_tag_pep440_conformity
2727
rules:
2828
- if: $CI_COMMIT_TAG
2929
when: on_success
@@ -60,9 +60,9 @@ deploy-twine-upload-dev:
6060
- pip3 install --upgrade twine
6161
- python3 -m twine upload --non-interactive --disable-progress-bar dist/*
6262
variables:
63+
TWINE_USERNAME: $$ARTIFACTORY_DEV_USER
64+
TWINE_PASSWORD: $$ARTIFACTORY_DEV_PASSWORD
6365
TWINE_REPOSITORY_URL: https://my.artifactory.net/pypi/dev-repository
64-
TWINE_USERNAME: $ARTIFACTORY_DEV_USER
65-
TWINE_PASSWORD: $ARTIFACTORY_DEV_PASSWORD
6666
rules:
6767
- if: $CI_COMMIT_TAG
6868
when: never
@@ -75,9 +75,9 @@ deploy-twine-upload-stable:
7575
- pip3 install --upgrade twine
7676
- python3 -m twine upload --non-interactive --disable-progress-bar dist/*
7777
variables:
78+
TWINE_USERNAME: $$ARTIFACTORY_PROD_USER
79+
TWINE_PASSWORD: $$ARTIFACTORY_PROD_PASSWORD
7880
TWINE_REPOSITORY_URL: https://my.artifactory.net/pypi/prod-repository
79-
TWINE_USERNAME: $ARTIFACTORY_PROD_USER
80-
TWINE_PASSWORD: $ARTIFACTORY_PROD_PASSWORD
8181
rules:
8282
- if: $CI_COMMIT_TAG
8383
when: on_success

tests/unit/comparison_files/test_python_full_stack_test_with_mypy.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ test-pytest:
1818
script:
1919
- pip3 install --upgrade -v -r requirements.txt
2020
- pytest
21-
test-evaluate-git-tag-pep404-conformity:
21+
test-evaluate-git-tag-pep440-conformity:
2222
image:
2323
name: thomass/gcip:0.3.0
2424
stage: test
2525
script:
26-
- python3 -m gcip.tools.evaluate_git_tag_pep404_conformity
26+
- python3 -m gcip.tools.evaluate_git_tag_pep440_conformity
2727
rules:
2828
- if: $CI_COMMIT_TAG
2929
when: on_success
@@ -65,9 +65,9 @@ deploy-twine-upload-dev:
6565
- pip3 install --upgrade twine
6666
- python3 -m twine upload --non-interactive --disable-progress-bar dist/*
6767
variables:
68+
TWINE_USERNAME: $$ARTIFACTORY_DEV_USER
69+
TWINE_PASSWORD: $$ARTIFACTORY_DEV_PASSWORD
6870
TWINE_REPOSITORY_URL: https://my.artifactory.net/pypi/dev-repository
69-
TWINE_USERNAME: $ARTIFACTORY_DEV_USER
70-
TWINE_PASSWORD: $ARTIFACTORY_DEV_PASSWORD
7171
rules:
7272
- if: $CI_COMMIT_TAG
7373
when: never
@@ -80,9 +80,9 @@ deploy-twine-upload-stable:
8080
- pip3 install --upgrade twine
8181
- python3 -m twine upload --non-interactive --disable-progress-bar dist/*
8282
variables:
83+
TWINE_USERNAME: $$ARTIFACTORY_PROD_USER
84+
TWINE_PASSWORD: $$ARTIFACTORY_PROD_PASSWORD
8385
TWINE_REPOSITORY_URL: https://my.artifactory.net/pypi/prod-repository
84-
TWINE_USERNAME: $ARTIFACTORY_PROD_USER
85-
TWINE_PASSWORD: $ARTIFACTORY_PROD_PASSWORD
8686
rules:
8787
- if: $CI_COMMIT_TAG
8888
when: on_success

0 commit comments

Comments
 (0)