diff --git a/extras/build_web2py/README_mac.md b/extras/build_web2py/README_mac.md new file mode 100644 index 00000000..ae19e779 --- /dev/null +++ b/extras/build_web2py/README_mac.md @@ -0,0 +1,50 @@ +## MacOS binaries + +The MacOS binaries contain Python 3.7.3 (or 2.7.16) 64 bit with all the needed modules and the web2py in the specified version: + you don't need anything else to run them on MacOS! After uncompressing the zip file, you just need to click on the web2py icon inside. + +They were produced on MacOS Sierra 10.12.6 + security update 2019.001. + +## Full MacOS build recipe + +1. grab and install the official Python program: we've got version 3.7.3 or 2.7.16 (64 bit). If you've chosen python 2, change pip3 +with pip, and python3 with python in the following instructions... + +2. Open a terminal, update tools with: + +"python3 -m pip install --upgrade pip" +"pip3 install --upgrade setuptools" + + +3. install PyInstaller with: +sudo -H pip3 install pyinstaller (we've got PyInstaller-3.4 ) + +4. additional (but not required) packages: +(only for python 2: install Homebrew from https://brew.sh/#install , then 'brew install unixodbc' ) +pip3 install psycopg2-binary = psycopg2-2.7.7 +pip3 install pyodbc = pyodbc-4.0.26-cp37-cp37m +pip3 install python-ldap (on the windows message, accept to install the "Command line developer tools"). Rerun: +pip3 install python-ldap + +5. grab latest web2py source from https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip + (you need at least 2.18.3 for needed changes in gluon\admin.py). Open it to uncompress, in this example on Desktop/web2py + + +6. take the file build_web2py.py and web2py.mac.spec from this folder and place it on the Desktop/web2py folder + +7. edit the file /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/hooks/hook-_tkinter.py + and change one of its line according to https://github.com/pyinstaller/pyinstaller/pull/3830 + +8. (optional, for having a full working interactive shell) change the fake site.py module included within the PyInstaller installation + with the content of the files web2py.site_37.py or web2py.site_27.py from this folder - see comments inside these files for details + +9. open a terminal, goto Desktop/web2py and run: + +python3 build_web2py.py + +10. if everything is fine, you'll obtain web2py_macos.zip on the Desktop/web2py folder. Inside it, there is the web2py program with + both the CMD version and the APP version. + +## Gothca + +Unfortunately, the APP version is still not working - see https://github.com/pyinstaller/pyinstaller/issues/3820 . diff --git a/extras/build_web2py/README_win.md b/extras/build_web2py/README_win.md new file mode 100644 index 00000000..fe5f797b --- /dev/null +++ b/extras/build_web2py/README_win.md @@ -0,0 +1,47 @@ +## Windows binaries + +The windows binaries contain Python 64 bit version 3.7.3 or 2.7.16 with all the needed modules and the web2py in the specified version. +You don't need anything else to run them on Windows. +At least on Windows 7, if you get an error stating that "api-ms-win-crt-runtime-l1-1-0.dll is missing" you have only to install the +free and official "Visual C++ Redistributable for Visual Studio" as described later + + +## Full Windows build recipe + +1. get a clean Windows 10 (Windows 10 Professional English build 1809 64 bit, under Virtualbox in our case) +2. grab and install the official Python program: we've got version 3.7.3 or 2.7.16, 64 bit +(https://www.python.org/ftp/python/3.7.2/python-3.7.2-amd64.exe ) + select "add Python 3.7 to PATH" during its setup if Python 3. +For Python 2 you need to manually add the folders for python27 and python27\Scripts to the system path. +3. update tools with +"python -m pip install --upgrade pip" +"pip install --upgrade setuptools" +4. download and install python-win32, which is needed for web2py to work with all features enabled +(https://github.com/mhammond/pywin32/releases/download/b224/pywin32-224.win-amd64-py3.7.exe) +5. grab latest web2py source from https://mdipierro.pythonanywhere.com/examples/static/web2py_src.zip (you need at least 2.18.3 for +needed changes in gluon\admin.py). Unzip it in a dedicated folder, in this example C:\web2py - so that you have +C:\web2py\web2py.py inside) +6. install PyInstaller with: + pip install pyinstaller (we've got PyInstaller-3.4.tar.gz ) +7. download and install the free Microsoft Visual C++ Redistributable per Visual Studio 2017, 64 bit version, from + https://aka.ms/vs/15/release/vc_redist.x64.exe +8. additional (but not required) packages to work better in the Windows world: +pip install psycopg2 = psycopg2-2.7.7-cp37-cp37m-win_amd64.whl +pip install pyodbc = pyodbc-4.0.26-cp37-cp37m-win_amd64.whl +download the file python_ldap-3.1.0-cp37-cp37m-win_amd64.whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/ and install it from that +folder with the command 'pip install python_ldap-3.1.0-cp37-cp37m-win_amd64.whl' + +9. copy build_web2py.py, web2py.win.spec and web2py.win_no_console.spec from this folder to C:\web2py\ +10. (only for python 2) - due to a PyInstaller bug, you need to manually change the file gluon\rocket.py, line 26, from IS_JYTHON += platform.system() == 'Java' to IS_JYTHON = False +11. (optional, for having a full working interactive shell) change the fake site.py module included within the PyInstaller installation +with the content of the files web2py.site_37.py or web2py.site_27.py from this folder - see comments inside these files for details +12. open a CMD and go to C:\web2py. Run: + + python build_web2py.py + +If everything goes fine, you'll obtain the 64 bit binary build zipped as C:\web2py\web2py_win.zip. +If you try to run it in a 32 bit Windows system, you'll correctly get a 'web2py.exe not a valid Win32 application' error message. + +## Gothca: +- at least on Windows 7, you can get an error stating that "api-ms-win-crt-runtime-l1-1-0.dll is missing". You can easily resolve it by +installing "Visual C++ Redistributable for Visual Studio" described earlier diff --git a/extras/build_web2py/web2py.site_27.py b/extras/build_web2py/web2py.site_27.py new file mode 100644 index 00000000..0724da50 --- /dev/null +++ b/extras/build_web2py/web2py.site_27.py @@ -0,0 +1,1980 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + web2py-pyinstaller/web2py.site_27.py at master · nicozanf/web2py-pyinstaller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + +
+
+ +
    + + + + +
  • + +
    + +
    + + + Unwatch + + +
    + Notifications +
    +
    + + + + + + + +
    +
    +
    + +
    +
  • + +
  • +
    +
    + + +
    +
    + + +
    + +
  • + +
  • + + + Fork + + +
  • +
+ +

+ + /web2py-pyinstaller + + +

+ +
+ + + + + + +
+
+
+ + + + + + + Permalink + + + + +
+ + +
+ + Branch: + master + + + + + + + +
+ +
+ + Find file + + + Copy path + +
+
+ + +
+ + Find file + + + Copy path + +
+
+ + + + +
+ Fetching contributors… +
+ +
+ + Cannot retrieve contributors at this time +
+
+ + + + +
+ +
+ +
+ 202 lines (163 sloc) + + 6.03 KB +
+ +
+ +
+ Raw + Blame + History +
+ + +
+ + + + +
+ +
+
+ +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
"""
web2py.site_27.py
Source:
This is the 3.4 PyInstaller's fake site.py
(see https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/fake-modules/site.py)
with the addition of the original 2.7 cpython code (see https://github.com/python/cpython/blob/2.7/Lib/site.py )
and adapted for reducing the size of the resulting frozen code
Purpose:
having back additional commands (mainly help and quit) in the python shell
Usage:
after installing PyInstaller, rename this file to site.py and overwrite the existing PyInstaller one;
on Windows 10: C:/Python27/Lib/site-packages/PyInstaller/fake-modules/site.py
on Mac: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/fake-modules/site.py
"""
+
+
+
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2018, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+
+
"""
This is a fake 'site' module available in default Python Library.
The real 'site' does some magic to find paths to other possible
Python modules. We do not want this behaviour for frozen applications.
Fake 'site' makes PyInstaller to work with distutils and to work inside
virtualenv environment.
"""
+
# Marker to be used in our test-suite.
__pyinstaller__faked__site__module__ = True
+
# TODO test the following code stub from real 'site' module.
+
+
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = []
+
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = False
+
+
# For distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
# Issue #1699: Freezing pip requires 'site.USER_SITE' to be a 'str' not None.
USER_SITE = ''
USER_BASE = None
+
+
#
# The following has been borrowed from https://github.com/python/cpython/blob/2.7/Lib/site.py
# and adapted for reducing the size of the frozen code
#
+
import os
import sys
import __builtin__
+
def setquit():
"""Define new builtins 'quit' and 'exit'.
These are objects which make the interpreter exit when called.
The repr of each object contains a hint at how it works.
"""
if os.sep == ':':
eof = 'Cmd-Q'
elif os.sep == '\\':
eof = 'Ctrl-Z plus Return'
else:
eof = 'Ctrl-D (i.e. EOF)'
+
class Quitter(object):
def __init__(self, name):
self.name = name
def __repr__(self):
return 'Use %s() or %s to exit' % (self.name, eof)
def __call__(self, code=None):
# Shells like IDLE catch the SystemExit, but listen when their
# stdin wrapper is closed.
try:
sys.stdin.close()
except:
pass
raise SystemExit(code)
__builtin__.quit = Quitter('quit')
__builtin__.exit = Quitter('exit')
+
+
class _Printer(object):
"""interactive prompt objects for printing the license text, a list of
contributors and the copyright notice."""
+
MAXLINES = 23
+
def __init__(self, name, data, files=(), dirs=()):
self.__name = name
self.__data = data
self.__files = files
self.__dirs = dirs
self.__lines = None
+
def __setup(self):
if self.__lines:
return
data = None
for dir in self.__dirs:
for filename in self.__files:
filename = os.path.join(dir, filename)
try:
fp = file(filename, "rU")
data = fp.read()
fp.close()
break
except IOError:
pass
if data:
break
if not data:
data = self.__data
self.__lines = data.split('\n')
self.__linecnt = len(self.__lines)
+
def __repr__(self):
self.__setup()
if len(self.__lines) <= self.MAXLINES:
return "\n".join(self.__lines)
else:
return "Type %s() to see the full %s text" % ((self.__name,)*2)
+
def __call__(self):
self.__setup()
prompt = 'Hit Return for more, or q (and Return) to quit: '
lineno = 0
while 1:
try:
for i in range(lineno, lineno + self.MAXLINES):
print self.__lines[i]
except IndexError:
break
else:
lineno += self.MAXLINES
key = None
while key is None:
key = raw_input(prompt)
if key not in ('', 'q'):
key = None
if key == 'q':
break
+
def setcopyright():
"""Set 'copyright' and 'credits' in __builtin__"""
__builtin__.copyright = _Printer("copyright", sys.copyright)
__builtin__.credits = _Printer("credits", """\
Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information.""")
here = os.path.dirname(os.__file__)
__builtin__.license = _Printer(
"license", "See https://www.python.org/psf/license/",
["LICENSE.txt", "LICENSE"],
[os.path.join(here, os.pardir), here, os.curdir])
+
+
class _Helper(object):
"""Define the builtin 'help'.
This is a wrapper around pydoc.help (with a twist).
"""
+
def __repr__(self):
return "Type help() for interactive help, " \
"or help(object) for help about object."
def __call__(self, *args, **kwds):
import pydoc
return pydoc.help(*args, **kwds)
+
def sethelper():
__builtin__.help = _Helper()
+
def main():
"""Add standard site-specific directories to the module search path.
This function is called automatically when this module is imported,
unless the python interpreter was started with the -S flag.
"""
setquit()
setcopyright()
sethelper()
+
+
main()
+ + + +
+ +
+ + + +
+ + +
+ + +
+
+ + + + + +
+ +
+ +
+
+ + +
+ + + + + + +
+ + + You can’t perform that action at this time. +
+ + + + + + + + + + + + + + +
+ + + + diff --git a/extras/build_web2py/web2py.site_37.py b/extras/build_web2py/web2py.site_37.py new file mode 100644 index 00000000..be35bdea --- /dev/null +++ b/extras/build_web2py/web2py.site_37.py @@ -0,0 +1,1653 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + web2py-pyinstaller/web2py.site_37.py at master · nicozanf/web2py-pyinstaller + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Skip to content +
+ + + + + + + + + + +
+ +
+ + +
+ +
+ + + +
+
+
+ + + + + + + + + + +
+
+ +
    + + + + +
  • + +
    + +
    + + + Unwatch + + +
    + Notifications +
    +
    + + + + + + + +
    +
    +
    + +
    +
  • + +
  • +
    +
    + + +
    +
    + + +
    + +
  • + +
  • + + + Fork + + +
  • +
+ +

+ + /web2py-pyinstaller + + +

+ +
+ + + + + + +
+
+
+ + + + + + + Permalink + + + + +
+ + +
+ + Branch: + master + + + + + + + +
+ +
+ + Find file + + + Copy path + +
+
+ + +
+ + Find file + + + Copy path + +
+
+ + + + +
+ Fetching contributors… +
+ +
+ + Cannot retrieve contributors at this time +
+
+ + + + +
+ +
+ +
+ 121 lines (89 sloc) + + 3.8 KB +
+ +
+ +
+ Raw + Blame + History +
+ + +
+ + + + +
+ +
+
+ +
+
+
+ + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
"""
web2py.site_37.py
Source:
This is the 3.4 PyInstaller's fake site.py
(see https://github.com/pyinstaller/pyinstaller/blob/develop/PyInstaller/fake-modules/site.py)
with the addition of the original 3.7 cpython code (see https://github.com/python/cpython/blob/3.7/Lib/site.py )
and adapted for reducing the size of the resulting frozen code
Purpose:
having back additional commands (mainly help and quit) in the python shell
Usage:
after installing PyInstaller, rename this file to site.py and overwrite the existing PyInstaller one;
on Windows 10: C:/users/my_name/AppData/Local/Programs/Python/Python37/Lib/site-packages/PyInstaller/fake-modules/site.py
on Mac: /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/PyInstaller/fake-modules/site.py
"""
+
+
+
#-----------------------------------------------------------------------------
# Copyright (c) 2013-2018, PyInstaller Development Team.
#
# Distributed under the terms of the GNU General Public License with exception
# for distributing bootloader.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
+
+
"""
This is a fake 'site' module available in default Python Library.
The real 'site' does some magic to find paths to other possible
Python modules. We do not want this behaviour for frozen applications.
Fake 'site' makes PyInstaller to work with distutils and to work inside
virtualenv environment.
"""
+
# Marker to be used in our test-suite.
__pyinstaller__faked__site__module__ = True
+
# TODO test the following code stub from real 'site' module.
+
+
# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = []
+
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = False
+
+
# For distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
# Issue #1699: Freezing pip requires 'site.USER_SITE' to be a 'str' not None.
USER_SITE = ''
USER_BASE = None
+
+
#
# The following has been borrowed from https://github.com/python/cpython/blob/3.7/Lib/site.py
# and adapted for reducing the size of the frozen code
#
+
import os
import sys
import builtins
import _sitebuiltins
+
+
def setquit():
"""Define new builtins 'quit' and 'exit'.
These are objects which make the interpreter exit when called.
The repr of each object contains a hint at how it works.
"""
if os.sep == '\\':
eof = 'Ctrl-Z plus Return'
else:
eof = 'Ctrl-D (i.e. EOF)'
+
builtins.quit = _sitebuiltins.Quitter('quit', eof)
builtins.exit = _sitebuiltins.Quitter('exit', eof)
+
+
def setcopyright():
"""Set 'copyright' and 'credits' in builtins"""
builtins.copyright = _sitebuiltins._Printer("copyright", sys.copyright)
if sys.platform[:4] == 'java':
builtins.credits = _sitebuiltins._Printer(
"credits",
"Jython is maintained by the Jython developers (www.jython.org).")
else:
builtins.credits = _sitebuiltins._Printer("credits", """\
Thanks to CWI, CNRI, BeOpen.com, Zope Corporation and a cast of thousands
for supporting Python development. See www.python.org for more information.""")
files, dirs = [], []
builtins.license = _sitebuiltins._Printer(
"license",
"See https://www.python.org/psf/license/",
files, dirs)
+
+
def sethelper():
builtins.help = _sitebuiltins._Helper()
+
def main():
"""Add standard site-specific directories to the module search path.
This function is called automatically when this module is imported,
unless the python interpreter was started with the -S flag.
"""
setquit()
setcopyright()
sethelper()
+
+
main()
+ + + +
+ +
+ + + +
+ + +
+ + +
+
+ + + + + +
+ +
+ +
+
+ + +
+ + + + + + +
+ + + You can’t perform that action at this time. +
+ + + + + + + + + + + + + + +
+ + + +