Skip to content

Commit

Permalink
Added executable compilation for Mac and win
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabil Alikhan authored and Nabil Alikhan committed Jul 4, 2017
1 parent 56a9372 commit 30f0cf5
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file added GT_icon.icns
Binary file not shown.
Binary file added GT_icon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions build_mac.bat
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions build_win.bat
Original file line number Diff line number Diff line change
@@ -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
10 changes: 9 additions & 1 deletion grapetree/__init__.py
Original file line number Diff line number Diff line change
@@ -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
8 changes: 2 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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()
Expand All @@ -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:
Expand Down

0 comments on commit 30f0cf5

Please sign in to comment.