c566f5206a
When generating a .pyc file, the original .py source file path is encoded in it. It is used for various purposes: traceback generation, .pyc file comparison with its .py source, and code inspection. By default, the source path used when invoking compileall is encoded in the .pyc file. Since we use paths relative to TARGET_DIR, we end up with paths that are only valid when relative to '/' encoded in the installed .pyc files on the target. This breaks code inspection at runtime since the original source path will be invalid unless the code is executed from '/'. Unfortunately, compileall cannot be forced to use the proper path. It was not written with cross-compilation usage in mind. Rework the script to call py_compile.compile() directly with pertinent options: - The script now has a new --strip-root argument. This argument is optional but will always be specified when compiling py files in buildroot. - All other (non-optional) arguments are folders in which all "importable" .py files will be compiled to .pyc. - Using --strip-root=$(TARGET_DIR), the future runtime path of each .py file is computed and encoded into the compiled .pyc. No need to change directory before running the script anymore. The trickery used to handle error reporting was only applicable with compileall. Since we implement our own "compileall", error reporting becomes trivial. Previously, we had a --force option to tell compileall.compiledir() to forcibly recompile files if they had changed. Now, we would have to handle it ourselves. It turns out to not be easy and would need us to delve into the format of bytecompiled files to extract metadata and compare it with the expected values, that being even dependent on the python version being used (fortunately, only two for us: python 2.7 and the latext 3.x). Still, this is deemed too complex, and byte-compiling is pretty fast, so much so that it should be eclipsed by the build duration anyway. So we just drop support for --force, and instead we always byte-compile. Signed-off-by: Julien Floret <julien.floret@6wind.com> Signed-off-by: Robin Jarry <robin.jarry@6wind.com> [yann.morin.1998@free.fr: - always byte-compile - drop --force - expand commit log to state so and explain why ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr> |
||
---|---|---|
arch | ||
board | ||
boot | ||
configs | ||
docs | ||
fs | ||
linux | ||
package | ||
support | ||
system | ||
toolchain | ||
utils | ||
.defconfig | ||
.flake8 | ||
.gitignore | ||
.gitlab-ci.yml | ||
CHANGES | ||
Config.in | ||
Config.in.legacy | ||
COPYING | ||
DEVELOPERS | ||
Makefile | ||
Makefile.legacy | ||
README |
Buildroot is a simple, efficient and easy-to-use tool to generate embedded Linux systems through cross-compilation. The documentation can be found in docs/manual. You can generate a text document with 'make manual-text' and read output/docs/manual/manual.text. Online documentation can be found at http://buildroot.org/docs.html To build and use the buildroot stuff, do the following: 1) run 'make menuconfig' 2) select the target architecture and the packages you wish to compile 3) run 'make' 4) wait while it compiles 5) find the kernel, bootloader, root filesystem, etc. in output/images You do not need to be root to build or run buildroot. Have fun! Buildroot comes with a basic configuration for a number of boards. Run 'make list-defconfigs' to view the list of provided configurations. Please feed suggestions, bug reports, insults, and bribes back to the buildroot mailing list: buildroot@buildroot.org You can also find us on #buildroot on Freenode IRC. If you would like to contribute patches, please read https://buildroot.org/manual.html#submitting-patches