Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@
"linux:aarch64:jdk-latest" : daily + t("01:00:00"),
"darwin:aarch64:jdk-latest" : daily + t("01:00:00"),
}),
"python-unittest-multi-context": gpgate + require(GPY_JVM_STANDALONE) + platform_spec(no_jobs) + platform_spec({
"python-unittest-multi-context": gpgate + require(GPY_NATIVE_STANDALONE) + platform_spec(no_jobs) + platform_spec({
"linux:amd64:jdk-latest" : tier3,
"linux:aarch64:jdk-latest" : daily + t("02:00:00"),
"windows:amd64:jdk-latest" : daily + t("01:30:00"),
"windows:amd64:jdk-latest" : daily + t("02:00:00"),
}),
"python-unittest-jython": gpgate + platform_spec(no_jobs) + platform_spec({
"linux:amd64:jdk21" : daily + t("00:30:00") + require(GPY_JVM21_STANDALONE),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
* because we cannot create multiple contexts that would load native extensions.
*/
public class NativeExtTest {
private static final String DELVEWHEEL_VERSION = "1.9.0";
private static final String DELVEWHEEL_VERSION = "1.13.0";

@BeforeClass
public static void setUpClass() {
Expand Down Expand Up @@ -131,7 +131,7 @@ public void testMissingDelvewheelError() throws IOException {
Value exception = ex.getGuestObject();
Assert.assertTrue(exception.isException());
Assert.assertEquals(ex.getMessage(), "SystemError", exception.getMetaObject().getMetaSimpleName());
Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("delvewheel==" + DELVEWHEEL_VERSION));
Assert.assertTrue(ex.getMessage(), ex.getMessage().contains("delvewheel>=" + DELVEWHEEL_VERSION));
}
} finally {
Files.deleteIfExists(tempDir);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,8 @@
import com.oracle.truffle.api.TruffleFile;

final class PEFile extends SharedObject {
private static final String DELVEWHEEL_VERSION = "1.9.0";
private static final String DELVEWHEEL_INSTALL_INSTRUCTION = "IsolateNativeModules option needs `delvewheel` tool to copy libraries. Make sure you have `delvewheel==" + DELVEWHEEL_VERSION +
private static final String DELVEWHEEL_VERSION = "1.13.0";
private static final String DELVEWHEEL_INSTALL_INSTRUCTION = "IsolateNativeModules option needs `delvewheel` tool to copy libraries. Make sure you have `delvewheel>=" + DELVEWHEEL_VERSION +
"` available in the virtualenv or on PATH (needs environment access).";

private final PythonContext context;
Expand All @@ -79,7 +79,7 @@ public void setId(String newId) {
// TODO
}

private String getDelvewheelPython() throws NativeLibraryToolException {
private String getDelvewheel() throws NativeLibraryToolException {
TruffleFile delvewheel = which(context, "delvewheel.exe");
if (!delvewheel.exists()) {
delvewheel = which(context, "delvewheel.bat");
Expand All @@ -90,38 +90,17 @@ private String getDelvewheelPython() throws NativeLibraryToolException {
if (!delvewheel.exists()) {
throw new NativeLibraryToolException("Could not find `delvewheel`. " + DELVEWHEEL_INSTALL_INSTRUCTION);
}
TruffleFile python = delvewheel.resolveSibling("python.exe");
if (!python.exists()) {
python = delvewheel.resolveSibling("python.bat");
}
if (!python.exists()) {
python = delvewheel.resolveSibling("python.cmd");
}
if (!python.exists()) {
python = delvewheel.getParent().resolveSibling("python.exe");
}
if (!python.exists()) {
python = delvewheel.getParent().resolveSibling("python.bat");
}
if (!python.exists()) {
python = delvewheel.getParent().resolveSibling("python.cmd");
}
if (!python.exists()) {
throw new NativeLibraryToolException("Could not find Python executable next to `delvewheel` at '" + delvewheel + "'. " + DELVEWHEEL_INSTALL_INSTRUCTION);
}
return python.toString();
return delvewheel.toString();
}

@Override
public void changeOrAddDependency(String oldName, String newName) throws NativeLibraryToolException {
var pb = newProcessBuilder(context);
var stderr = new ByteArrayOutputStream();
pb.redirectError(pb.createRedirectToStream(stderr));
var tempfileWithForwardSlashes = tempfile.toString().replace('\\', '/');
String pythonExe = getDelvewheelPython();
pb.command(pythonExe, "-c",
String.format("from delvewheel import _dll_utils; _dll_utils.replace_needed('%s', ['%s'], {'%s': '%s'}, strip=True, verbose=2, test=[])",
tempfileWithForwardSlashes, oldName, oldName, newName));
String delvewheel = getDelvewheel();
pb.command(delvewheel, "replace-needed", "-v", "-v", "--strip", "-change", oldName, newName,
tempfile.toString());
Process proc;
try {
proc = pb.start();
Expand Down
18 changes: 11 additions & 7 deletions mx.graalpython/mx_graalpython.py
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ def _dev_pythonhome():
return os.path.join(SUITE.dir, "graalpython")


def get_path_with_patchelf():
def get_path_with_patchelf(graalpy=None):
path = os.environ.get("PATH", "")
if mx.is_linux() and not shutil.which("patchelf"):
venv = Path(SUITE.get_output_root()).absolute() / "patchelf-venv"
Expand All @@ -661,11 +661,15 @@ def get_path_with_patchelf():
venv = Path(SUITE.get_output_root()).absolute() / "delvewheel-venv"
path += os.pathsep + str(venv / "Scripts")
if not shutil.which("delvewheel", path=path):
mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {sys.executable}... [delvewheel not found on PATH]")
if sys.version_info < (3, 12) and graalpy:
venv_python = [graalpy, "-X", "jit=0"]
else:
venv_python = [sys.executable]
mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... [delvewheel not found on PATH]")
t0 = time.time()
subprocess.check_call([sys.executable, "-m", "venv", str(venv)])
subprocess.check_call([str(venv / "Scripts" / "pip.exe"), "install", "delvewheel"])
mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {sys.executable}... [duration: {time.time() - t0}]")
subprocess.check_call(venv_python + ["-m", "venv", str(venv)])
subprocess.check_call([str(venv / "Scripts" / "pip.exe"), "install", "delvewheel>=1.13.0"])
mx.log(f"{time.strftime('[%H:%M:%S] ')} Building delvewheel-venv with {shlex.join(venv_python)}... [duration: {time.time() - t0}]")
return path


Expand Down Expand Up @@ -1678,8 +1682,8 @@ def graalpython_gate_runner(_, tasks):
with Task('GraalPython multi-context unittests', tasks, tags=[GraalPythonTags.unittest_multi]) as task:
if task:
env = os.environ.copy()
env['PATH'] = get_path_with_patchelf()
graalpy = graalpy_standalone_jvm()
graalpy = graalpy_standalone_native()
env['PATH'] = get_path_with_patchelf(graalpy)
mx.log("1. Running twice without shared engine")
run_python_unittests(
graalpy,
Expand Down
Loading