mirror of
https://github.com/ciromattia/kcc
synced 2025-12-12 17:26:23 +00:00
Updated dependencies
This commit is contained in:
13
README.md
13
README.md
@@ -32,17 +32,16 @@ You can find the latest released binary at the following links:
|
|||||||
## DEPENDENCIES
|
## DEPENDENCIES
|
||||||
Following software is required to run Linux version of **KCC** and/or bare sources:
|
Following software is required to run Linux version of **KCC** and/or bare sources:
|
||||||
- Python 3.3+
|
- Python 3.3+
|
||||||
- [PyQt](https://pypi.python.org/pypi/PyQt5) 5.6.0+
|
- [PyQt5](https://pypi.python.org/pypi/PyQt5) 5.6.0+
|
||||||
- [Pillow](https://pypi.python.org/pypi/Pillow/) 3.2.0+
|
- [Pillow](https://pypi.python.org/pypi/Pillow/) 4.0.0+
|
||||||
- [psutil](https://pypi.python.org/pypi/psutil) 4.1.0+
|
- [psutil](https://pypi.python.org/pypi/psutil) 5.0.0+
|
||||||
- [python-slugify](https://pypi.python.org/pypi/python-slugify) 1.2.0+
|
- [python-slugify](https://pypi.python.org/pypi/python-slugify) 1.2.1+
|
||||||
- [raven](https://pypi.python.org/pypi/raven) 5.13.0+
|
- [raven](https://pypi.python.org/pypi/raven) 6.0.0+
|
||||||
- [scandir](https://pypi.python.org/pypi/scandir) 1.2.0+ _(needed only when using Python 3.3 or 3.4)_
|
|
||||||
|
|
||||||
On Debian based distributions these two commands should install all needed dependencies:
|
On Debian based distributions these two commands should install all needed dependencies:
|
||||||
```
|
```
|
||||||
sudo apt-get install python3 python3-dev python3-pip libpng-dev libjpeg-dev p7zip-full unrar
|
sudo apt-get install python3 python3-dev python3-pip libpng-dev libjpeg-dev p7zip-full unrar
|
||||||
sudo pip3 install --upgrade pillow python-slugify psutil scandir raven pyqt5
|
sudo pip3 install --upgrade pillow python-slugify psutil pyqt5 raven
|
||||||
```
|
```
|
||||||
|
|
||||||
### Optional dependencies
|
### Optional dependencies
|
||||||
|
|||||||
@@ -22,10 +22,6 @@ from zipfile import is_zipfile, ZipFile
|
|||||||
from subprocess import STDOUT, PIPE
|
from subprocess import STDOUT, PIPE
|
||||||
from psutil import Popen
|
from psutil import Popen
|
||||||
from shutil import move, copy
|
from shutil import move, copy
|
||||||
try:
|
|
||||||
from scandir import walk
|
|
||||||
except ImportError:
|
|
||||||
walk = os.walk
|
|
||||||
from . import rarfile
|
from . import rarfile
|
||||||
from .shared import check7ZFile as is_7zfile, saferReplace, saferRemove
|
from .shared import check7ZFile as is_7zfile, saferReplace, saferRemove
|
||||||
|
|
||||||
@@ -63,7 +59,7 @@ class CBxArchive:
|
|||||||
def extractCBR(self, targetdir):
|
def extractCBR(self, targetdir):
|
||||||
cbrFile = rarfile.RarFile(self.origFileName)
|
cbrFile = rarfile.RarFile(self.origFileName)
|
||||||
cbrFile.extractall(targetdir)
|
cbrFile.extractall(targetdir)
|
||||||
for root, dirnames, filenames in walk(targetdir):
|
for root, dirnames, filenames in os.walk(targetdir):
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if filename.startswith('__MACOSX') or filename.endswith('.DS_Store') or filename.endswith('humbs.db'):
|
if filename.startswith('__MACOSX') or filename.endswith('.DS_Store') or filename.endswith('humbs.db'):
|
||||||
saferRemove(os.path.join(root, filename))
|
saferRemove(os.path.join(root, filename))
|
||||||
|
|||||||
@@ -42,10 +42,6 @@ try:
|
|||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
QtCore = None
|
QtCore = None
|
||||||
try:
|
|
||||||
from scandir import walk
|
|
||||||
except ImportError:
|
|
||||||
walk = os.walk
|
|
||||||
from .shared import md5Checksum, getImageFileName, walkSort, walkLevel, saferReplace, saferRemove, sanitizeTrace
|
from .shared import md5Checksum, getImageFileName, walkSort, walkLevel, saferReplace, saferRemove, sanitizeTrace
|
||||||
from . import comic2panel
|
from . import comic2panel
|
||||||
from . import image
|
from . import image
|
||||||
@@ -424,7 +420,7 @@ def buildEPUB(path, chapterNames, tomeNumber):
|
|||||||
"display: none;\n",
|
"display: none;\n",
|
||||||
"}\n"])
|
"}\n"])
|
||||||
f.close()
|
f.close()
|
||||||
for (dirpath, dirnames, filenames) in walk(os.path.join(path, 'OEBPS', 'Images')):
|
for (dirpath, dirnames, filenames) in os.walk(os.path.join(path, 'OEBPS', 'Images')):
|
||||||
chapter = False
|
chapter = False
|
||||||
dirnames, filenames = walkSort(dirnames, filenames)
|
dirnames, filenames = walkSort(dirnames, filenames)
|
||||||
for afile in filenames:
|
for afile in filenames:
|
||||||
@@ -465,7 +461,7 @@ def imgDirectoryProcessing(path):
|
|||||||
options.imgPurgeIndex = []
|
options.imgPurgeIndex = []
|
||||||
work = []
|
work = []
|
||||||
pagenumber = 0
|
pagenumber = 0
|
||||||
for (dirpath, dirnames, filenames) in walk(path):
|
for (dirpath, dirnames, filenames) in os.walk(path):
|
||||||
for afile in filenames:
|
for afile in filenames:
|
||||||
pagenumber += 1
|
pagenumber += 1
|
||||||
work.append([afile, dirpath, options])
|
work.append([afile, dirpath, options])
|
||||||
@@ -663,7 +659,7 @@ def getCoversFromMCB(mangaID):
|
|||||||
|
|
||||||
def getDirectorySize(start_path='.'):
|
def getDirectorySize(start_path='.'):
|
||||||
total_size = 0
|
total_size = 0
|
||||||
for dirpath, dirnames, filenames in walk(start_path):
|
for dirpath, dirnames, filenames in os.walk(start_path):
|
||||||
for f in filenames:
|
for f in filenames:
|
||||||
fp = os.path.join(dirpath, f)
|
fp = os.path.join(dirpath, f)
|
||||||
total_size += os.path.getsize(fp)
|
total_size += os.path.getsize(fp)
|
||||||
@@ -688,7 +684,7 @@ def getPanelViewSize(deviceres, size):
|
|||||||
|
|
||||||
def sanitizeTree(filetree):
|
def sanitizeTree(filetree):
|
||||||
chapterNames = {}
|
chapterNames = {}
|
||||||
for root, dirs, files in walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
splitname = os.path.splitext(name)
|
splitname = os.path.splitext(name)
|
||||||
slugified = slugify(splitname[0])
|
slugified = slugify(splitname[0])
|
||||||
@@ -714,7 +710,7 @@ def sanitizeTree(filetree):
|
|||||||
|
|
||||||
def sanitizeTreeKobo(filetree):
|
def sanitizeTreeKobo(filetree):
|
||||||
pageNumber = 0
|
pageNumber = 0
|
||||||
for root, dirs, files in walk(filetree):
|
for root, dirs, files in os.walk(filetree):
|
||||||
dirs, files = walkSort(dirs, files)
|
dirs, files = walkSort(dirs, files)
|
||||||
for name in files:
|
for name in files:
|
||||||
splitname = os.path.splitext(name)
|
splitname = os.path.splitext(name)
|
||||||
@@ -730,7 +726,7 @@ def sanitizeTreeKobo(filetree):
|
|||||||
|
|
||||||
|
|
||||||
def sanitizePermissions(filetree):
|
def sanitizePermissions(filetree):
|
||||||
for root, dirs, files in walk(filetree, False):
|
for root, dirs, files in os.walk(filetree, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD)
|
os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD)
|
||||||
for name in dirs:
|
for name in dirs:
|
||||||
@@ -799,7 +795,7 @@ def splitProcess(path, mode):
|
|||||||
def detectCorruption(tmpPath, orgPath):
|
def detectCorruption(tmpPath, orgPath):
|
||||||
imageNumber = 0
|
imageNumber = 0
|
||||||
imageSmaller = 0
|
imageSmaller = 0
|
||||||
for root, dirs, files in walk(tmpPath, False):
|
for root, dirs, files in os.walk(tmpPath, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
if getImageFileName(name) is not None:
|
if getImageFileName(name) is not None:
|
||||||
path = os.path.join(root, name)
|
path = os.path.join(root, name)
|
||||||
@@ -850,7 +846,7 @@ def makeZIP(zipFilename, baseDir, isEPUB=False):
|
|||||||
zipOutput = ZipFile(zipFilename, 'w', ZIP_DEFLATED)
|
zipOutput = ZipFile(zipFilename, 'w', ZIP_DEFLATED)
|
||||||
if isEPUB:
|
if isEPUB:
|
||||||
zipOutput.writestr('mimetype', 'application/epub+zip', ZIP_STORED)
|
zipOutput.writestr('mimetype', 'application/epub+zip', ZIP_STORED)
|
||||||
for dirpath, dirnames, filenames in walk(baseDir):
|
for dirpath, dirnames, filenames in os.walk(baseDir):
|
||||||
for name in filenames:
|
for name in filenames:
|
||||||
path = os.path.normpath(os.path.join(dirpath, name))
|
path = os.path.normpath(os.path.join(dirpath, name))
|
||||||
aPath = os.path.normpath(os.path.join(dirpath.replace(baseDir, ''), name))
|
aPath = os.path.normpath(os.path.join(dirpath.replace(baseDir, ''), name))
|
||||||
|
|||||||
@@ -29,10 +29,6 @@ try:
|
|||||||
from PyQt5 import QtCore
|
from PyQt5 import QtCore
|
||||||
except ImportError:
|
except ImportError:
|
||||||
QtCore = None
|
QtCore = None
|
||||||
try:
|
|
||||||
from scandir import walk
|
|
||||||
except ImportError:
|
|
||||||
walk = os.walk
|
|
||||||
|
|
||||||
|
|
||||||
def mergeDirectoryTick(output):
|
def mergeDirectoryTick(output):
|
||||||
@@ -250,7 +246,7 @@ def main(argv=None, qtGUI=None):
|
|||||||
mergeWorkerOutput = []
|
mergeWorkerOutput = []
|
||||||
mergeWorkerPool = Pool()
|
mergeWorkerPool = Pool()
|
||||||
mergeWork.append([options.targetDir])
|
mergeWork.append([options.targetDir])
|
||||||
for root, dirs, files in walk(options.targetDir, False):
|
for root, dirs, files in os.walk(options.targetDir, False):
|
||||||
dirs, files = walkSort(dirs, files)
|
dirs, files = walkSort(dirs, files)
|
||||||
for directory in dirs:
|
for directory in dirs:
|
||||||
directoryNumer += 1
|
directoryNumer += 1
|
||||||
@@ -269,7 +265,7 @@ def main(argv=None, qtGUI=None):
|
|||||||
rmtree(options.targetDir, True)
|
rmtree(options.targetDir, True)
|
||||||
raise RuntimeError("One of workers crashed. Cause: " + mergeWorkerOutput[0][0], mergeWorkerOutput[0][1])
|
raise RuntimeError("One of workers crashed. Cause: " + mergeWorkerOutput[0][0], mergeWorkerOutput[0][1])
|
||||||
print("Splitting images...")
|
print("Splitting images...")
|
||||||
for root, dirs, files in walk(options.targetDir, False):
|
for root, dirs, files in os.walk(options.targetDir, False):
|
||||||
for name in files:
|
for name in files:
|
||||||
if getImageFileName(name) is not None:
|
if getImageFileName(name) is not None:
|
||||||
pagenumber += 1
|
pagenumber += 1
|
||||||
|
|||||||
@@ -27,10 +27,6 @@ from tempfile import mkdtemp
|
|||||||
from zipfile import ZipFile, ZIP_DEFLATED
|
from zipfile import ZipFile, ZIP_DEFLATED
|
||||||
from re import split
|
from re import split
|
||||||
from traceback import format_tb
|
from traceback import format_tb
|
||||||
try:
|
|
||||||
from scandir import walk
|
|
||||||
except ImportError:
|
|
||||||
walk = os.walk
|
|
||||||
|
|
||||||
|
|
||||||
class HTMLStripper(HTMLParser):
|
class HTMLStripper(HTMLParser):
|
||||||
@@ -71,7 +67,7 @@ def walkLevel(some_dir, level=1):
|
|||||||
some_dir = some_dir.rstrip(os.path.sep)
|
some_dir = some_dir.rstrip(os.path.sep)
|
||||||
assert os.path.isdir(some_dir)
|
assert os.path.isdir(some_dir)
|
||||||
num_sep = some_dir.count(os.path.sep)
|
num_sep = some_dir.count(os.path.sep)
|
||||||
for root, dirs, files in walk(some_dir):
|
for root, dirs, files in os.walk(some_dir):
|
||||||
dirs, files = walkSort(dirs, files)
|
dirs, files = walkSort(dirs, files)
|
||||||
yield root, dirs, files
|
yield root, dirs, files
|
||||||
num_sep_this = root.count(os.path.sep)
|
num_sep_this = root.count(os.path.sep)
|
||||||
@@ -164,33 +160,26 @@ def dependencyCheck(level):
|
|||||||
try:
|
try:
|
||||||
import raven
|
import raven
|
||||||
except ImportError:
|
except ImportError:
|
||||||
missing.append('raven 5.13.0+')
|
missing.append('raven 6.0.0+')
|
||||||
if level > 1:
|
if level > 1:
|
||||||
try:
|
try:
|
||||||
from psutil import __version__ as psutilVersion
|
from psutil import __version__ as psutilVersion
|
||||||
if StrictVersion('4.1.0') > StrictVersion(psutilVersion):
|
if StrictVersion('5.0.0') > StrictVersion(psutilVersion):
|
||||||
missing.append('psutil 4.1.0+')
|
missing.append('psutil 5.0.0+')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
missing.append('psutil 4.1.0+')
|
missing.append('psutil 5.0.0+')
|
||||||
try:
|
try:
|
||||||
from slugify import __version__ as slugifyVersion
|
from slugify import __version__ as slugifyVersion
|
||||||
if StrictVersion('1.2.0') > StrictVersion(slugifyVersion):
|
if StrictVersion('1.2.1') > StrictVersion(slugifyVersion):
|
||||||
missing.append('python-slugify 1.2.0+')
|
missing.append('python-slugify 1.2.1+')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
missing.append('python-slugify 1.2.0+')
|
missing.append('python-slugify 1.2.1+')
|
||||||
try:
|
try:
|
||||||
from PIL import PILLOW_VERSION as pillowVersion
|
from PIL import PILLOW_VERSION as pillowVersion
|
||||||
if StrictVersion('3.2.0') > StrictVersion(pillowVersion):
|
if StrictVersion('4.0.0') > StrictVersion(pillowVersion):
|
||||||
missing.append('Pillow 3.2.0+')
|
missing.append('Pillow 4.0.0+')
|
||||||
except ImportError:
|
except ImportError:
|
||||||
missing.append('Pillow 3.2.0+')
|
missing.append('Pillow 4.0.0+')
|
||||||
if version_info[1] < 5:
|
|
||||||
try:
|
|
||||||
from scandir import __version__ as scandirVersion
|
|
||||||
if StrictVersion('1.2') > StrictVersion(scandirVersion):
|
|
||||||
missing.append('scandir 1.2+')
|
|
||||||
except ImportError:
|
|
||||||
missing.append('scandir 1.2+')
|
|
||||||
if len(missing) > 0:
|
if len(missing) > 0:
|
||||||
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
|
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|||||||
5
requirements.txt
Normal file
5
requirements.txt
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
PyQt5>=5.6.0
|
||||||
|
Pillow>=4.0.0
|
||||||
|
psutil>=5.0.0
|
||||||
|
python-slugify>=1.2.1
|
||||||
|
raven>=6.0.0
|
||||||
12
setup.py
12
setup.py
@@ -106,7 +106,7 @@ class BuildCommand(build):
|
|||||||
shutil.copyfile('kcc.py', 'build/_scripts/kcc')
|
shutil.copyfile('kcc.py', 'build/_scripts/kcc')
|
||||||
shutil.copyfile('kcc-c2e.py', 'build/_scripts/kcc-c2e')
|
shutil.copyfile('kcc-c2e.py', 'build/_scripts/kcc-c2e')
|
||||||
shutil.copyfile('kcc-c2p.py', 'build/_scripts/kcc-c2p')
|
shutil.copyfile('kcc-c2p.py', 'build/_scripts/kcc-c2p')
|
||||||
# noinspection PyShadowingNames
|
# noinspection PyUnusedLocal,PyShadowingNames
|
||||||
OPTIONS = dict(
|
OPTIONS = dict(
|
||||||
scripts=['build/_scripts/kcc',
|
scripts=['build/_scripts/kcc',
|
||||||
'build/_scripts/kcc-c2e',
|
'build/_scripts/kcc-c2e',
|
||||||
@@ -114,15 +114,13 @@ class BuildCommand(build):
|
|||||||
packages=['kcc'],
|
packages=['kcc'],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'PyQt5>=5.6.0'
|
'PyQt5>=5.6.0'
|
||||||
'Pillow>=3.2.0',
|
'Pillow>=4.0.0',
|
||||||
'psutil>=4.1.0',
|
'psutil>=5.0.0',
|
||||||
'python-slugify>=1.2.0',
|
'python-slugify>=1.2.1',
|
||||||
'raven>=5.13.0',
|
'raven>=6.0.0',
|
||||||
],
|
],
|
||||||
zip_safe=False,
|
zip_safe=False,
|
||||||
)
|
)
|
||||||
if sys.version_info[1] < 5:
|
|
||||||
OPTIONS['install_requires'].append('scandir>=1.2.0')
|
|
||||||
build.run(self)
|
build.run(self)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user