PICARD-2291: Fix DLL search path in Windows portable install

Move setting the PATH to include the package folder earlier in the PyInstaller hooks.
This commit is contained in:
Philipp Wolfer
2021-10-16 18:01:01 +02:00
parent 94a9d7e1db
commit fb37df7ef8
3 changed files with 10 additions and 11 deletions

View File

@@ -67,7 +67,7 @@ if os.path.isfile(ab_extractor_name):
runtime_hooks = [] runtime_hooks = []
if os_name == 'Windows': if os_name == 'Windows':
runtime_hooks.append('scripts/pyinstaller/win-console-hook.py') runtime_hooks.append('scripts/pyinstaller/win-startup-hook.py')
elif os_name == 'Darwin': elif os_name == 'Darwin':
runtime_hooks.append('scripts/pyinstaller/macos-library-path-hook.py') runtime_hooks.append('scripts/pyinstaller/macos-library-path-hook.py')
if '--onefile' in sys.argv: if '--onefile' in sys.argv:

View File

@@ -2,7 +2,7 @@
# #
# Picard, the next-generation MusicBrainz tagger # Picard, the next-generation MusicBrainz tagger
# #
# Copyright (C) 2019 Philipp Wolfer # Copyright (C) 2019, 2021 Philipp Wolfer
# #
# This program is free software; you can redistribute it and/or # This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License # modify it under the terms of the GNU General Public License
@@ -18,7 +18,8 @@
# along with this program; if not, write to the Free Software # along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from ctypes import windll
import os
import sys import sys
@@ -26,8 +27,9 @@ import sys
# to get stdout / stderr logged to console. This needs to happen before # to get stdout / stderr logged to console. This needs to happen before
# logging gets imported. # logging gets imported.
# See https://stackoverflow.com/questions/54536/win32-gui-app-that-writes-usage-text-to-stdout-when-invoked-as-app-exe-help # See https://stackoverflow.com/questions/54536/win32-gui-app-that-writes-usage-text-to-stdout-when-invoked-as-app-exe-help
if sys.platform == 'win32': if windll.kernel32.AttachConsole(-1):
from ctypes import windll sys.stdout = open('CON', 'w')
if windll.kernel32.AttachConsole(-1): sys.stderr = open('CON', 'w')
sys.stdout = open('CON', 'w')
sys.stderr = open('CON', 'w') # Ensure bundled DLLs are loaded
os.environ['PATH'] = sys._MEIPASS + os.pathsep + os.environ['PATH']

View File

@@ -12,9 +12,6 @@ if getattr(sys, 'frozen', False):
else: else:
basedir = os.path.dirname(os.path.abspath(__file__)) basedir = os.path.dirname(os.path.abspath(__file__))
if sys.platform == 'win32':
os.environ['PATH'] = basedir + ';' + os.environ['PATH']
try: try:
from picard.tagger import main from picard.tagger import main
main(os.path.join(basedir, 'locale'), %(autoupdate)s) main(os.path.join(basedir, 'locale'), %(autoupdate)s)