| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,9 +1,11 @@ | |||
| 1 | 1 | */build/ | |
| 2 | 2 | */crosspython-static/ | |
| 3 | 3 | */crosspython-dynamic/ | |
| 4 | - */destdir | ||
| 4 | + */destdir* | ||
| 5 | 5 | */package/ | |
| 6 | 6 | */Python-*.tgz | |
| 7 | 7 | */Python-*.tar.xz | |
| 8 | 8 | */setuptools-*.zip | |
| 9 | 9 | */t/ | |
| 10 | + *.bak | ||
| 11 | + *~ | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,51 @@ | |||
| 1 | + #!/bin/bash -e | ||
| 2 | + | ||
| 3 | + # Creates a minimal Python file hierarchy at $PACKAGEDIR | ||
| 4 | + | ||
| 5 | + # Copyright (C) 2018, 2019 Sylvain Beucler | ||
| 6 | + | ||
| 7 | + # Copying and distribution of this file, with or without modification, | ||
| 8 | + # are permitted in any medium without royalty provided the copyright | ||
| 9 | + # notice and this notice are preserved. This file is offered as-is, | ||
| 10 | + # without any warranty. | ||
| 11 | + | ||
| 12 | + FILE_PACKAGER="python $(dirname $(which emcc))/tools/file_packager.py" | ||
| 13 | + | ||
| 14 | + PREFIX=${PREFIX:-$(dirname $(readlink -f $0))/destdir} | ||
| 15 | + PACKAGEDIR=${PACKAGEDIR:-$(dirname $(readlink -f $0))/package} | ||
| 16 | + OUTDIR=${OUTDIR:-.} | ||
| 17 | + CROSSPYTHON=$(dirname $(readlink -f $0))/crosspython-static/bin/python | ||
| 18 | + | ||
| 19 | + # Python home | ||
| 20 | + | ||
| 21 | + # optional lz4 compression, requires '-s LZ4=1' | ||
| 22 | + LZ4= | ||
| 23 | + if [ "$1" == "--lz4" ]; then LZ4="--lz4"; shift; fi | ||
| 24 | + | ||
| 25 | + rm -rf $PACKAGEDIR/ | ||
| 26 | + mkdir -p $PACKAGEDIR | ||
| 27 | + | ||
| 28 | + # Hard-coded modules: for 'print("hello, world.")' | ||
| 29 | + # $@: 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 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 \ | ||
| 31 | + "$@"; do | ||
| 32 | + if [ $PREFIX/lib/python2.7/$i -nt $PREFIX/lib/python2.7/${i%.py}.pyo ]; then | ||
| 33 | + (cd $PREFIX && $CROSSPYTHON -OO -m py_compile lib/python2.7/$i) | ||
| 34 | + fi | ||
| 35 | + mkdir -p $PACKAGEDIR/lib/python2.7/$(dirname $i) | ||
| 36 | + cp -au $PREFIX/lib/python2.7/${i%.py}.pyo $PACKAGEDIR/lib/python2.7/${i%.py}.pyo | ||
| 37 | + 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 | ||
| 42 | + | ||
| 43 | + # --no-heap-copy: suited for ALLOW_MEMORY_GROWTH=1 | ||
| 44 | + PACKAGEDIR_FULLPATH=$(readlink -f $PACKAGEDIR) | ||
| 45 | + ( | ||
| 46 | + cd $OUTDIR; # use relative path in xxx-data.js | ||
| 47 | + $FILE_PACKAGER \ | ||
| 48 | + pythonhome.data --js-output=pythonhome-data.js \ | ||
| 49 | + --preload $PACKAGEDIR_FULLPATH@/ \ | ||
| 50 | + --use-preload-cache --no-heap-copy $LZ4 | ||
| 51 | + ) | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,109 @@ | |||
| 1 | + Description: Fix build system for Emscripten cross-compilation. | ||
| 2 | + Also adds ac_cv_func_dlopen=yes to support dynamic linking. | ||
| 3 | + Forwarded: no | ||
| 4 | + Author: Marat Dukhan <maratek@gmail.com>, Sylvain Beucler <beuc@beuc.net> | ||
| 5 | + Origin: https://github.com/PeachPy/Python-2.7 | ||
| 6 | + Last-Update: 2020-07-27 | ||
| 7 | + | ||
| 8 | + commit 5b7a8e46d129e576ad9298055bb4e695aea29cb6 | ||
| 9 | + Author: Marat Dukhan <maratek@gmail.com> | ||
| 10 | + Date: Mon Oct 5 16:58:19 2015 -0400 | ||
| 11 | + | ||
| 12 | + Make config.sub recognize asmjs-unknown-emscripten target | ||
| 13 | + | ||
| 14 | + Index: Python-2.7.18/config.sub | ||
| 15 | + =================================================================== | ||
| 16 | + --- Python-2.7.18.orig/config.sub | ||
| 17 | + +++ Python-2.7.18/config.sub | ||
| 18 | + @@ -2,7 +2,7 @@ | ||
| 19 | + # Configuration validation subroutine script. | ||
| 20 | + # Copyright 1992-2017 Free Software Foundation, Inc. | ||
| 21 | + | ||
| 22 | + -timestamp='2017-04-02' | ||
| 23 | + +timestamp='2020-07-27' | ||
| 24 | + | ||
| 25 | + # This file is free software; you can redistribute it and/or modify it | ||
| 26 | + # under the terms of the GNU General Public License as published by | ||
| 27 | + @@ -118,7 +118,8 @@ case $maybe_os in | ||
| 28 | + linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ | ||
| 29 | + knetbsd*-gnu* | netbsd*-gnu* | netbsd*-eabi* | \ | ||
| 30 | + kopensolaris*-gnu* | cloudabi*-eabi* | \ | ||
| 31 | + - storm-chaos* | os2-emx* | rtmk-nova*) | ||
| 32 | + + storm-chaos* | os2-emx* | rtmk-nova* | \ | ||
| 33 | + + emscripten) | ||
| 34 | + os=-$maybe_os | ||
| 35 | + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` | ||
| 36 | + ;; | ||
| 37 | + @@ -253,6 +254,7 @@ case $basic_machine in | ||
| 38 | + | am33_2.0 \ | ||
| 39 | + | arc | arceb \ | ||
| 40 | + | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | ||
| 41 | + + | asmjs \ | ||
| 42 | + | avr | avr32 \ | ||
| 43 | + | ba \ | ||
| 44 | + | be32 | be64 \ | ||
| 45 | + @@ -1547,6 +1549,8 @@ case $os in | ||
| 46 | + -dicos*) | ||
| 47 | + os=-dicos | ||
| 48 | + ;; | ||
| 49 | + + -emscripten) | ||
| 50 | + + ;; | ||
| 51 | + -nacl*) | ||
| 52 | + ;; | ||
| 53 | + -ios) | ||
| 54 | + Index: Python-2.7.18/configure | ||
| 55 | + =================================================================== | ||
| 56 | + --- Python-2.7.18.orig/configure | ||
| 57 | + +++ Python-2.7.18/configure | ||
| 58 | + @@ -3287,6 +3287,9 @@ then | ||
| 59 | + *-*-cygwin*) | ||
| 60 | + ac_sys_system=Cygwin | ||
| 61 | + ;; | ||
| 62 | + + asmjs-*-*) | ||
| 63 | + + ac_sys_system=Emscripten | ||
| 64 | + + ;; | ||
| 65 | + *) | ||
| 66 | + # for now, limit cross builds to known configurations | ||
| 67 | + MACHDEP="unknown" | ||
| 68 | + @@ -3333,6 +3336,9 @@ if test "$cross_compiling" = yes; then | ||
| 69 | + *-*-cygwin*) | ||
| 70 | + _host_cpu= | ||
| 71 | + ;; | ||
| 72 | + + asmjs-*-*) | ||
| 73 | + + _host_cpu= | ||
| 74 | + + ;; | ||
| 75 | + *) | ||
| 76 | + # for now, limit cross builds to known configurations | ||
| 77 | + MACHDEP="unknown" | ||
| 78 | + Index: Python-2.7.18/configure.ac | ||
| 79 | + =================================================================== | ||
| 80 | + --- Python-2.7.18.orig/configure.ac | ||
| 81 | + +++ Python-2.7.18/configure.ac | ||
| 82 | + @@ -340,6 +340,9 @@ then | ||
| 83 | + *-*-cygwin*) | ||
| 84 | + ac_sys_system=Cygwin | ||
| 85 | + ;; | ||
| 86 | + + asmjs-*-*) | ||
| 87 | + + ac_sys_system=Emscripten | ||
| 88 | + + ;; | ||
| 89 | + *) | ||
| 90 | + # for now, limit cross builds to known configurations | ||
| 91 | + MACHDEP="unknown" | ||
| 92 | + @@ -386,6 +389,9 @@ if test "$cross_compiling" = yes; then | ||
| 93 | + *-*-cygwin*) | ||
| 94 | + _host_cpu= | ||
| 95 | + ;; | ||
| 96 | + + asmjs-*-*) | ||
| 97 | + + _host_cpu= | ||
| 98 | + + ;; | ||
| 99 | + *) | ||
| 100 | + # for now, limit cross builds to known configurations | ||
| 101 | + MACHDEP="unknown" | ||
| 102 | + Index: Python-2.7.18/config.site | ||
| 103 | + =================================================================== | ||
| 104 | + --- /dev/null | ||
| 105 | + +++ Python-2.7.18/config.site | ||
| 106 | + @@ -0,0 +1,3 @@ | ||
| 107 | + +ac_cv_file__dev_ptmx=no | ||
| 108 | + +ac_cv_file__dev_ptc=no | ||
| 109 | + +ac_cv_func_dlopen=yes | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 1 | + Description: Fix popen-related issues with Emscripten | ||
| 2 | + warning: unresolved symbol: popen [emcc] | ||
| 3 | + missing function: popen [_popen->abort at runtime] | ||
| 4 | + Forwarded: no | ||
| 5 | + Author: Sylvain Beucler <beuc@beuc.net> | ||
| 6 | + Last-Update: 2018-10-28 | ||
| 7 | + | ||
| 8 | + | ||
| 9 | + Index: Python-2.7.18/Modules/posixmodule.c | ||
| 10 | + =================================================================== | ||
| 11 | + --- Python-2.7.18.orig/Modules/posixmodule.c | ||
| 12 | + +++ Python-2.7.18/Modules/posixmodule.c | ||
| 13 | + @@ -156,8 +156,10 @@ corresponding Unix manual entries for mo | ||
| 14 | + #define HAVE_OPENDIR 1 | ||
| 15 | + #define HAVE_PIPE 1 | ||
| 16 | + #ifndef __rtems__ | ||
| 17 | + +#ifndef __EMSCRIPTEN__ | ||
| 18 | + #define HAVE_POPEN 1 | ||
| 19 | + #endif | ||
| 20 | + +#endif | ||
| 21 | + #define HAVE_SYSTEM 1 | ||
| 22 | + #define HAVE_WAIT 1 | ||
| 23 | + #define HAVE_TTYNAME 1 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,35 @@ | |||
| 1 | + Description: Support opening new browser tabs from Python/Emscripten | ||
| 2 | + Forwarded: no | ||
| 3 | + Author: Sylvain Beucler <beuc@beuc.net> | ||
| 4 | + Last-Update: 2018-10-28 | ||
| 5 | + | ||
| 6 | + Index: Python-2.7.18/Lib/webbrowser.py | ||
| 7 | + =================================================================== | ||
| 8 | + --- Python-2.7.18.orig/Lib/webbrowser.py | ||
| 9 | + +++ Python-2.7.18/Lib/webbrowser.py | ||
| 10 | + @@ -6,7 +6,7 @@ import os | ||
| 11 | + import shlex | ||
| 12 | + import sys | ||
| 13 | + import stat | ||
| 14 | + -import subprocess | ||
| 15 | + +#import subprocess | ||
| 16 | + import time | ||
| 17 | + | ||
| 18 | + __all__ = ["Error", "open", "open_new", "open_new_tab", "get", "register"] | ||
| 19 | + @@ -656,6 +656,16 @@ if sys.platform[:3] == "os2" and _iscomm | ||
| 20 | + GenericBrowser(["start", "netscape", "%s"]), -1) | ||
| 21 | + | ||
| 22 | + | ||
| 23 | + +class EmscriptenBrowser(BaseBrowser): | ||
| 24 | + + def open(self, url, new=0, autoraise=True): | ||
| 25 | + + import emscripten | ||
| 26 | + + emscripten.run_script("""try { window.open('%s', '_blank'); } catch (e) { console.log(e); }""" % url.replace("'", "%27")) | ||
| 27 | + + return True | ||
| 28 | + + | ||
| 29 | + +if sys.platform == 'emscripten': | ||
| 30 | + + register("emscripten", None, EmscriptenBrowser()) | ||
| 31 | + + | ||
| 32 | + + | ||
| 33 | + # OK, now that we know what the default preference orders for each | ||
| 34 | + # platform are, allow user to override them with the BROWSER variable. | ||
| 35 | + if "BROWSER" in os.environ: | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,3 @@ | |||
| 1 | + python2-cross_compile.patch | ||
| 2 | + python2-no_popen.patch | ||
| 3 | + python2-webbrowser.patch | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments