[Buildroot] [PATCH] package/micropython: make use of recent micropython-lib

Abilio Marques abiliojr at gmail.com
Sun Jan 28 20:56:41 UTC 2024


Hi Yann, Chris,

The micropython project does not attempt to perform any kind of
bootstrapping during its build process. It relies on cpython for building,
testing, and also for host tools (mostly used with microcontrollers). So
for building host-micropython, we would still need cpython. For example,
the tools used for processing manifest files (tools/makemanifest.py,
tools/manifestfile.py) are definitely not micropython compatible, at least
not without the libraries I'm actually trying to collect ;). Another hint,
the scripts are crowned with a python3 shebang.

If we want to do this using micropython code, it also requires
re-implementing a lot of the functionality I'm currently borrowing from
manifestfile.py . In my mind, that also means a lot more chances of
requiring maintenance it in case the upstream changes the way they do
things.

As far as I know, to generate the mpy files, only 'mpy-cross' is needed.
During the target build process, this is built first (but runs on host). It
will be used to freeze modules within the micropython binary (currently
asyncio is one example). Internally, it makes use of the same
"manifestfile.py" I'm borrowing from. Creating a manifest is the route I
plan to use to add support for freezing packages within the binary. The
problem is, you still need to collect the list of all the packages
available in the micropython-lib repo.

To avoid the import trick, I could also:
- Add the path to micropython/tools into the PYTHONPATH at the time of
calling the script.
- Copy my script into the tools directory and run it from there during
build.

Base on all of the above, I fail to see positive benefits of writing this
script so it runs in micropython. Could you please indicate what advantages
do you see?

Thanks for all your comments, they make for great improvements, so I will
update the patch. This is my first time using git send-mail, and I wouldn't
know how to make the updated version part of this chain. Do you have any
suggestions?

Kind regards,
Abilio Marques


On Sun, Jan 28, 2024 at 12:09 PM Yann E. MORIN <yann.morin.1998 at free.fr>
wrote:

> Chris, All,
>
> On 2024-01-29 07:58 +1300, Chris Packham spake thusly:
> > On Mon, 29 Jan 2024, 7:30 am Abilio Marques, <[1]abiliojr at gmail.com>
> wrote:
> [--SNIP--]
> >     This commit also ensures that the libraries in micropython-lib will
> >     be updated together with newer versions of micropython.
> [--SNIP--]
> > One thought I had was to build micropython as a host package and use
> that to
> > install the libs into the target rootfs.
>
> Yes, this is also my opinion: use host-micropython, if possible.
>
> I see that micropython already depends on host-python3, though. Would
> host-micropython be sufficient in lieu of host-python3, to build target
> micropython?
>
> And would host-python3 be needed to build host-micropython? Or can we
> get along with just the system python3? If we can use the system pytho,
> then we can make the dependency on BR2_PYTHON3_HOST_DEPENDENCY rather
> than hard-code host-python3.
>
> Regards,
> Yann E. MORIN.
>
> --
>
> .-----------------.--------------------.------------------.--------------------.
> |  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics'
> conspiracy: |
> | +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___
>      |
> | +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is
> no  |
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v
>  conspiracy.  |
>
> '------------------------------^-------^------------------^--------------------'
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.buildroot.org/pipermail/buildroot/attachments/20240128/487b0085/attachment-0001.html>


More information about the buildroot mailing list