diff options
author | Paweł Jastrzębski <pawelj@iosphe.re> | 2017-03-11 19:43:32 +0100 |
---|---|---|
committer | Paweł Jastrzębski <pawelj@iosphe.re> | 2017-03-12 13:29:10 +0100 |
commit | d2c12c89e6f759cd3f98c53220c48a7eddfcf774 (patch) | |
tree | dadb5a09db85b5247cdf971c35a4f2b1a2945b3c /kindlecomicconverter | |
parent | Updated README + version bump (diff) | |
download | kcc-d2c12c89e6f759cd3f98c53220c48a7eddfcf774.tar.gz kcc-d2c12c89e6f759cd3f98c53220c48a7eddfcf774.tar.bz2 kcc-d2c12c89e6f759cd3f98c53220c48a7eddfcf774.zip |
Updated dependencies
Diffstat (limited to 'kindlecomicconverter')
-rw-r--r-- | kindlecomicconverter/cbxarchive.py | 6 | ||||
-rwxr-xr-x | kindlecomicconverter/comic2ebook.py | 20 | ||||
-rw-r--r-- | kindlecomicconverter/comic2panel.py | 8 | ||||
-rw-r--r-- | kindlecomicconverter/shared.py | 33 |
4 files changed, 22 insertions, 45 deletions
diff --git a/kindlecomicconverter/cbxarchive.py b/kindlecomicconverter/cbxarchive.py index 726432b..f5765ec 100644 --- a/kindlecomicconverter/cbxarchive.py +++ b/kindlecomicconverter/cbxarchive.py @@ -22,10 +22,6 @@ from zipfile import is_zipfile, ZipFile from subprocess import STDOUT, PIPE from psutil import Popen from shutil import move, copy -try: - from scandir import walk -except ImportError: - walk = os.walk from . import rarfile from .shared import check7ZFile as is_7zfile, saferReplace, saferRemove @@ -63,7 +59,7 @@ class CBxArchive: def extractCBR(self, targetdir): cbrFile = rarfile.RarFile(self.origFileName) cbrFile.extractall(targetdir) - for root, dirnames, filenames in walk(targetdir): + for root, dirnames, filenames in os.walk(targetdir): for filename in filenames: if filename.startswith('__MACOSX') or filename.endswith('.DS_Store') or filename.endswith('humbs.db'): saferRemove(os.path.join(root, filename)) diff --git a/kindlecomicconverter/comic2ebook.py b/kindlecomicconverter/comic2ebook.py index 404ca11..4ab9248 100755 --- a/kindlecomicconverter/comic2ebook.py +++ b/kindlecomicconverter/comic2ebook.py @@ -42,10 +42,6 @@ try: from PyQt5 import QtCore except ImportError: QtCore = None -try: - from scandir import walk -except ImportError: - walk = os.walk from .shared import md5Checksum, getImageFileName, walkSort, walkLevel, saferReplace, saferRemove, sanitizeTrace from . import comic2panel from . import image @@ -424,7 +420,7 @@ def buildEPUB(path, chapterNames, tomeNumber): "display: none;\n", "}\n"]) 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 dirnames, filenames = walkSort(dirnames, filenames) for afile in filenames: @@ -465,7 +461,7 @@ def imgDirectoryProcessing(path): options.imgPurgeIndex = [] work = [] pagenumber = 0 - for (dirpath, dirnames, filenames) in walk(path): + for (dirpath, dirnames, filenames) in os.walk(path): for afile in filenames: pagenumber += 1 work.append([afile, dirpath, options]) @@ -663,7 +659,7 @@ def getCoversFromMCB(mangaID): def getDirectorySize(start_path='.'): total_size = 0 - for dirpath, dirnames, filenames in walk(start_path): + for dirpath, dirnames, filenames in os.walk(start_path): for f in filenames: fp = os.path.join(dirpath, f) total_size += os.path.getsize(fp) @@ -688,7 +684,7 @@ def getPanelViewSize(deviceres, size): def sanitizeTree(filetree): chapterNames = {} - for root, dirs, files in walk(filetree, False): + for root, dirs, files in os.walk(filetree, False): for name in files: splitname = os.path.splitext(name) slugified = slugify(splitname[0]) @@ -714,7 +710,7 @@ def sanitizeTree(filetree): def sanitizeTreeKobo(filetree): pageNumber = 0 - for root, dirs, files in walk(filetree): + for root, dirs, files in os.walk(filetree): dirs, files = walkSort(dirs, files) for name in files: splitname = os.path.splitext(name) @@ -730,7 +726,7 @@ def sanitizeTreeKobo(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: os.chmod(os.path.join(root, name), S_IWRITE | S_IREAD) for name in dirs: @@ -799,7 +795,7 @@ def splitProcess(path, mode): def detectCorruption(tmpPath, orgPath): imageNumber = 0 imageSmaller = 0 - for root, dirs, files in walk(tmpPath, False): + for root, dirs, files in os.walk(tmpPath, False): for name in files: if getImageFileName(name) is not None: path = os.path.join(root, name) @@ -850,7 +846,7 @@ def makeZIP(zipFilename, baseDir, isEPUB=False): zipOutput = ZipFile(zipFilename, 'w', ZIP_DEFLATED) if isEPUB: 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: path = os.path.normpath(os.path.join(dirpath, name)) aPath = os.path.normpath(os.path.join(dirpath.replace(baseDir, ''), name)) diff --git a/kindlecomicconverter/comic2panel.py b/kindlecomicconverter/comic2panel.py index 522587c..6ccdcbc 100644 --- a/kindlecomicconverter/comic2panel.py +++ b/kindlecomicconverter/comic2panel.py @@ -29,10 +29,6 @@ try: from PyQt5 import QtCore except ImportError: QtCore = None -try: - from scandir import walk -except ImportError: - walk = os.walk def mergeDirectoryTick(output): @@ -250,7 +246,7 @@ def main(argv=None, qtGUI=None): mergeWorkerOutput = [] mergeWorkerPool = Pool() 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) for directory in dirs: directoryNumer += 1 @@ -269,7 +265,7 @@ def main(argv=None, qtGUI=None): rmtree(options.targetDir, True) raise RuntimeError("One of workers crashed. Cause: " + mergeWorkerOutput[0][0], mergeWorkerOutput[0][1]) 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: if getImageFileName(name) is not None: pagenumber += 1 diff --git a/kindlecomicconverter/shared.py b/kindlecomicconverter/shared.py index 3843f39..03a7aca 100644 --- a/kindlecomicconverter/shared.py +++ b/kindlecomicconverter/shared.py @@ -27,10 +27,6 @@ from tempfile import mkdtemp from zipfile import ZipFile, ZIP_DEFLATED from re import split from traceback import format_tb -try: - from scandir import walk -except ImportError: - walk = os.walk class HTMLStripper(HTMLParser): @@ -71,7 +67,7 @@ def walkLevel(some_dir, level=1): some_dir = some_dir.rstrip(os.path.sep) assert os.path.isdir(some_dir) 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) yield root, dirs, files num_sep_this = root.count(os.path.sep) @@ -164,33 +160,26 @@ def dependencyCheck(level): try: import raven except ImportError: - missing.append('raven 5.13.0+') + missing.append('raven 6.0.0+') if level > 1: try: from psutil import __version__ as psutilVersion - if StrictVersion('4.1.0') > StrictVersion(psutilVersion): - missing.append('psutil 4.1.0+') + if StrictVersion('5.0.0') > StrictVersion(psutilVersion): + missing.append('psutil 5.0.0+') except ImportError: - missing.append('psutil 4.1.0+') + missing.append('psutil 5.0.0+') try: from slugify import __version__ as slugifyVersion - if StrictVersion('1.2.0') > StrictVersion(slugifyVersion): - missing.append('python-slugify 1.2.0+') + if StrictVersion('1.2.1') > StrictVersion(slugifyVersion): + missing.append('python-slugify 1.2.1+') except ImportError: - missing.append('python-slugify 1.2.0+') + missing.append('python-slugify 1.2.1+') try: from PIL import PILLOW_VERSION as pillowVersion - if StrictVersion('3.2.0') > StrictVersion(pillowVersion): - missing.append('Pillow 3.2.0+') + if StrictVersion('4.0.0') > StrictVersion(pillowVersion): + missing.append('Pillow 4.0.0+') except ImportError: - missing.append('Pillow 3.2.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+') + missing.append('Pillow 4.0.0+') if len(missing) > 0: print('ERROR: ' + ', '.join(missing) + ' is not installed!') exit(1) |