pmp-p / pydk

An universal Python/pip+Panda3d build framework for Pythons Everywhere ( and Everyone )
https://github.com/pmp-p/pydk
MIT License
41 stars 4 forks source link

pip modules and platform MULTIARCH identification #22

Open pmp-p opened 4 years ago

pmp-p commented 4 years ago

Following the pattern <cpuarch>-<libc-api>-<libc-abi> , values defined for sysconfig.get_platform() and sysconfig.get_config_vars('MULTIARCH'):

shell.wasm.sh : wasm_1_emscripten or wasm_1pic_emscripten TODO: iirc there are variants API/ABI wasm/asm.js flavours regarding asyncify and threading for emscripten.

shell.armeabi-v7a.sh : armv7a_19_android

shell.arm64-v8a.sh : aarch64_21_android

shell.x86.sh : i686_19_android

shell.x86_64.sh : x86_64_21_android

and also :

shell.wasi64.sh : wasm64_1_wasi or wasm64_1pic_wasi

shell.wasi32.sh : wasm32_1_wasi or wasm32_1pic_wasi

shell.asm.js.sh : asmjs_1_fastcomp

Exemple of a pip 3.9 wheel build session :

[PyDK:armeabi-v7a] /data/cross/pydk $ pip3-armeabi-v7a wheel numpy
Collecting numpy
  Using cached numpy-1.19.4.zip (7.3 MB)
Building wheels for collected packages: numpy
  Building wheel for numpy (setup.py) ... done
  Created wheel for numpy: filename=numpy-1.19.4-cp39-cp39-armv7a_19_android.whl size=13205762 sha256=98b79f11fdc6f2c30042551145d5814249f27ebc1921ac26f2bcc5d1658ffb01
  Stored in directory: /cache/pip/wheels/6f/d7/25/0fe5a4a476d4881c00f6e6914d4d40f9c42cfe334faafd79a3
Successfully built numpy
[PyDK:armeabi-v7a] /data/cross/pydk $ file numpy-1.19.4-cp39-cp39-armv7a_19_android.whl 
numpy-1.19.4-cp39-cp39-armv7a_19_android.whl: Zip archive data, at least v2.0 to extract
[PyDK:armeabi-v7a] /data/cross/pydk $ 
pmp-p commented 4 years ago

Another example using :

sysconfig.get_platform()
sysconfig.get_config_vars('INCLUDEDIR')
[PyDK:armeabi-v7a] /data/cross/pydk/testing/pygame $ pip3-armeabi-v7a wheel .
Processing /data/cross/pydk/testing/pygame
Building wheels for collected packages: pygame
  Building wheel for pygame (setup.py) ... done
  Created wheel for pygame: filename=pygame-2.0.1.dev1-cp39-cp39-armv7a_19_android.whl size=3158603 sha256=8aab801a2f7f5bb4b1441ea8ef238ab7d87a6146474bc399348293686ba9ab98
  Stored in directory: /tmp/pip-ephem-wheel-cache-2cn1i_9y/wheels/b5/14/de/55664e14fd0cccd3089431b21da9fa1d8aa6deee0833e13657
Successfully built pygame
[PyDK:armeabi-v7a] /data/cross/pydk/testing/pygame $ 
[PyDK:armeabi-v7a] /data/cross/pydk/testing/pygame $ pip3-armeabi-v7a install .
Processing /data/cross/pydk/testing/pygame
Skipping wheel build for pygame, due to binaries being disabled for it.
Installing collected packages: pygame
    Running setup.py install for pygame ... done
Successfully installed pygame-2.0.1.dev1
[PyDK:armeabi-v7a] /data/cross/pydk/testing/pygame $ 
pmp-p commented 3 years ago

is an installation of cross pip toolchain via pip (like p4a) viable ?

https://github.com/pygame/pygame/pull/2311#issuecomment-728741841

Preleminary discussion was engaged with @tshirtman on python-for-android, idea looks welcomed but time/manpower seems to lack both sides.

Meanwhile Beeware pip support seems stuck somewhere in an ungranted future. Python-Android-support issue 8 maybe.

Interesting side effect of multiarch pip shell with https://github.com/eerimoq/mys from @eerimoq is to allow transpiling + cross compiling a python subset to native code ( AOT ).

llvm-jit based python modules like pythran ( or transonic backends) not tested yet.

sidenote : pip module cross-testing on android and wasm ( not wasi ) is blocked by a 12 years old bug https://github.com/python/cpython/pull/22190 fixed in 3.11

pmp-p commented 3 years ago

see uname machine to reflect wasm architecture : https://github.com/emscripten-core/emscripten/pull/13440 <= merged !

see uname should return something more meaningful https://github.com/emscripten-core/emscripten/issues/13356

pmp-p commented 2 years ago

not sure how it would affect pip downloads but it may: No more exec from data folder on targetAPI >= Android Q ( termux termux-app 1072 )