Go to file
Robin Jarry c566f5206a support/scripts/pycompile: fix .pyc original source file paths
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>
2020-09-13 10:19:13 +02:00
arch arch/Config.in: add BR2_ARCH_NEEDS_GCC_AT_LEAST_10 2020-06-24 21:57:43 +02:00
board configs/kontron_smarc_sal28: new defconfig 2020-09-12 15:15:30 +02:00
boot boot/afboot-stm32: fix build with gcc 10 2020-09-10 20:26:27 +02:00
configs configs/kontron_smarc_sal28: new defconfig 2020-09-12 15:15:30 +02:00
docs docs/manual: Add section about contributing to maintenance branches 2020-09-09 00:38:41 +02:00
fs fs/common.mk: move down ROOTFS_REPRODUCIBLE for consistency 2020-09-04 10:50:14 +02:00
linux {linux, linux-headers}: bump 4.{4, 9, 14, 19}.x / 5.4.x series 2020-09-06 09:53:23 +02:00
package support/scripts/pycompile: fix .pyc original source file paths 2020-09-13 10:19:13 +02:00
support support/scripts/pycompile: fix .pyc original source file paths 2020-09-13 10:19:13 +02:00
system system: set default PATH according to BR2_ROOTFS_MERGED_USR 2020-08-17 00:15:05 +02:00
toolchain {linux, linux-headers}: add version 5.8 2020-09-05 22:02:16 +02:00
utils utils/scanpypi: use raw strings in re.compile/re.sub 2020-08-14 21:56:17 +02:00
.defconfig
.flake8 .flake8: fix check for 80/132 columns 2019-04-10 12:31:33 +02:00
.gitignore
.gitlab-ci.yml gitlab-ci: update the image version 2020-08-15 09:47:00 +02:00
CHANGES Update for 2020.02.6 2020-09-05 21:35:11 +02:00
Config.in Config.in: update BR2_OPTIMIZE_FAST prompt and help text 2020-07-18 16:05:01 +02:00
Config.in.legacy package/weston-imx: remove deprecated package 2020-09-12 14:25:14 +02:00
COPYING
DEVELOPERS configs/kontron_smarc_sal28: new defconfig 2020-09-12 15:15:30 +02:00
Makefile Merge branch 'next' 2020-09-02 18:14:46 +02:00
Makefile.legacy Remove BR2_DEPRECATED 2016-10-15 23:14:45 +02:00
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