FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
python/2.7.18/package-pythonhome.sh at trunk · python-emscripten/python · GitHub
python-emscripten
python
Repository navigation
Code
Issues
1
(1)
Pull requests
Actions
Security and quality
Insights
Expand file tree
Breadcrumbs
python
/
2.7.18
/
package-pythonhome.sh
Copy path
More file actions
More file actions
Latest commit
History
History
History
executable file
·
51 lines (41 loc) · 2.65 KB
Breadcrumbs
python
/
2.7.18
/
package-pythonhome.sh
Copy path
File metadata and controls
executable file
·
51 lines (41 loc) · 2.65 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
#!
/bin/bash -e
#
Creates a minimal Python file hierarchy at $PACKAGEDIR
#
Copyright (C) 2018, 2019, 2020 Sylvain Beucler
#
Copying and distribution of this file, with or without modification,
#
are permitted in any medium without royalty provided the copyright
#
notice and this notice are preserved. This file is offered as-is,
#
without any warranty.
FILE_PACKAGER=
"
python3
$(
dirname
$(
which emcc
)
)
/tools/file_packager.py
"
PREFIX=
${PREFIX
:-
$(dirname $(readlink -f
$0
))
/
destdir}
PACKAGEDIR=
${PACKAGEDIR
:-
$(dirname $(readlink -f
$0
))
/
package}
OUTDIR=
${OUTDIR
:-
.}
CROSSPYTHON=
$(
dirname
$(
readlink -f
$0
)
)
/crosspython-static/bin/python
#
Python home
#
optional lz4 compression, requires '-s LZ4=1'
LZ4=
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 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 \
"
$@
"
;
do
if
[
$PREFIX
/lib/python2.7/
$i
-nt
$PREFIX
/lib/python2.7/
${i
%
.py}
.pyo ]
;
then
(cd
$PREFIX
&&
$CROSSPYTHON
-OO -m py_compile lib/python2.7/
$i
)
fi
mkdir -p
$PACKAGEDIR
/lib/python2.7/
$(
dirname
$i
)
cp -au
$PREFIX
/lib/python2.7/
${i
%
.py}
.pyo
$PACKAGEDIR
/lib/python2.7/
${i
%
.py}
.pyo
done
#
Large and leaks build paths, clean it:
echo
'
build_time_vars = {}
'
>
$PACKAGEDIR
/lib/python2.7/_sysconfigdata.py
(cd
$PACKAGEDIR
&&
$CROSSPYTHON
-OO -m py_compile lib/python2.7/_sysconfigdata.py)
rm -f
$PACKAGEDIR
/lib/python2.7/_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
)
Back
|
FazBrowse Home
|
New Git URL