Skip to content

Commit 6dd232f

Browse files
authored
Merge pull request #771 from maxnoe/fix_version_check
Allow pre-releases and fix error message in DIRAC version check
2 parents f4c8342 + 9a23baa commit 6dd232f

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

.github/workflows/deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
- name: Checkout main repository
3030
uses: actions/checkout@v5
3131
with:
32-
fetch-depth: 0 # get full history (so no need for "git fetch --unshallow")
32+
fetch-depth: 0 # get full history (so no need for "git fetch --unshallow")
3333

3434
# Configure git identity
3535
- name: Configure git

src/WebAppDIRAC/scripts/dirac_webapp_run.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,20 @@ def _checkDIRACVersion():
6363
"""
6464
from importlib.metadata import requires, version # pylint: disable=import-error,no-name-in-module
6565
from packaging.requirements import Requirement # pylint: disable=no-name-in-module
66+
from packaging.specifiers import SpecifierSet
6667

6768
deps = [Requirement(x) for x in requires("WebAppDIRAC")]
6869
deps = [x for x in deps if x.name.lower() == "dirac"]
6970
if len(deps) != 1:
7071
raise NotImplementedError(f"This shouldn't be possible: {deps!r}")
72+
7173
dirac_version = version("DIRAC")
72-
dirac_spec = deps[0].specifier
74+
dirac_spec = SpecifierSet(deps[0].specifier, prereleases=True)
75+
7376
if dirac_version not in dirac_spec:
7477
raise RuntimeError(
7578
"WebAppDIRAC {} requires {} but {} is incompatible".format(
76-
version("WebAppDIRAC"), dirac_version, dirac_spec
79+
version("WebAppDIRAC"), dirac_spec, dirac_version
7780
)
7881
)
7982

0 commit comments

Comments
 (0)