86
86
SUITE_SULONG = mx .suite ("sulong" )
87
87
88
88
GRAAL_VERSION = "." .join (SUITE .suiteDict ['version' ].split ('.' )[:2 ])
89
+ GRAAL_VERSION_NODOT = GRAAL_VERSION .replace ('.' , '' )
89
90
PYTHON_VERSION = "3.10"
91
+ PYTHON_VERSION_NODOT = "3.10" .replace ('.' , '' )
90
92
91
93
GRAALPYTHON_MAIN_CLASS = "com.oracle.graal.python.shell.GraalPythonMain"
92
94
@@ -1603,18 +1605,35 @@ def _get_output_root(projectname):
1603
1605
mx .abort ("Could not find out dir for project %s" % projectname )
1604
1606
1605
1607
1606
- def py_version_short (* args ):
1608
+ def py_version_short (variant = None , ** kwargs ):
1609
+ if variant == 'major_minor_nodot' :
1610
+ return PYTHON_VERSION_NODOT
1607
1611
return PYTHON_VERSION
1608
1612
1609
1613
1610
- def graal_version_short (* args ):
1614
+ def graal_version_short (variant = None , ** kwargs ):
1615
+ if variant == 'major_minor_nodot' :
1616
+ return GRAAL_VERSION_NODOT
1611
1617
return GRAAL_VERSION
1612
1618
1613
- def graalpy_ext (arg ):
1614
- if arg == "soabi" :
1615
- # TODO(fa): do properly
1616
- return ".graalpy231-310-native-x86_64-darwin.so"
1617
- raise ValueError ("unknown ext type requested: " + arg )
1619
+ def graalpy_ext (llvm_mode , ** kwargs ):
1620
+ if not llvm_mode :
1621
+ mx .abort ("substitution 'graalpy_ext' is missing argument 'llvm_mode'" )
1622
+ os = mx_subst .path_substitutions .substitute ('<os>' )
1623
+ arch = mx_subst .path_substitutions .substitute ('<arch>' )
1624
+ if arch == 'amd64' :
1625
+ # be compatible with CPython's designation
1626
+ # (see also: 'PythonUtils.getPythonArch')
1627
+ arch = 'x86_64'
1628
+
1629
+ # not ".dylib", similar to CPython:
1630
+ # https://github.com/python/cpython/issues/37510
1631
+ if os == 'windows' :
1632
+ ext = 'pyd'
1633
+ else :
1634
+ ext = 'so'
1635
+
1636
+ return f'.graalpy{ GRAAL_VERSION_NODOT } -{ PYTHON_VERSION_NODOT } -{ llvm_mode } -{ arch } -{ os } .{ ext } '
1618
1637
1619
1638
1620
1639
mx_subst .path_substitutions .register_with_arg ('suite' , _get_suite_dir )
@@ -1623,7 +1642,8 @@ def graalpy_ext(arg):
1623
1642
mx_subst .path_substitutions .register_with_arg ('py_ver' , py_version_short )
1624
1643
mx_subst .path_substitutions .register_with_arg ('graal_ver' , graal_version_short )
1625
1644
1626
- mx_subst .string_substitutions .register_with_arg ('ext' , graalpy_ext )
1645
+ mx_subst .path_substitutions .register_with_arg ('graalpy_ext' , graalpy_ext )
1646
+ mx_subst .results_substitutions .register_with_arg ('graalpy_ext' , graalpy_ext )
1627
1647
1628
1648
1629
1649
def delete_self_if_testdownstream (args ):
0 commit comments