Skip to content

Commit

Permalink
Updated dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
AcidWeb committed Mar 12, 2017
1 parent 010ad3c commit d2c12c8
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 59 deletions.
13 changes: 6 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,16 @@ You can find the latest released binary at the following links:
## DEPENDENCIES
Following software is required to run Linux version of **KCC** and/or bare sources:
- Python 3.3+
- [PyQt](https://pypi.python.org/pypi/PyQt5) 5.6.0+
- [Pillow](https://pypi.python.org/pypi/Pillow/) 3.2.0+
- [psutil](https://pypi.python.org/pypi/psutil) 4.1.0+
- [python-slugify](https://pypi.python.org/pypi/python-slugify) 1.2.0+
- [raven](https://pypi.python.org/pypi/raven) 5.13.0+
- [scandir](https://pypi.python.org/pypi/scandir) 1.2.0+ _(needed only when using Python 3.3 or 3.4)_
- [PyQt5](https://pypi.python.org/pypi/PyQt5) 5.6.0+
- [Pillow](https://pypi.python.org/pypi/Pillow/) 4.0.0+
- [psutil](https://pypi.python.org/pypi/psutil) 5.0.0+
- [python-slugify](https://pypi.python.org/pypi/python-slugify) 1.2.1+
- [raven](https://pypi.python.org/pypi/raven) 6.0.0+

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 pip3 install --upgrade pillow python-slugify psutil scandir raven pyqt5
sudo pip3 install --upgrade pillow python-slugify psutil pyqt5 raven
```

### Optional dependencies
Expand Down
6 changes: 1 addition & 5 deletions kindlecomicconverter/cbxarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@
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

Expand Down Expand Up @@ -63,7 +59,7 @@ def extractCBZ(self, targetdir):
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))
Expand Down
20 changes: 8 additions & 12 deletions kindlecomicconverter/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@
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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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])
Expand Down Expand Up @@ -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)
Expand All @@ -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])
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
8 changes: 2 additions & 6 deletions kindlecomicconverter/comic2panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@
from PyQt5 import QtCore
except ImportError:
QtCore = None
try:
from scandir import walk
except ImportError:
walk = os.walk


def mergeDirectoryTick(output):
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
33 changes: 11 additions & 22 deletions kindlecomicconverter/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@
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):
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
5 changes: 5 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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 changes: 5 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,23 +106,21 @@ def run(self):
shutil.copyfile('kcc.py', 'build/_scripts/kcc')
shutil.copyfile('kcc-c2e.py', 'build/_scripts/kcc-c2e')
shutil.copyfile('kcc-c2p.py', 'build/_scripts/kcc-c2p')
# noinspection PyShadowingNames
# noinspection PyUnusedLocal,PyShadowingNames
OPTIONS = dict(
scripts=['build/_scripts/kcc',
'build/_scripts/kcc-c2e',
'build/_scripts/kcc-c2p'],
packages=['kcc'],
install_requires=[
'PyQt5>=5.6.0'
'Pillow>=3.2.0',
'psutil>=4.1.0',
'python-slugify>=1.2.0',
'raven>=5.13.0',
'Pillow>=4.0.0',
'psutil>=5.0.0',
'python-slugify>=1.2.1',
'raven>=6.0.0',
],
zip_safe=False,
)
if sys.version_info[1] < 5:
OPTIONS['install_requires'].append('scandir>=1.2.0')
build.run(self)


Expand Down

0 comments on commit d2c12c8

Please sign in to comment.