[go: up one dir, main page]

Skip to content

Commit

Permalink
added ./build.sh pythonmul2.7 (for a small Python 2.7 interpreter for…
Browse files Browse the repository at this point in the history
… Liigboot); pythonmul2.7-static is 1574095 bytes on Linux
  • Loading branch information
Peter Szabo committed Jan 9, 2018
1 parent 05c4d8c commit 5003995
Show file tree
Hide file tree
Showing 5 changed files with 3,085 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ blog post: http://ptspts.blogspot.com/2011/06/python-32-binaries-released-in.htm
blog post: http://ptspts.blogspot.com/2014/06/whats-difference-between-staticpython.html
blog post: http://ptspts.blogspot.com/2016/02/micropython-for-linux-i386-statically.html

Send donations to the author of staticpython:
Send donations to the author of StaticPython:
https://flattr.com/submit/auto?user_id=pts&url=https://github.com/pts/staticpython

__END__
27 changes: 26 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,15 @@ for ARG in "$@"; do
IS_PY3=
IS_MU=1
USE_SSL=
elif test "$ARG" = pythonmul || test "$ARG" = pythonmul2.7; then
# Minimalistic Python for Liigboot.
TARGET=pythonmul2.7-static
PYTHONTBZ2=Python-2.7.12.tar.xz
IS_CO=
IS_XX=
IS_PY3=
IS_MU=2
USE_SSL=
elif test "$ARG" = python3.2; then
TARGET=python3.2-static
PYTHONTBZ2=Python-3.2.tar.bz2
Expand Down Expand Up @@ -184,7 +193,7 @@ if test -z "$STEPS"; then
# Don't include betry here.
# Please note that fixsetup appears multiple times here. This is intentional,
# to get Modules/Setup right.
STEPS="initbuilddir initdeps buildlibssl buildlibevent2 buildlibtc configure fixsemaphore patchsetup fixsetup patchimport patchgetpath patchsqlite patchssl patchlocale fixsetup makeminipython extractpyrex patchsyncless patchgevent patchgeventmysql patchmsgpack patchpythontokyocabinet patchpythonlmdb patchconcurrence patchpycrypto patchaloaes fixsetup makepython buildpythonlibzip buildtarget"
STEPS="initbuilddir initdeps buildlibssl buildlibevent2 buildlibtc configure fixsemaphore patchsetup fixsetup patchimport patchgetpath patchsqlite patchmu patchssl patchlocale fixsetup makeminipython extractpyrex patchsyncless patchgevent patchgeventmysql patchmsgpack patchpythontokyocabinet patchpythonlmdb patchconcurrence patchpycrypto patchaloaes fixsetup makepython buildpythonlibzip buildtarget"
fi

INSTS="$INSTS_BASE"
Expand Down Expand Up @@ -660,6 +669,16 @@ enable_module() {
perl -0777 -pi -e 's@^#$ENV{CEXT_MODNAME} @$ENV{CEXT_MODNAME} @mg' Modules/Setup || return "$?"
}

patchmu() {
test "$USE_MU" != 2 || return 0
( cd "$BUILDDIR" || return "$?"
enable_module array || return "$?"
enable_module cStringIO || return "$?"
enable_module select || return "$?"
enable_module fcntl || return "$?"
) || return "$?"
}

patchssl() {
test "$USE_SSL" || return 0
( cd "$BUILDDIR" || return "$?"
Expand Down Expand Up @@ -1040,6 +1059,12 @@ buildpythonlibzip() {

if test "$IS_MU"; then
: >xlib/site.py || return "$?"
if test "$IS_MU" = 2; then
cp Lib/traceback.py xlib/traceback.py || return "$?"
cp ../mini_zipfile.py xlib/zipfile.py || return "$?"
cp ../mini_pipes.py xlib/pipes.py || return "$?"
cp ../mini_subprocess.py xlib/subprocess.py || return "$?"
fi
elif test "$IS_PY3"; then
cp ../site.3.2.py xlib/site.py || return "$?"
# This is to make `import socket; socket.gethostbyname('www.google.com')
Expand Down
17 changes: 17 additions & 0 deletions mini_pipes.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""pipes module for StaticPython."""

# Safe unquoted
_safechars = frozenset('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@%-+=:,./')

def quote(file):
"""Return a shell-escaped version of the file string."""
for c in file:
if c not in _safechars:
break
else:
if not file:
return "''"
return file
# use single quotes, and put single quotes into double quotes
# the string $'b is then quoted as '$'"'"'b'
return "'" + file.replace("'", "'\"'\"'") + "'"
Loading

0 comments on commit 5003995

Please sign in to comment.