mirror of
https://github.com/k4yt3x/video2x.git
synced 2024-12-28 06:59:11 +00:00
fixed pyinstaller 7z unpacking issues, replaced pyunpack with patoolib
This commit is contained in:
parent
180bfcab20
commit
1be2c1ead7
2
.github/workflows/nightly.yml
vendored
2
.github/workflows/nightly.yml
vendored
@ -44,6 +44,8 @@ jobs:
|
||||
run: |
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--additional-hooks-dir "pyinstaller\hooks" `
|
||||
--add-data="pyinstaller\7z1900-extra;7z" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_setup.py
|
||||
- name: Collect artifacts into folder
|
||||
|
@ -48,6 +48,8 @@ pyinstaller --noconfirm --log-level=WARN `
|
||||
Write-Host -ForegroundColor White "`nBuilding Video2X setup script"
|
||||
pyinstaller --noconfirm --log-level=WARN `
|
||||
--onefile `
|
||||
--additional-hooks-dir "pyinstaller\hooks" `
|
||||
--add-data="pyinstaller\7z1900-extra;7z" `
|
||||
--icon="images\video2x.ico" `
|
||||
video2x_setup.py
|
||||
|
||||
|
80
src/pyinstaller/hooks/hook-patoolib.py
Normal file
80
src/pyinstaller/hooks/hook-patoolib.py
Normal file
@ -0,0 +1,80 @@
|
||||
# -----------------------------------------------------------------------------
|
||||
# Copyright (c) 2013-2017, PyInstaller Development Team.
|
||||
#
|
||||
# Distributed under the terms of the GNU General Public License with exception
|
||||
# for distributing bootloader.
|
||||
#
|
||||
# The full license is in the file COPYING.txt, distributed with this software.
|
||||
# -----------------------------------------------------------------------------
|
||||
|
||||
"""
|
||||
Name: PyInstaller patoolib Hook
|
||||
Original solution: https://github.com/pyinstaller/pyinstaller/issues/3013
|
||||
|
||||
PyInstaller cannot find libraries imported by patoolib,
|
||||
since it uses importlib to import these modules.
|
||||
"""
|
||||
|
||||
hiddenimports = [
|
||||
"patoolib.programs",
|
||||
"patoolib.programs.ar",
|
||||
"patoolib.programs.arc",
|
||||
"patoolib.programs.archmage",
|
||||
"patoolib.programs.bsdcpio",
|
||||
"patoolib.programs.bsdtar",
|
||||
"patoolib.programs.bzip2",
|
||||
"patoolib.programs.cabextract",
|
||||
"patoolib.programs.chmlib",
|
||||
"patoolib.programs.clzip",
|
||||
"patoolib.programs.compress",
|
||||
"patoolib.programs.cpio",
|
||||
"patoolib.programs.dpkg",
|
||||
"patoolib.programs.flac",
|
||||
"patoolib.programs.genisoimage",
|
||||
"patoolib.programs.gzip",
|
||||
"patoolib.programs.isoinfo",
|
||||
"patoolib.programs.lbzip2",
|
||||
"patoolib.programs.lcab",
|
||||
"patoolib.programs.lha",
|
||||
"patoolib.programs.lhasa",
|
||||
"patoolib.programs.lrzip",
|
||||
"patoolib.programs.lzip",
|
||||
"patoolib.programs.lzma",
|
||||
"patoolib.programs.lzop",
|
||||
"patoolib.programs.mac",
|
||||
"patoolib.programs.nomarch",
|
||||
"patoolib.programs.p7azip",
|
||||
"patoolib.programs.p7rzip",
|
||||
"patoolib.programs.p7zip",
|
||||
"patoolib.programs.pbzip2",
|
||||
"patoolib.programs.pdlzip",
|
||||
"patoolib.programs.pigz",
|
||||
"patoolib.programs.plzip",
|
||||
"patoolib.programs.py_bz2",
|
||||
"patoolib.programs.py_echo",
|
||||
"patoolib.programs.py_gzip",
|
||||
"patoolib.programs.py_lzma",
|
||||
"patoolib.programs.py_tarfile",
|
||||
"patoolib.programs.py_zipfile",
|
||||
"patoolib.programs.rar",
|
||||
"patoolib.programs.rpm",
|
||||
"patoolib.programs.rpm2cpio",
|
||||
"patoolib.programs.rzip",
|
||||
"patoolib.programs.shar",
|
||||
"patoolib.programs.shorten",
|
||||
"patoolib.programs.star",
|
||||
"patoolib.programs.tar",
|
||||
"patoolib.programs.unace",
|
||||
"patoolib.programs.unadf",
|
||||
"patoolib.programs.unalz",
|
||||
"patoolib.programs.uncompress",
|
||||
"patoolib.programs.unrar",
|
||||
"patoolib.programs.unshar",
|
||||
"patoolib.programs.unzip",
|
||||
"patoolib.programs.xdms",
|
||||
"patoolib.programs.xz",
|
||||
"patoolib.programs.zip",
|
||||
"patoolib.programs.zoo",
|
||||
"patoolib.programs.zopfli",
|
||||
"patoolib.programs.zpaq",
|
||||
]
|
@ -43,7 +43,7 @@ import zipfile
|
||||
# later in the script.
|
||||
# import requests
|
||||
|
||||
VERSION = '2.0.0'
|
||||
VERSION = '2.0.1'
|
||||
|
||||
# global static variables
|
||||
LOCALAPPDATA = pathlib.Path(os.getenv('localappdata'))
|
||||
@ -230,6 +230,11 @@ class Video2xSetup:
|
||||
anime4kcpp_7z = download(a['browser_download_url'], tempfile.gettempdir())
|
||||
self.trash.append(anime4kcpp_7z)
|
||||
|
||||
# if running in PyInstaller, add sys._MEIPASS\7z to path
|
||||
# this directory contains 7za.exe and its DLL files
|
||||
with contextlib.suppress(AttributeError):
|
||||
os.environ['PATH'] += f';{sys._MEIPASS}\\7z'
|
||||
|
||||
# (LOCALAPPDATA / 'video2x' / 'anime4kcpp').mkdir(parents=True, exist_ok=True)
|
||||
# pyunpack.Archive(anime4kcpp_7z).extractall(LOCALAPPDATA / 'video2x' / 'anime4kcpp')
|
||||
if (LOCALAPPDATA / 'video2x' / 'anime4kcpp').exists():
|
||||
|
Loading…
Reference in New Issue
Block a user