Skip to content

Commit 63e1c77

Browse files
committed
Extract script language extension classes from _pythonscript into godot._lang
1 parent 5dd072c commit 63e1c77

11 files changed

+368
-605
lines changed

src/_pythonscript_editor.pxi

Lines changed: 0 additions & 151 deletions
This file was deleted.

src/_pythonscript_specs.pxi

Lines changed: 0 additions & 117 deletions
This file was deleted.

src/godot/__init__.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,16 @@
1+
# TODO: now that the gdptrs are located in `libpythonscript.so`, doing a `import godot`
2+
# from a python interpreter cause a `ImportError: libpythonscript.so: cannot open shared object file: No such file or directory`
3+
# when doing `from godot.builtins import *`. We should change the sanity check accordingly...
4+
15
# Start with a sanity check to ensure the loading is done from Godot-Python
26
# (and not from a regular Python interpreter which would lead to a segfault).
37
# The idea is we should have the following loading order:
4-
# godot binary -> libpythonscript.so -> _pythonscript.so -> godot/__init__.py
8+
# godot binary -> libpythonscript.so -> godot/__init__.py
59
import sys
610

7-
if "_pythonscript" not in sys.modules:
11+
if (
12+
sys.argv[0] == ""
13+
): # `sys.argv` is configured later on by `godot._lang._pythonscript_initialize()`
814
raise ImportError(
915
"Cannot initialize godot module given Godot GDExtension API not available.\n"
1016
"This is most likely because you are running code from a regular Python interpreter"
@@ -13,7 +19,7 @@
1319
)
1420
del sys
1521

16-
from godot._version import __version__
22+
from godot._version import __version__ # noqa: E402, F401
1723

1824
# from godot.tags import (
1925
# MethodRPCMode,
@@ -32,7 +38,7 @@
3238
# export,
3339
# exposed,
3440
# )
35-
from godot.builtins import *
41+
from godot.builtins import * # noqa: E402, F403
3642

3743
# from godot.classes import _load_singleton, _load_class
3844

0 commit comments

Comments
 (0)