fix: enable unrar on all distros, not just Fedora (#1376)

* fix: enable unrar on all distros, not just Fedora

unrar was gated behind distro.id() == 'fedora', so on Debian/Ubuntu
the binary was installed but never invoked. Try unrar unconditionally
after 7z, with an optional rarfile Python fallback.

Fixes CBR extraction on non-Fedora Linux distributions.

* fix: gate unrar on Linux and drop unused distro dependency

Debian/Ubuntu's '7zip' package ships the upstream 7zz binary, which
excludes RAR support for licensing reasons, so 7z fails to read .cbr
(RAR) archives. unrar was installed but only invoked when
distro.id() == 'fedora', so on Debian it was never tried and extraction
failed.

Per maintainer feedback, gate unrar on platform.system() == 'Linux'
(not needed on Windows or macOS) and drop the rarfile PyPI fallback to
avoid a new dependency. Since the code no longer imports distro, also
remove it from the requirements files and setup.py.
This commit is contained in:
Nils Leo
2026-07-02 15:07:36 -07:00
committed by GitHub
parent 544e866b51
commit 72e1546c2c
6 changed files with 6 additions and 12 deletions
+2 -3
View File
@@ -22,7 +22,6 @@ from functools import cached_property, lru_cache
import os
from pathlib import Path
import platform
import distro
from subprocess import STDOUT, PIPE, CalledProcessError
from xml.dom.minidom import parseString
from xml.parsers.expat import ExpatError
@@ -46,7 +45,7 @@ class ComicArchive:
[SEVENZIP, 'l', '-y', '-p1', self.basename],
]
if distro.id() == 'fedora' or distro.like() == 'fedora':
if platform.system() == 'Linux':
extraction_commands.append(
['unrar', 'l', '-y', '-p1', self.basename],
)
@@ -85,7 +84,7 @@ class ComicArchive:
extraction_commands.reverse()
if distro.id() == 'fedora' or distro.like() == 'fedora':
if platform.system() == 'Linux':
extraction_commands.append(
['unrar', 'x', '-y', '-x__MACOSX', '-x.DS_Store', '-xthumbs.db', '-xThumbs.db', self.basename, targetdir]
)
-1
View File
@@ -5,7 +5,6 @@ python-slugify>=8.0.4
packaging>=26.2
mozjpeg-lossless-optimization>=1.2.0
natsort>=8.4.0
distro>=1.9.0
# Below requirements are compiled in Dockefile
# numpy==2.3.4
# PyMuPDF==1.26.6
-1
View File
@@ -6,6 +6,5 @@ python-slugify>=8.0.4
packaging>=26.2
mozjpeg-lossless-optimization>=1.2.0
natsort>=8.4.0
distro>=1.9.0
numpy<2
PyMuPDF==1.25.5
-1
View File
@@ -6,6 +6,5 @@ python-slugify>=8.0.4
packaging>=26.2
mozjpeg-lossless-optimization>=1.2.0
natsort>=8.4.0
distro>=1.9.0
numpy==1.23.5
PyMuPDF>=1.16
-1
View File
@@ -6,6 +6,5 @@ python-slugify>=8.0.4,<9.0.0
packaging>=26.2
mozjpeg-lossless-optimization>=1.2.0
natsort>=8.4.0
distro>=1.9.0
numpy>=1.22.4
PyMuPDF>=1.18.0
-1
View File
@@ -155,7 +155,6 @@ setuptools.setup(
'python-slugify>=1.2.1,<9.0.0',
'mozjpeg-lossless-optimization>=1.2.0',
'natsort>=8.4.0',
'distro>=1.8.0',
'numpy>=1.22.4',
'packaging>=23.2',
'PyMuPDF>=1.16.1',