Skip to content

Commit 0b55ef4

Browse files
committed
Avoid loading hpy.devel if loading hpy.universal
1 parent f77146e commit 0b55ef4

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

graalpython/lib-graalpython/modules/hpy/universal.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
# SOFTWARE.
3939

4040
import _imp
41-
from .devel import version
4241

4342
def load_from_spec(spec):
4443
try:
@@ -48,5 +47,15 @@ def load_from_spec(spec):
4847
raise e.__cause__
4948
raise
5049

50+
__version = None
5151
def get_version():
52-
return (version.__version__, version.__git_revision__)
52+
global __version
53+
if not __version:
54+
import os.path
55+
import _io
56+
path = os.path.join(os.path.dirname(__file__), "devel", "version.py")
57+
ns = {}
58+
with _io.FileIO(path, "r") as f:
59+
exec(compile(f.readall(), path, "exec"), ns)
60+
__version = (ns["__version__"], ns["__git_revision__"])
61+
return __version

0 commit comments

Comments
 (0)