File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ {
2+ "name" : " Transformation - Python" ,
3+ "image" : " mcr.microsoft.com/devcontainers/base:1-debian" ,
4+ "features" : {
5+ "ghcr.io/devcontainers/features/java:1" : {
6+ "version" : " 17" ,
7+ "jdkDistro" : " open" ,
8+ "gradleVersion" : " latest" ,
9+ "mavenVersion" : " latest" ,
10+ "antVersion" : " latest" ,
11+ "groovyVersion" : " latest"
12+ },
13+ "ghcr.io/devcontainers/features/python:1" : {
14+ "version" : " 3.13"
15+ },
16+ "ghcr.io/devcontainers-extra/features/poetry:2" : {
17+ "version" : " latest"
18+ }
19+ },
20+ "containerEnv" : {
21+ "PYTHONUNBUFFERED" : " 1"
22+ },
23+ "postCreateCommand" : " poetry install" ,
24+ "customizations" : {
25+ "vscode" : {
26+ "extensions" : [
27+ " ms-python.python" ,
28+ " ms-python.vscode-pylance" ,
29+ " charliermarsh.ruff" ,
30+ " ms-toolsai.jupyter"
31+ ],
32+ "settings" : {
33+ "python.testing.pytestEnabled" : true ,
34+ "python.testing.pytestArgs" : [" tests" ]
35+ }
36+ }
37+ }
38+ }
Original file line number Diff line number Diff line change @@ -34,13 +34,15 @@ def __extract_version_line(java_version_output: str) -> str:
3434 (line for line in java_version_output .splitlines () if "version" in line ), None
3535 )
3636 if not version_line :
37- pytest .fail ("Couldn't find version information in `java -version` output." )
37+ pytest .fail (
38+ "Couldn't find version information in `java -version` output." )
3839 return version_line
3940
4041
4142# pylint: disable=R1710
4243def __parse_major_version (version_line : str ) -> int :
43- version_regex = re .compile (r'version "(?P<major>\d+)\.(?P<minor>\d+)\.\w+"' )
44+ version_regex = re .compile (
45+ r'version "(?P<major>\d+)\.(?P<minor>\d+)\.\w+"' )
4446 match = version_regex .search (version_line )
4547 if match is not None :
4648 major_version = int (match .group ("major" ))
@@ -49,4 +51,11 @@ def __parse_major_version(version_line: str) -> int:
4951 # https://softwareengineering.stackexchange.com/questions/175075/why-is-java-version-1-x-referred-to-as-java-x
5052 major_version = int (match .group ("minor" ))
5153 return major_version
54+
55+ # Opensource versions follow an alternative system
56+ alternative_version_regex = re .compile (r'version "(?P<major>\d+)"' )
57+ match = alternative_version_regex .search (version_line )
58+ if match is not None :
59+ major_version = int (match .group ("major" ))
60+ return major_version
5261 pytest .fail (f"Couldn't parse Java version from { version_line } ." )
You can’t perform that action at this time.
0 commit comments