Skip to content

Conversation

Ivorforce
Copy link
Contributor

@Ivorforce Ivorforce commented Oct 28, 2024

This is quite a big change. Review required. I haven't tested running this with different python versions yet, will do this later.

Note (I think) the "python" option available previously didn't do anything, as the environment variable was overridden anyway.

@Ivorforce Ivorforce force-pushed the choose-python-scons branch from 5f1183a to d0fbdcf Compare October 28, 2024 14:43
@Ivorforce
Copy link
Contributor Author

Ivorforce commented Oct 28, 2024

I tried adding windows and linux arm64 builds, but they are failing because of binary incompatibility:

strip: Unable to recognise the format of the input file `/home/runner/work/godot-python-extension/godot-python-extension/bin/linux-arm64-20231002-3.12.0/libpython3.12.so.1.0'

That's a ToDo for the future. Arm runners are currently an Enterprise feature.

The strip problem may be solvable with more infrastructure:

https://github.com/electron/electron/blob/main/script/strip-binaries.py#L16-L25

But then, we also run python -m sysconfig, and that may never work with an arm binary on x86_64.

@Ivorforce Ivorforce force-pushed the choose-python-scons branch 2 times, most recently from b247007 to 13e116a Compare October 28, 2024 14:58
@maiself maiself added enhancement New feature or request build related to the build system labels Oct 29, 2024
@Ivorforce Ivorforce force-pushed the choose-python-scons branch from 13e116a to bc7f14a Compare October 29, 2024 13:34
Copy link
Owner

@maiself maiself left a comment

Choose a reason for hiding this comment

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

A lot to look at, will have to do a deeper look later.

auto py_minor = std::to_string(PY_MINOR_VERSION);
auto py_version = py_major + "." + py_minor;
auto py_version_no_dot = py_major + py_minor;
auto python_zip_name = "python" + py_version_no_dot + ".zip";
Copy link
Owner

Choose a reason for hiding this comment

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

Naming of the zip here is pretty standard. I believe there is a document in the python manual detailing the layout, but don't have a link on hand.

Copy link
Contributor Author

@Ivorforce Ivorforce Feb 16, 2025

Choose a reason for hiding this comment

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

It's been a while so I don't remember my reason for changing it. I think it was because I wanted the zip name to be consistent with the lib name, which uses dots (e.g. python3.2). That makes more sense to me, but I suppose if there's a PEP for a python lib zip name, I agree we should adhere to it.

env['python'] = prepare_python.prepare_for_platform(env['platform'], env['arch'],
src_dir = src, dest_dir = dest)

prepare_python_alias = env.Alias("prepare_python", [
Copy link
Owner

Choose a reason for hiding this comment

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

Why was the alias removed? I think the alias may have existed to ensure something else built or for some build optimization (don't remember exactly)

May need to review this part again once I understand what's happening better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's been a while, but IIRC the Command usage did pretty much the same as Builder(Action) which is in use right now, but more concisely and with less call overhead. I didn't find a reason why it was implemented with aliases and builders.



def _append_python_config(env, target, **kwargs):
src_dir = generated_path / 'python' / prepared_python_config.name
Copy link
Owner

Choose a reason for hiding this comment

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

Note to self: became overwhelmed by above, once understand above better review from here to end of file.

class PlatformConfig:
platform: str
arch: str
python_version_major: str
Copy link
Owner

Choose a reason for hiding this comment

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

Naming of these is confusing me, would like to come up with something more concise as well as descriptive.

Copy link
Contributor Author

@Ivorforce Ivorforce Feb 16, 2025

Choose a reason for hiding this comment

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

You mean the members? I'm open to any changes :)
If you're referring to the python version names specifically, those are named from semver's major-minor-patch system.


shutil.make_archive(dest_dir / f'python{config.python_version_minor}-lib', 'zip', root_dir=src / config.python_lib_dir, base_dir='')

if __name__ == '__main__':
Copy link
Owner

Choose a reason for hiding this comment

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

I might want to add this back but that can be a separate patch for later

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It didn't really make sense to me anymore because the new system allows for thousands of configs (based on indygreg version numbers), instead of just a handful like before.

…ell as python version. Move build files. Unlock windows and linux build configs for arm64.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build related to the build system enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants