diff --git a/.gitignore b/.gitignore index 8d0f37d..b06ee18 100644 --- a/.gitignore +++ b/.gitignore @@ -30,6 +30,8 @@ wheels/ # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec +build/ +dist/ # Installer logs pip-log.txt diff --git a/GT_icon.icns b/GT_icon.icns new file mode 100644 index 0000000..5c90bbb Binary files /dev/null and b/GT_icon.icns differ diff --git a/GT_icon.ico b/GT_icon.ico new file mode 100644 index 0000000..664544f Binary files /dev/null and b/GT_icon.ico differ diff --git a/build_mac.bat b/build_mac.bat new file mode 100644 index 0000000..cee9e9d --- /dev/null +++ b/build_mac.bat @@ -0,0 +1 @@ +pyinstaller -n GrapeTree_mac --onefile --icon=GT_icon.icns --add-binary binaries/edmonds-osx;binaries/ --add-binary binaries/fastme-2.1.5-osx;binaries/ --add-data grapetree/templates/;grapetree/templates/ main.py \ No newline at end of file diff --git a/build_win.bat b/build_win.bat new file mode 100644 index 0000000..6995e6d --- /dev/null +++ b/build_win.bat @@ -0,0 +1 @@ +pyinstaller -n GrapeTree_win --onefile --icon=GT_icon.ico --add-binary binaries/edmonds.exe;binaries/ --add-binary binaries/fastme.exe;binaries/ --add-data grapetree/templates/;grapetree/templates/ main.py \ No newline at end of file diff --git a/grapetree/__init__.py b/grapetree/__init__.py index 49a8597..ce825e1 100644 --- a/grapetree/__init__.py +++ b/grapetree/__init__.py @@ -1,7 +1,15 @@ from flask import Flask import config +import sys +import os + +if getattr(sys, 'frozen', False): + template_folder = os.path.join(sys._MEIPASS, 'grapetree','templates') + static_folder = os.path.join(sys._MEIPASS, 'static') + app = Flask(__name__, template_folder=template_folder, static_folder=static_folder) +else: + app = Flask(__name__, static_folder='../static') -app = Flask(__name__, static_folder='../static') app.config.from_object(config) from grapetree import views diff --git a/main.py b/main.py index f138360..67d26fd 100644 --- a/main.py +++ b/main.py @@ -25,9 +25,10 @@ from grapetree import app import shutil import traceback -import time +import time import argparse import os +import sys __licence__ = 'GPLv3' __author__ = 'Zhemin Zhou, Martin Sergeant, Nabil-Fareed Alikhan & Mark Achtman' @@ -46,10 +47,6 @@ def _open_browser(): thread.start() -def install_static(): - shutil.copyfile('MSTree_holder.html', - 'grapetree/templates/MSTree_launch.html') - def main() : try: start_time = time.time() @@ -64,7 +61,6 @@ def main() : args = parser.parse_args() if args.verbose: print "Executing @ " + time.asctime() - install_static() open_browser(app.config.get('PORT')) app.run(port=app.config.get('PORT')) if args.verbose: