[Buildroot] [PATCH v3 1/2] support/scripts/pycompile: fix .pyc original source file paths

Robin Jarry robin.jarry at 6wind.com
Thu Sep 10 07:53:28 UTC 2020


2020-09-10, Robin Jarry:
> +    if not force:
> +        # inspired from compileall.compile_file in the standard library
> +        try:
> +            with open(host_path + "c", "rb") as f:
> +                header = f.read(12)
> +            expect = struct.pack("<4sll", importlib.util.MAGIC_NUMBER,
> +                                 0, int(os.stat(host_path).st_mtime))
> +            if header == expect:
> +                return  # .pyc file already up to date.
> +        except OSError:
> +            pass  # .pyc file does not exist

This bit does not work with python 2. I'll submit a fix in a v4.

Sorry about the noise...

-- 
Robin


More information about the buildroot mailing list