Skip to content

Commit 7879374

Browse files
authored
Merge pull request #1 from chev2/package-check-fix
Fix Linux package check not working for non-apt-based distros
2 parents 35f1455 + 180d531 commit 7879374

5 files changed

Lines changed: 11 additions & 7 deletions

File tree

Scripts/Main/Packages_Location/FFmpeg.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if system() == "Windows":
1717
)
1818
else:
1919
try:
20-
if cache[__FFmpeg.lower()].is_installed:
20+
if is_package_installed.get(__FFmpeg.lower()):
2121
__FFmpeg = __FFmpeg.lower()
2222
except IndexError:
2323
print(__FFmpeg_Error_1 + ' {1}("{0}"){2}'.format(

Scripts/Main/Packages_Location/Gifsicle.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if system() == "Windows":
1717
)
1818
else:
1919
try:
20-
if cache[__GifSicle.lower()].is_installed:
20+
if is_package_installed.get(__GifSicle.lower()):
2121
__GifSicle = __GifSicle.lower()
2222
except IndexError:
2323
print(__GifSicle_Error_1 + ' {1}("{0}"){2}'.format(

Scripts/Main/Packages_Location/OxiPNG.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if system() == "Windows":
1717
)
1818
else:
1919
try:
20-
if cache[__OxiPNG.lower()].is_installed:
20+
if is_package_installed.get(__OxiPNG.lower()):
2121
__OxiPNG = __OxiPNG.lower()
2222
except IndexError:
2323
print(__OxiPNG_Error_1 + ' {1}("{0}"){2}'.format(

Scripts/Main/Packages_Location/PNGQuant.pyw

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ if system() == "Windows":
1717
)
1818
else:
1919
try:
20-
if cache[__PNGQuant.lower()].is_installed:
20+
if is_package_installed.get(__PNGQuant.lower()):
2121
__PNGQuant = __PNGQuant.lower()
2222
except IndexError:
2323
print(__PNGQuant_Error_1 + ' {1}("{0}"){2}'.format(

iFunny_Captions.pyw

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ from unidecode import unidecode as normalize
2929
from argparse import ArgumentParser as ap, SUPPRESS
3030
from emoji import emojize, demojize, UNICODE_EMOJI_ENGLISH
3131
from tkinter import Tk, filedialog as fd, messagebox as msgbox
32-
from shutil import copyfile, move as mv, rmtree, unpack_archive
32+
from shutil import copyfile, move as mv, rmtree, unpack_archive, which
3333
from PIL import Image, ImageChops, ImageColor as IC, ImageDraw, ImageFile, ImageFont, ImageOps, PngImagePlugin, UnidentifiedImageError
3434

3535
#-------------------------#
@@ -84,8 +84,12 @@ exec(open_("Error_Handler"))
8484

8585
# Getting Packages Location
8686
if not system() == "Windows":
87-
import apt
88-
cache = apt.Cache()
87+
is_package_installed = {
88+
"ffmpeg": which("ffmpeg") is not None,
89+
"gifsicle": which("gifsicle") is not None,
90+
"oxipng": which("oxipng") is not None,
91+
"pngquant": which("pngquant") is not None,
92+
}
8993

9094
exec(open_("Packages_Location/FFmpeg"))
9195
exec(open_("Folder/Name"))

0 commit comments

Comments
 (0)