diff --git a/kindlecomicconverter/comicarchive.py b/kindlecomicconverter/comicarchive.py index 0acfc76..c4bb853 100644 --- a/kindlecomicconverter/comicarchive.py +++ b/kindlecomicconverter/comicarchive.py @@ -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 @@ -41,12 +40,12 @@ class ComicArchive: self.dirname, self.basename = os.path.split(filepath) @cached_property - def type(self): + def type(self): extraction_commands = [ [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,20 +84,20 @@ 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] ) - + for cmd in extraction_commands: try: subprocess_run(cmd, capture_output=True, check=True, cwd=self.dirname) - return targetdir + return targetdir except FileNotFoundError: missing.append(cmd[0]) except CalledProcessError: pass - + if missing: raise OSError(f'Extraction failed, install specialized extraction software. ') else: diff --git a/requirements-docker.txt b/requirements-docker.txt index 8e5d5fa..da6a8c5 100644 --- a/requirements-docker.txt +++ b/requirements-docker.txt @@ -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 \ No newline at end of file diff --git a/requirements-osx-legacy.txt b/requirements-osx-legacy.txt index c620399..701b28f 100644 --- a/requirements-osx-legacy.txt +++ b/requirements-osx-legacy.txt @@ -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 diff --git a/requirements-win7.txt b/requirements-win7.txt index 346c1af..cbd2fe2 100644 --- a/requirements-win7.txt +++ b/requirements-win7.txt @@ -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 diff --git a/requirements.txt b/requirements.txt index 0b51a8e..e7c867f 100644 --- a/requirements.txt +++ b/requirements.txt @@ -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 diff --git a/setup.py b/setup.py index daf2276..385329a 100644 --- a/setup.py +++ b/setup.py @@ -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',