micropython-lib icon indicating copy to clipboard operation
micropython-lib copied to clipboard

unix-ffi: Isolate packages from python-stdlib version of `os`

Open jefferyto opened this issue 1 year ago • 4 comments

Currently, installing email.message (or any package that requires it, i.e. email.feedparser, email.parser, http.client) or glob causes the python-stdlib version of os to be installed instead of the unix-ffi version.

This adds unix-ffi versions of os-path and uu so that the unix-ffi version of os is installed in these cases.

jefferyto avatar May 30 '23 16:05 jefferyto

Thanks for the PR @jefferyto. Sorry the unix-ffi thing is a bit complicated, but I think this is a very reasonable way to solve this.

jimmo avatar May 31 '23 07:05 jimmo

A more general solution could be to persist the unix_ffi=True flag into nested require() calls, that would allow a top-level unix-ffi package to include non-unix-ffi packages and have the stream of requires flow back into unix-ffi when necessary, but I'm not sure how difficult this would be or if there is any interest in this kind of functionality.

jefferyto avatar Jun 01 '23 14:06 jefferyto

See https://github.com/micropython/micropython/pull/13620 for an alternative solution.

dpgeorge avatar Feb 08 '24 06:02 dpgeorge

A more general solution could be to persist the unix_ffi=True flag into nested require() calls

That's effectively what the above-linked PR does.

dpgeorge avatar Feb 08 '24 06:02 dpgeorge

This was solved differently as per the two comments just above. See 23df50d0ea0d64c2a4e00f3014dd4590da0a510b

dpgeorge avatar May 24 '24 08:05 dpgeorge