Title: Android: ship stdlib grp module (Termux-style getgrent stub) — needed by proot-distro in Flet container apps · Issue #45 · flet-dev/python-build · GitHub
Open Graph Title: Android: ship stdlib grp module (Termux-style getgrent stub) — needed by proot-distro in Flet container apps · Issue #45 · flet-dev/python-build
X Title: Android: ship stdlib grp module (Termux-style getgrent stub) — needed by proot-distro in Flet container apps · Issue #45 · flet-dev/python-build
Description: Request: build grp into the Android CPython (all ABIs, 3.12 + 3.13+), so import grp works in serious_python apps. Context: I maintain a Flet Android app that wraps proot-distro (Linux containers on-device; related package request: flet-d...
Open Graph Description: Request: build grp into the Android CPython (all ABIs, 3.12 + 3.13+), so import grp works in serious_python apps. Context: I maintain a Flet Android app that wraps proot-distro (Linux containers on...
X Description: Request: build grp into the Android CPython (all ABIs, 3.12 + 3.13+), so import grp works in serious_python apps. Context: I maintain a Flet Android app that wraps proot-distro (Linux containers on...
Opengraph URL: https://github.com/flet-dev/python-build/issues/45
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Android: ship stdlib grp module (Termux-style getgrent stub) — needed by proot-distro in Flet container apps","articleBody":"\n**Request:** build `grp` into the Android CPython (all ABIs, 3.12 + 3.13+), so `import grp` works in serious_python apps.\n\n**Context:** I maintain a Flet Android app that wraps [proot-distro](https://github.com/termux/proot-distro) (Linux containers on-device; related package request: flet-dev/flet#discussions/6979). `proot-distro` does `import grp` + `import pwd` unconditionally in `proot_distro/helpers/rootfs.py` and calls `pwd.getpwuid(uid).pw_name` / `grp.getgrgid(g).gr_name` when registering Android uid/gid entries into a container's `/etc/passwd`/`group`. On the Flet Android runtime (CPython 3.14) this fails: `ModuleNotFoundError: No module named 'grp'`.\n\n**Why it's missing (verified):** CPython gates the module in `configure.ac`:\n\n```\nPY_STDLIB_MOD([grp], [], [test \"$ac_cv_func_getgrent\" = \"yes\" && { test \"$ac_cv_func_getgrgid\" = \"yes\" || test \"$ac_cv_func_getgrgid_r\" = \"yes\"; }])\n```\n\nBionic only provides `getgrent`/`setgrent`/`endgrent` since **API 26** (`__INTRODUCED_IN(26)` in `grp.h`; `getgrgid_r` has been there since API 24), while `flet-dev/python-build` targets `api_level=24`. On the 3.12 legacy flow the repo additionally forces it off via `android/patches/grp.patch` (`Linux-android) py_cv_module_grp=n/a`, inherited from Chaquopy: \"we can't build the grp module, because getgrent and setgrent aren't available until API level 26\"). On 3.13+ the exclusion happens naturally at the configure gate. `Doc/library/grp.rst` documents \"not Android\"; note `pwd` is *not* Android-excluded and appears to build fine.\n\n**Precedent — Termux ships `grp`:** they hit the identical regression on their 3.12→3.13 upgrade (termux/termux-packages#28684, `ModuleNotFoundError: No module named 'grp'`) and fixed it (PR termux/termux-packages#28768) by forcing `ac_cv_func_getgrent=yes` in `packages/python/build.sh` plus an NDK header patch (`ndk-patches/30/grp.h.patch`) that replaces the API-26 declarations with inline stubs:\n\n```c\nstatic struct group* _Nullable getgrent(void) { return 0; }\nstatic void setgrent(void) {}\nstatic void endgrent(void) {}\n```\n\nResult: real `getgrgid`/`getgrnam` through Bionic (working since API 24), while `getgrall()` returns `[]`. Chaquopy, Kivy's python-for-android, and Kodi instead treat `grp` as unsupported — Termux is the working counterexample.\n\n**Ask:** adopt the Termux approach for the Android target: keep min-API 24, but ship `grp` with a `getgrent`-family fallback (build-time stub + `ac_cv_func_getgrent=yes`, or an equivalent in `Modules/grpmodule.c`) so `getgrgid`/`getgrnam` work and `getgrall()` degrades to `[]` on API 24–25. Ideally also drop/replace `android/patches/grp.patch` on the 3.12 flow accordingly.\n\nI can test a pre-release build on-device immediately (`import grp; grp.getgrgid(os.getgid())` under Android 16, arm64-v8a). Meanwhile my app ships a 20-line `sys.modules` shim for the two calls proot-distro makes, so this is a durability request, not a blocker for me.","author":{"url":"https://github.com/Nwokike","@type":"Person","name":"Nwokike"},"datePublished":"2026-10-16T15:01:00Z","url":"https://github.com/flet-dev/python-build/issues/45"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1dfdff90-eaf6-79c3-e893-9cbe285df4b9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BB96:381141:92EE8:CE994:6AFD7A7F |
| html-safe-nonce | 730a67a56215dc9e459d558bab4b28322d2765fe174c8a8aa0a422eda513b3fe |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQjk2OjM4MTE0MTo5MkVFODpDRTk5NDo2QUZEN0E3RiIsInZpc2l0b3JfaWQiOiI0NzE4ODY4MzgwNzkzMDEwODE1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 3fba00b802b461a7ab916bebdbccf004d354efef68df8758108a9f59992408a2 |
| hovercard-subject-tag | issue:5886367225 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/flet-dev/python-build/45/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ca4a2e909d00aeb3977ba10d60825e1e7bda7f71a99df73fd65525f3c8e479be/flet-dev/python-build/issues/45 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ca4a2e909d00aeb3977ba10d60825e1e7bda7f71a99df73fd65525f3c8e479be/flet-dev/python-build/issues/45 |
| og:image:alt | Request: build grp into the Android CPython (all ABIs, 3.12 + 3.13+), so import grp works in serious_python apps. Context: I maintain a Flet Android app that wraps proot-distro (Linux containers on... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | Nwokike |
| hostname | github.com |
| expected-hostname | github.com |
| None | 544ff6b59bd215c4609120f6e334dbd0b00d34fb6f8bc03a476f72256998887e |
| turbo-cache-control | no-preview |
| go-import | github.com/flet-dev/python-build git https://github.com/flet-dev/python-build.git |
| octolytics-dimension-user_id | 102273996 |
| octolytics-dimension-user_login | flet-dev |
| octolytics-dimension-repository_id | 789833008 |
| octolytics-dimension-repository_nwo | flet-dev/python-build |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 789833008 |
| octolytics-dimension-repository_network_root_nwo | flet-dev/python-build |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 71c92f8b27ec5e9aa6f6477b4e067a4727fc9edb |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width