indygreg / python-build-standalone

Produce redistributable builds of Python
Mozilla Public License 2.0
2.13k stars 133 forks source link

Build time normalization of build paths for portable builds #347

Closed tysonclugg closed 1 month ago

tysonclugg commented 1 month ago

As per the Behaviour Quirks documentation:

If there is a build time normalization that you think should be performed to make distributions more portable, please file a GitHub issue.

My suggestion: Look at what conda build does, and figure out which of the conda build strategies are applicable here.

As per https://docs.conda.io/projects/conda-build/en/stable/resources/make-relocatable.html:

The registered files will have their build prefix replaced with the install prefix at install time. This works by padding the install prefix with null terminators, such that the length of the binary file remains the same. The build prefix must therefore be long enough to accommodate any reasonable installation prefix. On macOS and Linux, conda-build pads the build prefix to 255 characters by appending _placeholds to the end of the build directory name.

Adopting something akin to the above, we could pad out the build path, then dynamically replace the build prefix at runtime (instead of during installation). Thoughts?

zanieb commented 1 month ago

Which paths are you thinking we'd patch? I don't think the tools in the build prefix are usually available during runtime.

tysonclugg commented 1 month ago

Which paths are you thinking we'd patch? I don't think the tools in the build prefix are usually available during runtime.

It really depends on the documented use case for each build path. Re-reading that part of the docs, I've realised that the fundamentals of what new path values would be patched in is the more pressing part of the equation, not the mechanics of how the patching might occur.

My suggestions don't help on the pressing matters, I'm closing this issue. Thanks for the response though. :-)