Skip to content

Conversation

dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Jul 17, 2025

After #1669, I'm getting an error like this with custom_api_file:

Python `FileNotFoundError` exception
FileNotFoundError: [Errno 2] No such file or directory: '/home/dsnopek/Sync/Projects/default/godot_openxr_vendors/thirdparty/godot_cpp_gdextension_api/thirdparty/godot_cpp_gdextension_api/extension_api.json':
  File "/home/dsnopek/Sync/Projects/default/godot-cpp/test/SConstruct", line 3:
    env = SConscript("../SConstruct")
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 661:
    return method(*args, **kw)
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 598:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/usr/lib/python3/dist-packages/SCons/Script/SConscript.py", line 287:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/dsnopek/Sync/Projects/default/godot-cpp/SConstruct", line 54:
    library = env.GodotCPP()
  File "/usr/lib/python3/dist-packages/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/home/dsnopek/Sync/Projects/default/godot-cpp/tools/godotcpp.py", line 543:
    bindings = env.GodotCPPBindings(
  File "/usr/lib/python3/dist-packages/SCons/Environment.py", line 255:
    return MethodWrapper.__call__(self, target, source, *args, **kw)
  File "/usr/lib/python3/dist-packages/SCons/Environment.py", line 219:
    return self.method(*nargs, **kwargs)
  File "/usr/lib/python3/dist-packages/SCons/Builder.py", line 653:
    return self._execute(env, target, source, OverrideWarner(kw), ekw)
  File "/usr/lib/python3/dist-packages/SCons/Builder.py", line 563:
    tlist, slist = self._create_nodes(env, target, source)
  File "/usr/lib/python3/dist-packages/SCons/Builder.py", line 525:
    target, source = self.emitter(target=tlist, source=slist, env=env)
  File "/home/dsnopek/Sync/Projects/default/godot-cpp/tools/godotcpp.py", line 141:
    env.Clean(target, [env.File(f) for f in get_file_list(str(source[0]), target[0].abspath, True, True)])
  File "/home/dsnopek/Sync/Projects/default/godot-cpp/binding_generator.py", line 205:
    with open(api_filepath, encoding="utf-8") as api_file:

It's looking for the file relative to the godot-cpp directory, rather than relative to the directory where the scons command was run.

This is with SCons 4.0.1, which is what comes with Ubuntu 22.04, however, if I update to SCons 4.9.1 via pip, then everything works as expected.

I did some testing (debug print() statements and all!), and it seems like the converter=normalize_path that #1669 added is running, but it doesn't seem to actually affect the value returned by env.get('custom_api_file').

This PR removes the converter and switches back to calling normalize_path directly, and everything works for me.

@Ivorforce Does your variant_dir stuff still work with this change?

@dsnopek dsnopek added this to the 4.x milestone Jul 17, 2025
@dsnopek dsnopek requested a review from a team as a code owner July 17, 2025 14:10
@dsnopek dsnopek added bug This has been identified as a bug cherrypick:4.3 cherrypick:4.4 labels Jul 17, 2025
@dsnopek dsnopek requested review from Ivorforce and removed request for a team July 17, 2025 14:13
Copy link
Member

@Ivorforce Ivorforce left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see no reason why variant_dir shouldn't still work with this change (but I also tested and confirmed it did).
It's unfortunate this means we can't use converters for the time being, but it beats forcing ubuntu users to update the included SCons.

@dsnopek dsnopek merged commit 134e8b7 into godotengine:master Jul 19, 2025
16 checks passed
@dsnopek
Copy link
Collaborator Author

dsnopek commented Aug 21, 2025

Cherry-picked for 4.4 in PR #1836

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This has been identified as a bug cherrypick:4.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants