Skip to content

Commit bff0fcf

Browse files
committed
package-pythonhome.sh: optimize _sysconfigdata
1 parent 8878319 commit bff0fcf

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

2.7.10/package-pythonhome.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ FILE_PACKAGER="python $(dirname $(which emcc))/tools/file_packager.py"
1414
PREFIX=${PREFIX:-$(dirname $(readlink -f $0))/destdir}
1515
PACKAGEDIR=${PACKAGEDIR:-$(dirname $(readlink -f $0))/package}
1616
OUTDIR=${OUTDIR:-.}
17-
HOSTPYTHON=$(dirname $(readlink -f $0))/build/hostpython/bin/python
17+
CROSSPYTHON=$(dirname $(readlink -f $0))/crosspython-static/bin/python
1818

1919
# Python home
2020

@@ -27,14 +27,18 @@ mkdir -p $PACKAGEDIR
2727

2828
# Hard-coded modules: for 'print("hello, world.")'
2929
# $@: additional, app-specific modules
30-
for i in site.py os.py posixpath.py stat.py genericpath.py warnings.py linecache.py types.py UserDict.py _abcoll.py abc.py _weakrefset.py copy_reg.py traceback.py sysconfig.py re.py sre_compile.py sre_parse.py sre_constants.py _sysconfigdata.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py __future__.py ast.py copy.py weakref.py platform.py string.py io.py tempfile.py random.py hashlib.py struct.py dummy_thread.py collections.py keyword.py heapq.py argparse.py textwrap.py gettext.py locale.py functools.py importlib/__init__.py glob.py fnmatch.py pickle.py colorsys.py contextlib.py zipfile.py shutil.py json/__init__.py json/decoder.py json/scanner.py encodings/hex_codec.py json/encoder.py difflib.py inspect.py dis.py opcode.py tokenize.py token.py xml/__init__.py xml/etree/__init__.py xml/etree/ElementTree.py xml/etree/ElementPath.py encodings/zlib_codec.py tarfile.py urlparse.py StringIO.py encodings/latin_1.py encodings/ascii.py \
30+
for i in site.py os.py posixpath.py stat.py genericpath.py warnings.py linecache.py types.py UserDict.py _abcoll.py abc.py _weakrefset.py copy_reg.py traceback.py sysconfig.py re.py sre_compile.py sre_parse.py sre_constants.py encodings/__init__.py codecs.py encodings/aliases.py encodings/utf_8.py __future__.py ast.py copy.py weakref.py platform.py string.py io.py tempfile.py random.py hashlib.py struct.py dummy_thread.py collections.py keyword.py heapq.py argparse.py textwrap.py gettext.py locale.py functools.py importlib/__init__.py glob.py fnmatch.py pickle.py colorsys.py contextlib.py zipfile.py shutil.py json/__init__.py json/decoder.py json/scanner.py encodings/hex_codec.py json/encoder.py difflib.py inspect.py dis.py opcode.py tokenize.py token.py xml/__init__.py xml/etree/__init__.py xml/etree/ElementTree.py xml/etree/ElementPath.py encodings/zlib_codec.py tarfile.py urlparse.py StringIO.py encodings/latin_1.py encodings/ascii.py \
3131
"$@"; do
3232
if [ $PREFIX/lib/python2.7/$i -nt $PREFIX/lib/python2.7/${i%.py}.pyo ]; then
33-
(cd $PREFIX && $HOSTPYTHON -OO -m py_compile lib/python2.7/$i)
33+
(cd $PREFIX && $CROSSPYTHON -OO -m py_compile lib/python2.7/$i)
3434
fi
3535
mkdir -p $PACKAGEDIR/lib/python2.7/$(dirname $i)
3636
cp -au $PREFIX/lib/python2.7/${i%.py}.pyo $PACKAGEDIR/lib/python2.7/${i%.py}.pyo
3737
done
38+
# Large and leaks build paths, clean it:
39+
echo 'build_time_vars = {}' > $PACKAGEDIR/lib/python2.7/_sysconfigdata.py
40+
(cd $PACKAGEDIR && $CROSSPYTHON -OO -m py_compile lib/python2.7/_sysconfigdata.py)
41+
rm -f $PACKAGEDIR/lib/python2.7/_sysconfigdata.py
3842

3943
# --no-heap-copy: suited for ALLOW_MEMORY_GROWTH=1
4044
PACKAGEDIR_FULLPATH=$(readlink -f $PACKAGEDIR)

0 commit comments

Comments
 (0)