From db0e5938c8acc288e9dd56640cd46fa6ae3799aa Mon Sep 17 00:00:00 2001 From: Victor Efimov Date: Wed, 19 Apr 2017 21:52:30 +0300 Subject: [PATCH] Switch to pyinstaller for windows builds --- LICENSE | 2 +- build-windows.bat | 12 ++++++++++++ requirements-win.txt | 2 ++ setup.py | 37 +++---------------------------------- sushi.py | 2 ++ 5 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 build-windows.bat create mode 100644 requirements-win.txt diff --git a/LICENSE b/LICENSE index cebd17b..5eb8c4b 100644 --- a/LICENSE +++ b/LICENSE @@ -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 diff --git a/build-windows.bat b/build-windows.bat new file mode 100644 index 0000000..2cecb33 --- /dev/null +++ b/build-windows.bat @@ -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 \ No newline at end of file diff --git a/requirements-win.txt b/requirements-win.txt new file mode 100644 index 0000000..a20a66f --- /dev/null +++ b/requirements-win.txt @@ -0,0 +1,2 @@ +pyinstaller +colorama diff --git a/setup.py b/setup.py index 80a769a..5a2c7dd 100644 --- a/setup.py +++ b/setup.py @@ -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) - diff --git a/sushi.py b/sushi.py index b9da9bc..fbb840d 100755 --- a/sushi.py +++ b/sushi.py @@ -38,6 +38,7 @@ ALLOWED_ERROR = 0.01 MAX_GROUP_STD = 0.025 +VERSION = '0.5.1' class ColoredLogFormatter(logging.Formatter): @@ -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