Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 23 additions & 2 deletions Application.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,29 @@
# Copyright (C) 2018--2019 Philip Belemezov.
# All Rights Reserved.
#
# This file is part of Subtitles.
#
# Subtitles is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Subtitles is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Subtitles. If not, see <https://www.gnu.org/licenses/>.

import sys
from os import path
from enum import Enum
from PyQt5.Qt import (
QApplication, QStandardPaths, QSettings
from PySide2.QtCore import (
QStandardPaths, QSettings
)
from PySide2.QtWidgets import (
QApplication
)
from log import logger

Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
#!/usr/bin/env make

# Copyright (C) 2018--2019 Philip Belemezov.
# All Rights Reserved.
#
# This file is part of Subtitles.
#
# Subtitles is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Subtitles is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Subtitles. If not, see <https://www.gnu.org/licenses/>.


SHELL := /bin/bash

DISTDIR := dist
Expand Down
6 changes: 4 additions & 2 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ name = "pypi"

[packages]
injector = "*"
"pyqt5" = "*"
python-opensubtitles = {git = "https://github.com/agonzalezro/python-opensubtitles.git"}
requests = "*"
pyinstaller = "*"
pyinstaller = {git = "https://github.com/pyinstaller/pyinstaller.git"}
pywin32-ctypes = {version = "*",sys_platform = "== 'win32'"}
pyside2 = "*"

[dev-packages]
"autopep8" = "*"
Expand All @@ -20,6 +20,8 @@ pyinstaller = "*"
pypiwin32 = {version = "*",sys_platform = "== 'win32'"}
pywin32 = {version = "*",sys_platform = "== 'win32'"}
yapf = "*"
pyside-type-init = "*"
pyi-archive-viewer = "*"

[requires]
python_version = "3.7"
99 changes: 36 additions & 63 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 54 additions & 36 deletions Subtitles.pyinstaller.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,20 @@
# -*- mode: python -*-
# Copyright (C) 2018--2019 Philip Belemezov.
# All Rights Reserved.
#
# This file is part of Subtitles.
#
# Subtitles is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Subtitles is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Subtitles. If not, see <https://www.gnu.org/licenses/>.

from PyInstaller.utils.hooks import collect_dynamic_libs
from PyInstaller.building.datastruct import TOC
Expand Down Expand Up @@ -32,15 +48,15 @@ def write_subst_file(in_filename, out_filename, subst_dict):
# From https://github.com/spesmilo/electrum/blob/master/contrib/build-osx/osx.spec
# Workaround for "Retro Look":
binaries = []
for b in collect_dynamic_libs('PyQt5'):
for b in collect_dynamic_libs('PySide2'):
if re.match(r'.*style\..*', b[0]):
print('*** Adding Qt5 Style {}'.format(b[0]))
binaries.append(b)

data_files = [
('doc/VERSION', RESOURCES_DIR),
('doc/ACKNOWLEDGEMENTS.html', RESOURCES_DIR),
# ('doc/LICENSE.PyQt5', RESOURCES_DIR),
# ('doc/LICENSE.PySide2', RESOURCES_DIR),
('doc/LICENSE.html', RESOURCES_DIR),
('resources/Subtitles.png', RESOURCES_DIR),
]
Expand Down Expand Up @@ -101,7 +117,7 @@ QT_MODULE_EXCLUDES = [

MODULE_EXCLUDES = []
for x in QT_MODULE_EXCLUDES:
MODULE_EXCLUDES.extend([prefix + x for prefix in ['Qt', 'Qt5', 'PyQt5.']])
MODULE_EXCLUDES.extend([prefix + x for prefix in ['Qt', 'Qt5', 'PySide2.']])

new_binaries = []

Expand All @@ -113,36 +129,36 @@ for module, file, typ in a.binaries:
should_exclude = True
if should_exclude:
continue
# On Linux, some paths are relative to the qml/ subdirectory, e.g.
# .../lib/python3.7/site-packages/PyQt5/Qt/qml/Qt/labs/platform/../../../../lib/libQt5Widgets.so.5
# On Linux, some paths are relative to the qml/ subdirectory, e.g.
# .../lib/python3.7/site-packages/PySide2/Qt/qml/Qt/labs/platform/../../../../lib/libQt5Widgets.so.5
# which causes essential Qt libraries to get excluded.
# So, normalize the path here, and then check for a match.
file = path.normpath(file)
if not module.startswith('libpython') and \
(
file.startswith('/usr/') or file.startswith('/lib')
or 'PyQt5/Qt/qml/' in file
or module.startswith('PyQt5/Qt/plugins/sqldrivers')
or module.startswith('PyQt5/Qt/plugins/mediaservice')
or module.startswith('PyQt5/Qt/plugins/position')
or module.startswith('PyQt5/Qt/plugins/sensors')
or module.startswith('PyQt5/Qt/plugins/sensorgestures')
or module.startswith('PyQt5/Qt/plugins/audio')
or 'PyQt5/Qt/plugins/imageformats/libqtga' in module
or 'PyQt5/Qt/plugins/imageformats/libqgif' in module
or 'PyQt5/Qt/plugins/imageformats/libqicns' in module
or 'PyQt5/Qt/plugins/imageformats/libqico' in module
or 'PyQt5/Qt/plugins/imageformats/libqwbmp' in module
or 'PyQt5/Qt/plugins/imageformats/libqwebp' in module
or 'PyQt5/Qt/plugins/imageformats/libqtiff' in module
or 'PyQt5/Qt/plugins/platforms/libqeglfs' in module
or 'PyQt5/Qt/plugins/platforms/libqlinuxfb' in module
or 'PyQt5/Qt/plugins/platforms/libqminimal' in module
or 'PyQt5/Qt/plugins/platforms/libqminimalegl' in module
or 'PyQt5/Qt/plugins/platforms/libqvnc' in module
or 'PyQt5/Qt/plugins/platforms/libqwebgl' in module
or 'PyQt5/Qt/plugins/platforms/libqoffscreen' in module
or 'PyQt5/Qt/plugins/playlistformats/libqtmultimedia_m3u' in module
or 'PySide2/Qt/qml/' in file
or module.startswith('PySide2/Qt/plugins/sqldrivers')
or module.startswith('PySide2/Qt/plugins/mediaservice')
or module.startswith('PySide2/Qt/plugins/position')
or module.startswith('PySide2/Qt/plugins/sensors')
or module.startswith('PySide2/Qt/plugins/sensorgestures')
or module.startswith('PySide2/Qt/plugins/audio')
or 'PySide2/Qt/plugins/imageformats/libqtga' in module
or 'PySide2/Qt/plugins/imageformats/libqgif' in module
or 'PySide2/Qt/plugins/imageformats/libqicns' in module
or 'PySide2/Qt/plugins/imageformats/libqico' in module
or 'PySide2/Qt/plugins/imageformats/libqwbmp' in module
or 'PySide2/Qt/plugins/imageformats/libqwebp' in module
or 'PySide2/Qt/plugins/imageformats/libqtiff' in module
or 'PySide2/Qt/plugins/platforms/libqeglfs' in module
or 'PySide2/Qt/plugins/platforms/libqlinuxfb' in module
or 'PySide2/Qt/plugins/platforms/libqminimal' in module
or 'PySide2/Qt/plugins/platforms/libqminimalegl' in module
or 'PySide2/Qt/plugins/platforms/libqvnc' in module
or 'PySide2/Qt/plugins/platforms/libqwebgl' in module
or 'PySide2/Qt/plugins/platforms/libqoffscreen' in module
or 'PySide2/Qt/plugins/playlistformats/libqtmultimedia_m3u' in module
or 'QtWebEngineCore.framework' in file
):
# print(f"Excluding binary '{module}'")
Expand All @@ -154,18 +170,18 @@ for module, file, typ in a.binaries:

new_datas = []
for module, file, typ in a.datas:
if module.startswith('PyQt5/Qt/qml/') \
or module.startswith('PyQt5/Qt/lib/QtWebEngineCore.framework') \
or module.startswith('PyQt5/Qt/translations') \
if module.startswith('PySide2/Qt/qml/') \
or module.startswith('PySide2/Qt/lib/QtWebEngineCore.framework') \
or module.startswith('PySide2/Qt/translations') \
or 'qtwebengine_devtools_resources' in module \
or 'qtwebengine_resources' in module \
or 'QtWebEngineProcess' in module:
continue
new_datas.append((module, file, type))


a.binaries = TOC(initlist=new_binaries)
a.datas = TOC(initlist=new_datas)
# a.binaries = TOC(initlist=new_binaries)
# a.datas = TOC(initlist=new_datas)


# for attrib in ['scripts', 'pure', 'binaries', 'datas', 'zipfiles']:
Expand All @@ -183,10 +199,12 @@ exe = EXE(pyz,
a.scripts,
exclude_binaries=True,
name='Subtitles',
debug=False,
strip=True,
debug='all',
# Interpreter options
options = [ ('v', None, 'OPTION') ],
strip=False,
upx=USE_UPX,
console=False)
console=True)

if sys.platform == 'win32':
icon = 'resources/Subtitles.ico'
Expand Down
Loading