Skip to content

Commit

Permalink
Switch to pyinstaller for windows builds
Browse files Browse the repository at this point in the history
  • Loading branch information
tp7 committed Apr 19, 2017
1 parent 217b482 commit db0e593
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 35 deletions.
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2014 Victor Efimov
Copyright (c) 2014-2017 Victor Efimov

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
Expand Down
12 changes: 12 additions & 0 deletions build-windows.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rmdir /S /Q dist

pyinstaller --noupx --onefile --noconfirm ^
--exclude-module Tkconstants ^
--exclude-module Tkinter ^
--exclude-module matplotlib ^
sushi.py

mkdir dist\licenses
copy /Y licenses\* dist\licenses\*
copy LICENSE dist\licenses\Sushi.txt
copy README.md dist\readme.md
2 changes: 2 additions & 0 deletions requirements-win.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pyinstaller
colorama
37 changes: 3 additions & 34 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,43 +1,12 @@
from distutils.core import setup
import os
try:
import py2exe
except ImportError:
pass
import sys
import sushi

setup(
name='Sushi',
description='Automatic subtitle shifter based on audio',
version='0.5.0',
version=sushi.VERSION,
url='https://github.com/tp7/Sushi',
console=['sushi.py'],
license='MIT',
options={
'py2exe': {
'compressed': True,
'optimize': 2,
"excludes": ["translation", "Tkconstants", "Tkinter", "tcl", 'pyreadline', 'email',
'numpy.core.multiarray_tests', 'numpy.core.operand_flag_tests', 'numpy.core.struct_ufunc_test',
'numpy.core.umath_tests', 'numpy.core._dotblas', 'matplotlib'],
"dll_excludes": ['w9xpopen.exe', 'AVICAP32.dll', 'AVIFIL32.dll', 'MSACM32.dll', 'MSVFW32.dll'],
}
},
zipfile='lib/library.zip',
data_files=[
('', ('readme.md', 'LICENSE')),
('licenses', ('licenses/OpenCV.txt', 'licenses/SciPy.txt'))
]
license='MIT'
)

try:
dist_dir = next(sys.argv[i + 1].strip('"') for i, arg in enumerate(sys.argv) if arg.lower() == '-d')
except StopIteration:
dist_dir = 'dist'

# move our license to the right directory
license_output_path = os.path.join(dist_dir, 'licenses', 'Sushi.txt')
if os.path.exists(license_output_path):
os.remove(license_output_path)
os.rename(os.path.join(dist_dir, 'LICENSE'), license_output_path)

2 changes: 2 additions & 0 deletions sushi.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@

ALLOWED_ERROR = 0.01
MAX_GROUP_STD = 0.025
VERSION = '0.5.1'


class ColoredLogFormatter(logging.Formatter):
Expand Down Expand Up @@ -809,6 +810,7 @@ def create_arg_parser():

parser.add_argument('-v', '--verbose', default=False, dest='verbose', action='store_true',
help='Enable verbose logging')
parser.add_argument('--version', action='version', version=VERSION)

return parser

Expand Down

0 comments on commit db0e593

Please sign in to comment.