Skip to content

Commit e9b0df4

Browse files
committed
tempfile needs some native modules already, use it later
1 parent a9eede1 commit e9b0df4

File tree

1 file changed

+4
-2
lines changed
  • graalpython/com.oracle.graal.python.cext

1 file changed

+4
-2
lines changed

graalpython/com.oracle.graal.python.cext/setup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
import os
4343
import shutil
4444
import site
45-
import tempfile
4645
import logging
4746
from distutils.core import setup, Extension
4847
from distutils.sysconfig import get_config_var, get_config_vars
@@ -83,6 +82,7 @@ def __init__(self, lib_name, package_spec, url):
8382
self.url = url
8483

8584
def download(self):
85+
import tempfile
8686
package_pattern = os.environ.get("GINSTALL_PACKAGE_PATTERN", None)
8787
package_version_pattern = os.environ.get("GINSTALL_PACKAGE_VERSION_PATTERN", None)
8888
tempdir = tempfile.mkdtemp()
@@ -173,6 +173,7 @@ def install(self, build_dir=None):
173173
return self.lib_install_dir
174174

175175
def conftest(self):
176+
import tempfile
176177
src = b'''#include <bzlib.h>
177178
#include <stdio.h>
178179
@@ -260,12 +261,13 @@ def __call__(self):
260261

261262

262263
builtin_exts = (
263-
NativeBuiltinModule("_bz2", deps=[Bzip2Depedency("bz2", "bzip2==1.0.8", "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz")]),
264264
NativeBuiltinModule("_cpython_sre"),
265265
NativeBuiltinModule("_cpython_unicodedata"),
266266
NativeBuiltinModule("_memoryview"),
267267
NativeBuiltinModule("_mmap"),
268268
NativeBuiltinModule("_struct"),
269+
# the above modules are more core, we need them first to deal with later, more complex modules with dependencies
270+
NativeBuiltinModule("_bz2", deps=[Bzip2Depedency("bz2", "bzip2==1.0.8", "https://sourceware.org/pub/bzip2/bzip2-1.0.8.tar.gz")]),
269271
)
270272

271273

0 commit comments

Comments
 (0)