Skip to content

Commit

Permalink
Prepare Windows build with PyInstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
gVirtu committed Jun 3, 2018
1 parent 58bd9a3 commit 11a966c
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
14 changes: 11 additions & 3 deletions v5-unity/bottle_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,16 @@
import tupy.Interpreter
import os
import sys
import colorama

colorama.init()

BaseRequest.MEMFILE_MAX = 1024 * 1024
sys.setrecursionlimit(2000) # !!

@route('/')
def home():
response = static_file("index.html", root='.')
response = static_file("index.html", root='www')
response.set_header("Cache-Control", "public, max-age=1")
return response

Expand All @@ -42,7 +45,7 @@ def dummy_ok(name=None):

@route('/<filepath:path>')
def index(filepath):
response = static_file(filepath, root='.')
response = static_file(filepath, root='www')
response.set_header("Cache-Control", "public, max-age=1")
return response

Expand Down Expand Up @@ -80,4 +83,9 @@ def error_route(code):
redirect('/index.html', 303)

if __name__ == "__main__":
run(host='0.0.0.0', port=os.getenv('PORT', 8003), reloader=True)
if ('BOTTLE_CHILD' in os.environ):
print(colorama.Fore.RESET + colorama.Style.BRIGHT + "Bem-vindo ao servidor local do TuPy Online!")
print("A ferramenta ficará disponível no seu endereço local na porta 8003 enquanto esta janela estiver aberta.")
print("")
print(colorama.Fore.CYAN + "Para acessar, basta visitar http://localhost:8003 em seu navegador.")
run(host='0.0.0.0', port=os.getenv('PORT', 8003), reloader=True, quiet=True)
46 changes: 46 additions & 0 deletions v5-unity/bottle_server.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# -*- mode: python -*-

block_cipher = None

bundled_files = [
('build\\visualize.bundle.js', 'www\\build'),
('css', 'www\\css'),
('example-code', 'www\\example-code'),
('favicons', 'www\\favicons'),
('fonts', 'www\\fonts'),
('js', 'www\\js'),
('tupy', 'www\\tupy'),
('tupy-reference', 'www\\tupy-reference'),
('favicon.ico', 'www'),
('index.html', 'www')
]

a = Analysis(['bottle_server.py'],
pathex=['.'],
binaries=[],
datas=bundled_files,
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher)
pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)
exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='TuPy',
debug=False,
strip=False,
upx=True,
console=True,
icon='favicon.ico' )
coll = COLLECT(exe,
a.binaries,
a.zipfiles,
a.datas,
strip=False,
upx=True,
name='bottle_server')
Binary file added v5-unity/pyinstall.bat
Binary file not shown.

0 comments on commit 11a966c

Please sign in to comment.