maiself / godot-python-extension

Python language bindings for the Godot game engine
https://godot-python-extension.readthedocs.io
MIT License
21 stars 4 forks source link

SConstruct TypeError: access: path should be string, bytes or os.PathLike, not NoneType #1

Closed hemebond closed 1 year ago

hemebond commented 1 year ago

Getting an error when trying to build on Debian Linux:

 $ scons godot=/home/james/.local/bin/godot4 
scons: Reading SConscript files ...
Auto-detected 8 CPU cores available for build parallelism. Using 7 cores by default. You can override it with the -j argument.
TypeError: access: path should be string, bytes or os.PathLike, not NoneType:
  File "/home/james/Workspace/godot-python-extension/SConstruct", line 139:
    opts.Update(env)
  File "/usr/lib/python3/dist-packages/SCons/Variables/__init__.py", line 230:
    option.validator(option.key, env.subst('${%s}'%option.key), env)
  File "/home/james/Workspace/godot-python-extension/tools/build_utils.py", line 167:
    if os.access(path, os.X_OK):

 $ python --version
Python 3.11.5

 $ scons --version
SCons by Steven Knight et al.:
    SCons: v4.4.0.fc8d0ec215ee6cba8bc158ad40c099be0b598297, Sat, 30 Jul 2022 14:11:34 -0700, by bdbaddog on M1Dog2021
    SCons path: ['/usr/lib/python3/dist-packages/SCons']
Copyright (c) 2001 - 2022 The SCons Foundation
maiself commented 1 year ago

Hi, thanks for the report!

There's definitely a bug there, however I'm not exactly sure whats going on. Based of the info given, my only guesses are that the path could be wrong, or the file isn't marked executable, but something else may be happening.

I've pushed an update to the related code which fixes the one error I spotted and adds a bit more descriptive error messages (02cf5b2). Could you please try again with the new code and report back?

hemebond commented 1 year ago

Thanks. I'm getting this error now:

$ scons godot=/home/james/.local/bin/godot4 python_config=`which python3-config`
scons: Reading SConscript files ...
Auto-detected 8 CPU cores available for build parallelism. Using 7 cores by default. You can override it with the -j argument.
Building for architecture x86_64 on platform linux
scons: done reading SConscript files.
scons: Building targets ...
Generating R string header
Extracting GDExtension API
Dumping GDExtension interface header file
Dumping Extension API
Godot Engine v4.1.1.stable.official.bd6af8e0e - https://godotengine.org

error: patch failed: src/.generated/gdextension_interface.h:308
error: src/.generated/gdextension_interface.h: patch does not apply
scons: *** [extern/gdextension/gdextension_interface.h] CalledProcessError : Command '['git', 'apply', '--directory=src/.generated/', 'tools/gde_interface_types.patch']' returned non-zero exit status 1.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/SCons/Action.py", line 1318, in execute
    result = self.execfunction(target=target, source=rsources, env=env)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/james/Workspace/godot-python-extension/tools/builders.py", line 23, in make_extract_api_action
    subprocess.run(['git', 'apply', '--directory=src/.generated/', 'tools/gde_interface_types.patch'], check=True)
  File "/usr/lib/python3.11/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'apply', '--directory=src/.generated/', 'tools/gde_interface_types.patch']' returned non-zero exit status 1.
scons: building terminated because of errors.
maiself commented 1 year ago

I've pushed code to update the patch process during building and added version checks.

From the log I can see you're trying to build against Godot version 4.1.1. Unfortunately that version doesn't contain the required commits for this extension to work, Godot 4.2 or newer is needed. However even 4.2-dev5 doesn't contain the required commits. You will either have build Godot yourself, or download an *unstable* build from https://godotengine.github.io/godot-commit-artifacts/ (September 20th or later) until Godot 4.2 or 4.2-dev6 is released.

hemebond commented 1 year ago

Thank you. I wasn't able to get a 4.2 download so I'll try again after 4.2 is released.

maiself commented 1 year ago

Thanks for giving it a try and reporting the issues!

hemebond commented 6 months ago

Just an update to this. Compiled without issue with the latest 4.2.1 release. However I'm still trying to work out how to actually use/enable it. Neither the README here, nor other GDExtension documentation seems to mention it.