Skip to content

Commit a3ac71e

Browse files
committed
fix for 3.12 tiny variant
1 parent 8c2dfa0 commit a3ac71e

File tree

7 files changed

+77
-134
lines changed

7 files changed

+77
-134
lines changed

README.md

+3-10
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Cross-platform: currently builds 'natively' on macOS (`x86_64` or `arm64`) and W
66

77
repo - <https://github.com/shakfu/py-js>
88

9-
[![py-js test](./media/screenshot.png)](patchers/py_test_standalone.maxpat)
9+
[![py-js py.maxhelp](./media/py-maxhelp.png)](patchers/py_test_anything.maxpat)
1010

1111
## Preface
1212

@@ -154,7 +154,7 @@ py max external
154154
right outlet : bang on success
155155
```
156156

157-
[![py-js test_py](./media/test_py.png)](patchers/py_test_anything.maxpat)
157+
158158

159159
### `pyjs` external
160160

@@ -283,7 +283,7 @@ idx | command | type | format | py size | pyjs size
283283
4 | `make shared-tiny-ext` | shared | external | 6.7 | 6.2 [2]
284284
5 | `make framework-pkg` | framework | package | 22.8 | 22.8 [3]
285285
286-
[2] These 'tiny' variants are intended to be the smallest possible portable pyjs externals. Note that the static and shared tiny variants don't currently work on python3.12 (for a still undiscovered reason). If you need the smallest builds, use as a lower python version such as `make shared-tiny-ext PYTHON_VERSION=3.11.9`. Otherwise, in this table, size figures are for python 3.10.x but for python 3.11.4 they increase to 8.5 MB and 8.1 respectively. Generally, external size increases with each new python version as features are added, but this is also somewhat mitigated by the removal of deprecated builtin packages and extensions. If you want to achieve the theoreticla minimal size for the `py` and `pyjs` externals, use python 3.8.x and/or a tiny variant (with a more recent version). Another option, if you need circa 1 MB size for a self-contained external, look at the `pktpy` subproject in this repo.
286+
[2] In this table, size figures are for python 3.10.x but for python 3.11.4 they increase to 8.5 MB and 8.1 respectively. Generally, external size increases with each new python version as features are added, but this is also somewhat mitigated by the removal of deprecated builtin packages and extensions. If you want to achieve the theoreticla minimal size for the `py` and `pyjs` externals, use python 3.8.x and/or a tiny variant (with a more recent version). Another option, if you need circa 1 MB size for a self-contained external, look at the `pktpy` subproject in this repo.
287287
288288
[3] Size, in this case, is not the individual external but the uncompressed size of the package which includes patches, help files and **both** externals. This can also vary by python version used to compile the external.
289289
@@ -729,13 +729,6 @@ make framework-pkg | framework | 16.8 | package | yes | yes
729729
730730
- *isolated*: if yes, then different external types can run concurrently without issue
731731
732-
#### Python Version Compatibility
733-
734-
![py-js testing](./media/python_compatibility.png)
735-
736-
[1] Homebrew only tested on current relase (3.9.10), other versions are expected to work without issues.
737-
738-
[2] Relocatable python can select its own version of python (Only tested with python 3.9.10, other versions should work without issues)
739732
740733
#### Packages vs Self-contained Externals
741734

media/py-maxhelp.png

304 KB
Loading

media/python_compatibility.png

-57.6 KB
Binary file not shown.

media/screenshot.png

-78.5 KB
Binary file not shown.

media/test_py.png

-207 KB
Binary file not shown.

source/projects/py/builder/core.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -1670,7 +1670,6 @@ class TinyStaticPythonBuilder(StaticPythonBuilder):
16701670
"""builds python in a static format."""
16711671

16721672
setup_local = "setup-static-min6.0.local"
1673-
# setup_local = "setup-static-min6.local"
16741673

16751674
def remove_encodings(self):
16761675
"""remove all uneeded encodings"""
@@ -1726,8 +1725,8 @@ def build(self):
17261725

17271726
self.configure(
17281727
# "enable_ipv6",
1729-
"enable_optimizations",
1730-
"with_lto",
1728+
# "enable_optimizations",
1729+
# "with_lto",
17311730
"without_doc_strings",
17321731
"without_ensurepip",
17331732
"disable_test_modules",
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,114 @@
1-
# This is derivative of min5
2-
# -------------------------------------------------------------------------------
3-
# VARS
4-
1+
# -*- makefile -*-
52
DESTLIB=$(LIBDEST)
63
MACHDESTLIB=$(BINLIBDEST)
74
DESTPATH=
85
SITEPATH=
96
TESTPATH=
107
COREPYTHONPATH=$(DESTPATH)$(SITEPATH)$(TESTPATH)
118
PYTHONPATH=$(COREPYTHONPATH)
9+
OPENSSL=$(srcdir)/../../lib/openssl
10+
BZIP2=$(srcdir)/../../lib/bzip2
11+
LZMA=$(srcdir)/../../lib/xz
1212

13-
# -------------------------------------------------------------------------------
14-
# CORE STATIC (don't modify)
13+
# core
1514

16-
posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c
17-
errno errnomodule.c
18-
pwd pwdmodule.c
19-
20-
_sre _sre/sre.c -DPy_BUILD_CORE_BUILTIN
15+
_abc _abc.c
2116
_codecs _codecsmodule.c
22-
_weakref _weakref.c
17+
_collections _collectionsmodule.c
2318
_functools -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _functoolsmodule.c
19+
_io _io/_iomodule.c _io/iobase.c _io/fileio.c _io/bytesio.c _io/bufferedio.c _io/textio.c _io/stringio.c
20+
_locale -DPy_BUILD_CORE_BUILTIN _localemodule.c
2421
_operator _operator.c
25-
_collections _collectionsmodule.c
26-
_abc _abc.c
27-
itertools itertoolsmodule.c
28-
atexit atexitmodule.c
2922
_signal -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal signalmodule.c
23+
_sre _sre/sre.c -DPy_BUILD_CORE_BUILTIN
3024
_stat _stat.c
31-
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c
25+
_symtable symtablemodule.c
3226
_thread -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal _threadmodule.c
33-
34-
_locale -DPy_BUILD_CORE_BUILTIN _localemodule.c
35-
36-
_io -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal -I$(srcdir)/Modules/_io \
37-
_io/_iomodule.c \
38-
_io/iobase.c \
39-
_io/fileio.c \
40-
_io/bytesio.c \
41-
_io/bufferedio.c \
42-
_io/textio.c \
43-
_io/stringio.c
44-
45-
faulthandler faulthandler.c
4627
_tracemalloc _tracemalloc.c
47-
48-
# -------------------------------------------------------------------------------
49-
# OPTIONAL STATIC (can be static or dynamic)
50-
51-
_symtable symtablemodule.c
28+
_weakref _weakref.c
29+
atexit atexitmodule.c
30+
errno errnomodule.c
31+
faulthandler faulthandler.c
32+
itertools itertoolsmodule.c
33+
posix -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal posixmodule.c
34+
pwd pwdmodule.c
35+
time -DPy_BUILD_CORE_BUILTIN -I$(srcdir)/Include/internal timemodule.c
5236

5337
*static*
5438

55-
#readline readline.c -lreadline -ltermcap
56-
57-
array arraymodule.c
58-
cmath cmathmodule.c
59-
math mathmodule.c
39+
_asyncio _asynciomodule.c
40+
_bisect _bisectmodule.c
41+
_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
42+
_bz2 _bz2module.c -I$(BZIP2)/include -L$(BZIP2)/lib $(BZIP2)/lib/libbz2.a
6043
_contextvars _contextvarsmodule.c
61-
_struct _struct.c
62-
_weakref _weakref.c
63-
#_testcapi _testcapimodule.c
64-
#_testinternalcapi _testinternalcapi.c -I$(srcdir)/Include/internal -DPy_BUILD_CORE_MODULE
65-
_random _randommodule.c -DPy_BUILD_CORE_MODULE
66-
#_zoneinfo _zoneinfo.c
67-
#_elementtree -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI _elementtree.c
68-
_pickle _pickle.c
44+
_csv _csv.c
6945
_datetime _datetimemodule.c
70-
_bisect _bisectmodule.c
46+
_elementtree _elementtree.c
7147
_heapq _heapqmodule.c
72-
_asyncio _asynciomodule.c
73-
#_json -I$(srcdir)/Include/internal -DPy_BUILD_CORE_BUILTIN _json.c
74-
_statistics _statisticsmodule.c
75-
76-
#unicodedata unicodedata.c
77-
78-
_uuid _uuidmodule.c
79-
_opcode _opcode.c
48+
_json _json.c
49+
_lsprof _lsprof.c rotatingtree.c
50+
_lzma _lzmamodule.c -I$(LZMA)/include -L$(LZMA)/lib $(LZMA)/lib/liblzma.a
51+
_md5 md5module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_MD5.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
52+
_multibytecodec cjkcodecs/multibytecodec.c
8053
_multiprocessing _multiprocessing/multiprocessing.c _multiprocessing/semaphore.c
54+
_opcode _opcode.c
55+
_pickle _pickle.c
8156
_posixshmem _multiprocessing/posixshmem.c
82-
83-
84-
fcntl fcntlmodule.c
85-
#spwd spwdmodule.c
86-
grp grpmodule.c
87-
select selectmodule.c
88-
89-
#mmap mmapmodule.c
90-
91-
#_csv _csv.c
92-
9357
_posixsubprocess _posixsubprocess.c
94-
#_blake2 _blake2/blake2module.c _blake2/blake2b_impl.c _blake2/blake2s_impl.c
95-
binascii binascii.c
96-
9758
_queue _queuemodule.c
98-
_md5 md5module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_MD5.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
59+
_random _randommodule.c
60+
#_scproxy _scproxy.c
9961
_sha1 sha1module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_SHA1.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
100-
_sha2 sha2module.c -I$(srcdir)/Modules/_hacl/include Modules/_hacl/libHacl_Hash_SHA2.a
62+
_sha2 sha2module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_SHA2.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
10163
_sha3 sha3module.c -I$(srcdir)/Modules/_hacl/include _hacl/Hacl_Hash_SHA3.c -D_BSD_SOURCE -D_DEFAULT_SOURCE
10264
_socket socketmodule.c
103-
104-
_lsprof _lsprof.o rotatingtree.c
105-
106-
#pyexpat expat/xmlparse.c \
107-
# expat/xmlrole.c \
108-
# expat/xmltok.c \
109-
# pyexpat.c \
110-
# -I$(srcdir)/Modules/expat \
111-
# -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI -DXML_DEV_URANDOM
112-
113-
zlib zlibmodule.c -I$(prefix)/include -lz
114-
65+
#_sqlite3 _sqlite/blob.c _sqlite/connection.c _sqlite/cursor.c _sqlite/microprotocols.c _sqlite/module.c _sqlite/prepare_protocol.c _sqlite/row.c _sqlite/statement.c _sqlite/util.c
66+
_statistics _statisticsmodule.c
67+
_struct _struct.c
11568
_typing _typingmodule.c
116-
117-
118-
# -------------------------------------------------------------------------------
119-
# DISABLED
69+
_uuid _uuidmodule.c
70+
_zoneinfo _zoneinfo.c
71+
array arraymodule.c
72+
binascii binascii.c
73+
cmath cmathmodule.c
74+
fcntl fcntlmodule.c
75+
grp grpmodule.c
76+
math mathmodule.c
77+
mmap mmapmodule.c
78+
pyexpat expat/xmlparse.c expat/xmlrole.c expat/xmltok.c pyexpat.c -I$(srcdir)/Modules/expat -DHAVE_EXPAT_CONFIG_H -DUSE_PYEXPAT_CAPI -DXML_DEV_URANDOM
79+
#readline readline.c -lreadline -ltermcap
80+
select selectmodule.c
81+
unicodedata unicodedata.c
82+
zlib zlibmodule.c -lz
12083

12184
*disabled*
12285

123-
124-
_ssl _ssl.c -I$(srcdir)/../../lib/openssl/include -L$(srcdir)/../../lib/openssl/lib -lssl -lcrypto -DUSE_SSL
125-
126-
_hashlib _hashopenssl.c -I$(srcdir)/../../lib/openssl/include -L$(srcdir)/../../lib/openssl/lib -lssl -lcrypto -DUSE_SSL
127-
86+
_codecs_cn
87+
_codecs_hk
88+
_codecs_iso2022
89+
_codecs_jp
90+
_codecs_kr
91+
_codecs_tw
12892
_crypt
129-
130-
_decimal
131-
93+
_ctypes
94+
_curses
95+
_curses_panel
13296
_dbm
133-
_gdbm
97+
_decimal
98+
_hashlib
99+
_scproxy
100+
_sqlite3
101+
_ssl
102+
_tkinter
103+
_xxinterpchannels
104+
_xxsubinterpreters
134105
audioop
135-
mmap
136106
nis
107+
ossaudiodev
137108
resource
109+
spwd
138110
syslog
139111
termios
140-
141-
_ctypes
142-
_tkinter
143-
_curses
144-
_curses_panel
145-
146112
xxlimited
147-
xxsubtype
148113
xxlimited_35
149-
_xxsubinterpreters
150-
151-
_multibytecodec
152-
_codecs_cn
153-
_codecs_hk
154-
_codecs_iso2022
155-
_codecs_jp
156-
_codecs_kr
157-
_codecs_tw
158-
159-
_scproxy
160-
_bz2
161-
_lzma
162-
_sqlite3
163-
readline
114+
# end

0 commit comments

Comments
 (0)