python-emscripten  Check-in [acc37a2322]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:3.8: size/perf-optimized python code
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:acc37a2322a5a916e11e2eb25e8389ad482ab2e63778cf049c1e566bc9db559d
User & Date: Beuc 2020-05-27 17:58:16
Context
2020-06-06
14:17
Fix crosspython check-in: 814dcfc8ca user: Beuc tags: trunk
2020-05-27
17:58
3.8: size/perf-optimized python code check-in: acc37a2322 user: Beuc tags: trunk
2020-05-22
11:08
Fix modules building and bump to 3.8.2 check-in: 6ca60b211b user: Beuc tags: trunk
Changes

Changes to 3.8/package-pythonhome.sh.

23
24
25
26
27
28
29

30
31
32
33
34
35
36
37


38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
if [ "$1" == "--lz4" ]; then LZ4="--lz4"; shift; fi

rm -rf $PACKAGEDIR/
mkdir -p $PACKAGEDIR

# Hard-coded modules: for 'print("hello, world.")'
# $@: additional, app-specific modules

for i in site.py os.py stat.py posixpath.py genericpath.py abc.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py io.py _collections_abc.py _sitebuiltins.py encodings/ascii.py encodings/latin_1.py \
    "$@"; do
    # TODO: no .pyo in Py3
    if [ $PREFIX/lib/python3.8/$i -nt $PREFIX/lib/python3.8/${i%.py}.pyo ]; then
	(cd $PREFIX && $CROSSPYTHON -OO -m py_compile lib/python3.8/$i)
    fi
    mkdir -p $PACKAGEDIR/lib/python3.8/$(dirname $i)
    #cp -au $PREFIX/lib/python3.8/${i%.py}.pyo $PACKAGEDIR/lib/python3.8/${i%.py}.py


    cp -au $PREFIX/lib/python3.8/${i%.py}.py $PACKAGEDIR/lib/python3.8/${i%.py}.py
done
# Large and leaks build paths, clean it:
#echo 'build_time_vars = {}' > $PACKAGEDIR/lib/python3.8/_sysconfigdata.py
#(cd $PACKAGEDIR && $CROSSPYTHON -OO -m py_compile lib/python3.8/_sysconfigdata.py)
#rm -f $PACKAGEDIR/lib/python3.8/_sysconfigdata.py

# --no-heap-copy: suited for ALLOW_MEMORY_GROWTH=1
PACKAGEDIR_FULLPATH=$(readlink -f $PACKAGEDIR)
(
    cd $OUTDIR;  # use relative path in xxx-data.js
    $FILE_PACKAGER \
	pythonhome.data --js-output=pythonhome-data.js \
	--preload $PACKAGEDIR_FULLPATH@/ \
	--use-preload-cache --no-heap-copy $LZ4
)







>


<
<
<
<
|
<
>
>
|


|












23
24
25
26
27
28
29
30
31
32




33

34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
if [ "$1" == "--lz4" ]; then LZ4="--lz4"; shift; fi

rm -rf $PACKAGEDIR/
mkdir -p $PACKAGEDIR

# Hard-coded modules: for 'print("hello, world.")'
# $@: additional, app-specific modules
(cd $PREFIX/lib/python3.8/ && $CROSSPYTHON -OO -m compileall .) >/dev/null || true
for i in site.py os.py stat.py posixpath.py genericpath.py abc.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py io.py _collections_abc.py _sitebuiltins.py encodings/ascii.py encodings/latin_1.py \
    "$@"; do




    mkdir -p $PACKAGEDIR/lib/python3.8/$(dirname $i)/__pycache__

    # Install to legacy .pyc location for size-efficient source-less distribution
    cp -au $PREFIX/lib/python3.8/$(dirname $i)/__pycache__/$(basename ${i%.py}.cpython-38.opt-2.pyc) \
       $PACKAGEDIR/lib/python3.8/${i%.py}.pyc
done
# Large and leaks build paths, clean it:
#echo 'build_time_vars = {}' > $PACKAGEDIR/lib/python3.8/lib-dynload/_sysconfigdata__linux_x86_64-linux-gnu.py
#(cd $PACKAGEDIR && $CROSSPYTHON -OO -m py_compile lib/python3.8/_sysconfigdata.py)
#rm -f $PACKAGEDIR/lib/python3.8/_sysconfigdata.py

# --no-heap-copy: suited for ALLOW_MEMORY_GROWTH=1
PACKAGEDIR_FULLPATH=$(readlink -f $PACKAGEDIR)
(
    cd $OUTDIR;  # use relative path in xxx-data.js
    $FILE_PACKAGER \
	pythonhome.data --js-output=pythonhome-data.js \
	--preload $PACKAGEDIR_FULLPATH@/ \
	--use-preload-cache --no-heap-copy $LZ4
)