Skip to content

Commit

Permalink
unix-ffi: Remove "unix_ffi" argument from require().
Browse files Browse the repository at this point in the history
And describe how to use `add_library()` instead.

Signed-off-by: Damien George <damien@micropython.org>
  • Loading branch information
dpgeorge committed Mar 17, 2024
1 parent ffb07db commit 23df50d
Show file tree
Hide file tree
Showing 28 changed files with 66 additions and 62 deletions.
10 changes: 7 additions & 3 deletions unix-ffi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ replacement for CPython.

### Usage

To use a unix-specific library, pass `unix_ffi=True` to `require()` in your
manifest file.
To use a unix-specific library, a manifest file must add the `unix-ffi`
library to the library search path using `add_library()`:

```py
require("os", unix_ffi=True) # Use the unix-ffi version instead of python-stdlib.
add_library("unix-ffi", "$(MPY_LIB_DIR)/unix-ffi", prepend=True)
```

Prepending the `unix-ffi` library to the path will make it so that the
`unix-ffi` version of a package will be preferred if that package appears in
both `unix-ffi` and another library (eg `python-stdlib`).
2 changes: 1 addition & 1 deletion unix-ffi/_markupbase/manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
metadata(version="3.3.4")

require("re", unix_ffi=True)
require("re")

module("_markupbase.py")
4 changes: 2 additions & 2 deletions unix-ffi/email.charset/manifest.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
metadata(version="0.5.1")

require("functools")
require("email.encoders", unix_ffi=True)
require("email.errors", unix_ffi=True)
require("email.encoders")
require("email.errors")

package("email")
2 changes: 1 addition & 1 deletion unix-ffi/email.encoders/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require("base64")
require("binascii")
require("quopri")
require("re", unix_ffi=True)
require("re")
require("string")

package("email")
8 changes: 4 additions & 4 deletions unix-ffi/email.feedparser/manifest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
metadata(version="0.5.1")

require("re", unix_ffi=True)
require("email.errors", unix_ffi=True)
require("email.message", unix_ffi=True)
require("email.internal", unix_ffi=True)
require("re")
require("email.errors")
require("email.message")
require("email.internal")

package("email")
8 changes: 4 additions & 4 deletions unix-ffi/email.header/manifest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
metadata(version="0.5.2")

require("re", unix_ffi=True)
require("re")
require("binascii")
require("email.encoders", unix_ffi=True)
require("email.errors", unix_ffi=True)
require("email.charset", unix_ffi=True)
require("email.encoders")
require("email.errors")
require("email.charset")

package("email")
10 changes: 5 additions & 5 deletions unix-ffi/email.internal/manifest.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
metadata(version="0.5.1")

require("re", unix_ffi=True)
require("re")
require("base64")
require("binascii")
require("functools")
require("string")
# require("calendar") TODO
require("abc")
require("email.errors", unix_ffi=True)
require("email.header", unix_ffi=True)
require("email.charset", unix_ffi=True)
require("email.utils", unix_ffi=True)
require("email.errors")
require("email.header")
require("email.charset")
require("email.utils")

package("email")
8 changes: 4 additions & 4 deletions unix-ffi/email.message/manifest.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
metadata(version="0.5.3")

require("re", unix_ffi=True)
require("re")
require("uu")
require("base64")
require("binascii")
require("email.utils", unix_ffi=True)
require("email.errors", unix_ffi=True)
require("email.charset", unix_ffi=True)
require("email.utils")
require("email.errors")
require("email.charset")

package("email")
6 changes: 3 additions & 3 deletions unix-ffi/email.parser/manifest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
metadata(version="0.5.1")

require("warnings")
require("email.feedparser", unix_ffi=True)
require("email.message", unix_ffi=True)
require("email.internal", unix_ffi=True)
require("email.feedparser")
require("email.message")
require("email.internal")

package("email")
8 changes: 4 additions & 4 deletions unix-ffi/email.utils/manifest.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
metadata(version="3.3.4")

require("os", unix_ffi=True)
require("re", unix_ffi=True)
require("os")
require("re")
require("base64")
require("random")
require("datetime")
require("urllib.parse", unix_ffi=True)
require("urllib.parse")
require("warnings")
require("quopri")
require("email.charset", unix_ffi=True)
require("email.charset")

package("email")
2 changes: 1 addition & 1 deletion unix-ffi/fcntl/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("ffilib")

module("fcntl.py")
2 changes: 1 addition & 1 deletion unix-ffi/getopt/manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
metadata(version="3.3.4")

require("os", unix_ffi=True)
require("os")

module("getopt.py")
2 changes: 1 addition & 1 deletion unix-ffi/gettext/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Riccardo Magliocchetti.

require("ffilib", unix_ffi=True)
require("ffilib")

module("gettext.py")
4 changes: 2 additions & 2 deletions unix-ffi/glob/manifest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
metadata(version="0.5.2")

require("os", unix_ffi=True)
require("os")
require("os-path")
require("re", unix_ffi=True)
require("re")
require("fnmatch")

module("glob.py")
6 changes: 3 additions & 3 deletions unix-ffi/html.parser/manifest.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
metadata(version="3.3.4")

require("_markupbase", unix_ffi=True)
require("_markupbase")
require("warnings")
require("html.entities", unix_ffi=True)
require("re", unix_ffi=True)
require("html.entities")
require("re")

package("html")
8 changes: 4 additions & 4 deletions unix-ffi/http.client/manifest.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
metadata(version="0.5.1")

require("email.parser", unix_ffi=True)
require("email.message", unix_ffi=True)
require("socket", unix_ffi=True)
require("email.parser")
require("email.message")
require("socket")
require("collections")
require("urllib.parse", unix_ffi=True)
require("urllib.parse")
require("warnings")

package("http")
6 changes: 3 additions & 3 deletions unix-ffi/machine/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("os", unix_ffi=True)
require("signal", unix_ffi=True)
require("ffilib")
require("os")
require("signal")

package("machine")
4 changes: 2 additions & 2 deletions unix-ffi/multiprocessing/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Originally written by Paul Sokolovsky.

require("os", unix_ffi=True)
require("select", unix_ffi=True)
require("os")
require("select")
require("pickle")

module("multiprocessing.py")
2 changes: 1 addition & 1 deletion unix-ffi/os/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("ffilib")
require("errno")
require("stat")

Expand Down
2 changes: 1 addition & 1 deletion unix-ffi/pwd/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Riccardo Magliocchetti.

require("ffilib", unix_ffi=True)
require("ffilib")

module("pwd.py")
2 changes: 1 addition & 1 deletion unix-ffi/re/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("ffilib")

module("re.py")
4 changes: 2 additions & 2 deletions unix-ffi/select/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Originally written by Paul Sokolovsky.

require("os", unix_ffi=True)
require("ffilib", unix_ffi=True)
require("os")
require("ffilib")

module("select.py")
2 changes: 1 addition & 1 deletion unix-ffi/signal/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("ffilib")

module("signal.py")
2 changes: 1 addition & 1 deletion unix-ffi/sqlite3/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

# Originally written by Paul Sokolovsky.

require("ffilib", unix_ffi=True)
require("ffilib")

module("sqlite3.py")
2 changes: 1 addition & 1 deletion unix-ffi/time/manifest.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
metadata(version="0.5.0")

require("ffilib", unix_ffi=True)
require("ffilib")

module("time.py")
4 changes: 2 additions & 2 deletions unix-ffi/timeit/manifest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
metadata(version="3.3.4")

require("getopt", unix_ffi=True)
require("getopt")
require("itertools")
# require("linecache") TODO
require("time", unix_ffi=True)
require("time")
require("traceback")

module("timeit.py")
6 changes: 3 additions & 3 deletions unix-ffi/ucurses/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

# Originally written by Paul Sokolovsky.

require("os", unix_ffi=True)
require("tty", unix_ffi=True)
require("select", unix_ffi=True)
require("os")
require("tty")
require("select")

package("ucurses")
2 changes: 1 addition & 1 deletion unix-ffi/urllib.parse/manifest.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
metadata(version="0.5.2")

require("re", unix_ffi=True)
require("re")
require("collections")
require("collections-defaultdict")

Expand Down

0 comments on commit 23df50d

Please sign in to comment.