Skip to content

Commit a3b622b

Browse files
committed
take release version from graalpy
1 parent 49b469c commit a3b622b

File tree

2 files changed

+21
-12
lines changed

2 files changed

+21
-12
lines changed

graalpython/com.oracle.graal.python.test/src/tests/standalone/test_standalone.py

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,16 @@ def get_gp():
9999

100100
return graalpy
101101

102+
103+
def get_graalvm_version():
104+
graalvmVersion, _ = run_cmd([get_gp(), "-c", "print(__graalpython__.get_graalvm_version(), end='')"], os.environ.copy())
105+
# when JLine is cannot detect a terminal, it prints logging info
106+
graalvmVersion = graalvmVersion.split("\n")[-1]
107+
# we never test -dev versions here, we always pretend to use release versions
108+
graalvmVersion = graalvmVersion.split("-dev")[0]
109+
return graalvmVersion
110+
111+
102112
class PolyglotAppTest(unittest.TestCase):
103113

104114
def setUpClass(self):
@@ -111,9 +121,7 @@ def setUpClass(self):
111121
self.archetypeGroupId = "org.graalvm.python"
112122
self.archetypeArtifactId = "graalpy-archetype-polyglot-app"
113123
self.pluginArtifactId = "graalpy-maven-plugin"
114-
graalvmVersion, _ = run_cmd([get_gp(), "-c", "print(__graalpython__.get_graalvm_version(), end='')"], self.env)
115-
# when JLine is cannot detect a terminal, it prints logging info
116-
self.graalvmVersion = graalvmVersion.split("\n")[-1]
124+
self.graalvmVersion = get_graalvm_version()
117125

118126
for custom_repo in os.environ.get("MAVEN_REPO_OVERRIDE", "").split(","):
119127
url = urllib.parse.urlparse(custom_repo)
@@ -392,7 +400,8 @@ def test_native_executable_one_file():
392400
graalpy = get_gp()
393401
if graalpy is None:
394402
return
395-
env = os.environ.copy()
403+
env = os.environ.copy()
404+
env["MVN_GRAALPY_VERSION"] = get_graalvm_version()
396405

397406
with tempfile.TemporaryDirectory() as tmpdir:
398407

@@ -417,6 +426,7 @@ def test_native_executable_venv_and_one_file():
417426
if graalpy is None:
418427
return
419428
env = os.environ.copy()
429+
env["MVN_GRAALPY_VERSION"] = get_graalvm_version()
420430

421431
with tempfile.TemporaryDirectory() as target_dir:
422432
source_file = os.path.join(target_dir, "hello.py")
@@ -453,6 +463,7 @@ def test_native_executable_module():
453463
if graalpy is None:
454464
return
455465
env = os.environ.copy()
466+
env["MVN_GRAALPY_VERSION"] = get_graalvm_version()
456467

457468
with tempfile.TemporaryDirectory() as tmp_dir:
458469

mx.graalpython/mx_graalpython.py

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -935,8 +935,7 @@ def deploy_local_maven_repo():
935935
# build GraalPy and all the necessary dependencies, so that we can deploy them
936936
mx.run_mx(["build"])
937937
# deploy maven artifacts
938-
import mx_sdk_vm_impl
939-
version = mx_sdk_vm_impl.graalvm_version('graalvm')
938+
version = GRAAL_VERSION
940939
path = os.path.join(SUITE.get_mx_output_dir(), 'public-maven-repo')
941940
licenses = ['EPL-2.0', 'PSF-License', 'GPLv2-CPE', 'ICU,GPLv2', 'BSD-simplified', 'BSD-new', 'UPL', 'MIT']
942941
deploy_args = [
@@ -954,7 +953,7 @@ def deploy_local_maven_repo():
954953
mx.rmtree(path, ignore_errors=True)
955954
os.mkdir(path)
956955
mx.maven_deploy(deploy_args)
957-
return path
956+
return path, version
958957

959958

960959
def python_jvm(_=None):
@@ -1403,10 +1402,10 @@ def graalpython_gate_runner(args, tasks):
14031402
# JUnit tests with Maven
14041403
with Task('GraalPython integration JUnit with Maven', tasks, tags=[GraalPythonTags.junit_maven]) as task:
14051404
if task:
1406-
mvn_repo_path = pathlib.Path(deploy_local_maven_repo()).as_uri()
1405+
mvn_repo_path, artifacts_version = deploy_local_maven_repo()
1406+
mvn_repo_path = pathlib.Path(mvn_repo_path).as_uri()
14071407
central_override = mx_urlrewrites.rewriteurl('https://repo1.maven.org/maven2/')
14081408
pom_path = os.path.join(SUITE.dir, 'graalpython/com.oracle.graal.python.test.integration/pom.xml')
1409-
artifacts_version = GRAAL_VERSION + '-dev'
14101409
mvn_cmd_base = ['-f', pom_path,
14111410
f'-Dcom.oracle.graal.python.test.polyglot.version={artifacts_version}',
14121411
f'-Dcom.oracle.graal.python.test.polyglot_repo={mvn_repo_path}',
@@ -1481,14 +1480,13 @@ def graalpython_gate_runner(args, tasks):
14811480
'JAVA_HOME': graalvm_jdk(),
14821481
'PYTHON_STANDALONE_HOME': graalpy_standalone_home('jvm')
14831482
}
1484-
mvn_repo_path = deploy_local_maven_repo()
1483+
mvn_repo_path, version = deploy_local_maven_repo()
14851484
# setup maven downloader overrides
14861485
env['MAVEN_REPO_OVERRIDE'] = ",".join([
14871486
f"{pathlib.Path(mvn_repo_path).as_uri()}/",
14881487
mx_urlrewrites.rewriteurl('https://repo1.maven.org/maven2/'),
14891488
])
1490-
import mx_sdk_vm_impl
1491-
env["org.graalvm.maven.downloader.version"] = mx_sdk_vm_impl.graalvm_version('graalvm')
1489+
env["org.graalvm.maven.downloader.version"] = version
14921490
env["org.graalvm.maven.downloader.repository"] = f"{pathlib.Path(mvn_repo_path).as_uri()}/"
14931491
# run the test
14941492
mx.logv(f"running with os.environ extended with: {env=}")

0 commit comments

Comments
 (0)