Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
PyInstaller
Browse files Browse the repository at this point in the history
  • Loading branch information
tweirtx committed May 4, 2019
1 parent 6e031fa commit 3b3ee89
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 19 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
.idea/
config.json
timetracker.db
venv/
venv/
build/
dist/
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env bash
rm -rf build dist
pyinstaller -F timetracker.spec
dist/timetracker
42 changes: 42 additions & 0 deletions timetracker.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# -*- mode: python -*-

block_cipher = None


a = Analysis(['timetracker/__main__.py'],
pathex=['/home/travis/PycharmProjects/timetracker'],
binaries=[],
datas=[],
hiddenimports=[
'sqlalchemy',
'flask',
'flask_table',
'psycopg2-binary',
'pymysql',
'mysqlclient',
'.'
],
hookspath=[],
runtime_hooks=[],
excludes=[],
win_no_prefer_redirects=False,
win_private_assemblies=False,
cipher=block_cipher,
noarchive=False)

pyz = PYZ(a.pure, a.zipped_data,
cipher=block_cipher)

exe = EXE(pyz,
a.scripts,
a.binaries,
a.zipfiles,
a.datas,
[],
name='timetracker',
debug=False,
bootloader_ignore_signals=False,
strip=False,
upx=True,
runtime_tmpdir=None,
console=True)
31 changes: 18 additions & 13 deletions timetracker/__main__.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
from . import web
from . import console
from . import test
from timetracker import web
from timetracker import console
from timetracker import test
import argparse


argparser = argparse.ArgumentParser()
argparser.add_argument("--web", help="Starts the web server instead of using console interaction.", action='store_true')
argparser.add_argument("--test", help="Runs the test suite", action='store_true')
args = argparser.parse_args()
if args.web:
web.start()
elif args.test:
test.run()
else:
console.start()
def main():
argparser = argparse.ArgumentParser()
argparser.add_argument("--web", help="Starts the web server instead of using console interaction.", action='store_true')
argparser.add_argument("--test", help="Runs the test suite", action='store_true')
args = argparser.parse_args()
if args.web:
web.start()
elif args.test:
test.run()
else:
console.start()


if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion timetracker/console.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .signer import sign
from timetracker.signer import sign


def start():
Expand Down
2 changes: 1 addition & 1 deletion timetracker/test.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from . import db, signer
from timetracker import db, signer
import time


Expand Down
6 changes: 3 additions & 3 deletions timetracker/web.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import os
from .signer import sign
from .db import *
from .config import config
from timetracker.signer import sign
from timetracker.db import *
from timetracker.config import config
import flask
from flask_table import Table, Col

Expand Down

0 comments on commit 3b3ee89

Please sign in to comment.