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 = []
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':
runtime_hooks.append('scripts/pyinstaller/macos-library-path-hook.py')
if '--onefile' in sys.argv:

View File

@@ -2,7 +2,7 @@
#
# 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
# 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
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
from ctypes import windll
import os
import sys
@@ -26,8 +27,9 @@ import sys
# to get stdout / stderr logged to console. This needs to happen before
# logging gets imported.
# 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':
from ctypes import windll
if windll.kernel32.AttachConsole(-1):
sys.stdout = open('CON', 'w')
sys.stderr = open('CON', 'w')
if windll.kernel32.AttachConsole(-1):
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:
basedir = os.path.dirname(os.path.abspath(__file__))
if sys.platform == 'win32':
os.environ['PATH'] = basedir + ';' + os.environ['PATH']
try:
from picard.tagger import main
main(os.path.join(basedir, 'locale'), %(autoupdate)s)