Skip to content

Commit

Permalink
Merge pull request #156 from ciromattia/dev
Browse files Browse the repository at this point in the history
4.6.5
  • Loading branch information
AcidWeb committed Sep 17, 2015
2 parents eab63a0 + 1129177 commit 1fa6d31
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 31 deletions.
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ 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](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.4.0+
- [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.1+
- [Pillow](http://pypi.python.org/pypi/Pillow/) 2.8.2+
- [psutil](https://pypi.python.org/pypi/psutil) 3.0.0+
- [python-slugify](http://pypi.python.org/pypi/python-slugify) 1.1.3+
Expand Down Expand Up @@ -156,6 +156,10 @@ The app relies and includes the following scripts:
* [Kobo Aura H2O](http://kcc.iosphe.re/Samples/Ubunchu-KoAH2O.kepub.epub)

## CHANGELOG
####4.6.5:
* Fixed multiple Windows and OS X issues
* Allowed Linux release to use older PyQT5 version

####4.6.4:
* Fixed multiple Windows specific problems
* Improved error handling
Expand Down
2 changes: 1 addition & 1 deletion kcc.iss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#define MyAppName "Kindle Comic Converter"
#define MyAppVersion "4.6.4"
#define MyAppVersion "4.6.5"
#define MyAppPublisher "Ciro Mattia Gonano, Paweł Jastrzębski"
#define MyAppURL "http://kcc.iosphe.re/"
#define MyAppExeName "KCC.exe"
Expand Down
1 change: 1 addition & 0 deletions kcc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
os.environ['PATH'] = os.path.dirname(os.path.abspath(__file__)) + '/other/:' + os.environ['PATH']
else:
os.environ['PATH'] = './../Resources:/usr/local/bin:/usr/bin:/bin'
os.system('defaults write com.kindlecomicconverter.KindleComicConverter ApplePersistenceIgnoreState YES')
elif sys.platform.startswith('win'):
if getattr(sys, 'frozen', False):
os.chdir(os.path.dirname(os.path.abspath(sys.executable)))
Expand Down
2 changes: 2 additions & 0 deletions kcc/KCC_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -1127,6 +1127,8 @@ def detectKindleGen(self, startup=False):
'<b>KindleGen</b></a>! MOBI conversion will be unavailable!', 'error')
if sys.platform.startswith('win'):
self.addMessage('Download it and place EXE in KCC directory.', 'error')
elif sys.platform.startswith('darwin'):
self.addMessage('Install it using <a href="http://brew.sh/">Brew</a>.', 'error')
else:
self.addMessage('Download it and place executable in /usr/local/bin directory.', 'error')

Expand Down
2 changes: 1 addition & 1 deletion kcc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = '4.6.4'
__version__ = '4.6.5'
__license__ = 'ISC'
__copyright__ = '2012-2015, Ciro Mattia Gonano <ciromattia@gmail.com>, Pawel Jastrzebski <pawelj@iosphe.re>'
__docformat__ = 'restructuredtext en'
5 changes: 4 additions & 1 deletion kcc/cbxarchive.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@
from subprocess import STDOUT, PIPE
from psutil import Popen
from shutil import move, copy
from scandir import walk
try:
from scandir import walk
except ImportError:
walk = os.walk
from . import rarfile
from .shared import check7ZFile as is_7zfile, saferReplace

Expand Down
19 changes: 13 additions & 6 deletions kcc/comic2ebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
from re import sub
from stat import S_IWRITE, S_IREAD, S_IEXEC
from zipfile import ZipFile, ZIP_STORED, ZIP_DEFLATED
from tempfile import mkdtemp, gettempdir
from tempfile import mkdtemp, gettempdir, TemporaryFile
from shutil import move, copytree, rmtree
from optparse import OptionParser, OptionGroup
from multiprocessing import Pool
Expand All @@ -37,12 +37,15 @@
from PIL import Image
from subprocess import STDOUT, PIPE
from psutil import Popen, virtual_memory
from scandir import walk
from html import escape
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
from . import comic2panel
from . import image
Expand Down Expand Up @@ -678,7 +681,8 @@ def getWorkFolder(afile):
rmtree(workdir, True)
raise UserWarning("Failed to detect archive format.")
newpath = mkdtemp('', 'KCC-')
move(path, os.path.join(newpath, 'OEBPS', 'Images'))
copytree(path, os.path.join(newpath, 'OEBPS', 'Images'))
rmtree(path, True)
return newpath


Expand Down Expand Up @@ -1211,10 +1215,13 @@ def checkPre(source):
rmtree(os.path.join(root, tempdir), True)
# Make sure that target directory is writable
if os.path.isdir(source):
writable = os.access(os.path.abspath(os.path.join(source, '..')), os.W_OK)
src = os.path.abspath(os.path.join(source, '..'))
else:
writable = os.access(os.path.dirname(source), os.W_OK)
if not writable:
src = os.path.dirname(source)
try:
with TemporaryFile(prefix='KCC-', dir=src):
pass
except:
raise UserWarning("Target directory is not writable.")


Expand Down
5 changes: 4 additions & 1 deletion kcc/comic2panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@
from optparse import OptionParser, OptionGroup
from multiprocessing import Pool
from PIL import Image, ImageStat, ImageOps
from scandir import walk
from .shared import getImageFileName, walkLevel, walkSort
try:
from PyQt5 import QtCore
except ImportError:
QtCore = None
try:
from scandir import walk
except ImportError:
walk = os.walk


def mergeDirectoryTick(output):
Expand Down
6 changes: 3 additions & 3 deletions kcc/metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,12 @@ def __init__(self, source):
extracted = True
if not extracted:
rmtree(workdir)
raise OSError
raise OSError('Failed to extract 7ZIP file.')
if os.path.isfile(tmpXML):
self.rawdata = parse(tmpXML)
rmtree(workdir)
else:
raise OSError
raise OSError('Failed to detect archive format.')
if self.rawdata:
self.parseXML()

Expand Down Expand Up @@ -168,5 +168,5 @@ def saveXML(self):
extracted = True
if not extracted:
rmtree(workdir)
raise OSError
raise OSError('Failed to modify 7ZIP file.')
rmtree(workdir)
26 changes: 14 additions & 12 deletions kcc/shared.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,20 @@
#

import os
from sys import version_info
from hashlib import md5
from html.parser import HTMLParser
from distutils.version import StrictVersion
from time import sleep
from shutil import rmtree, move
from shutil import rmtree, move, copy
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 = None
walk = os.walk


class HTMLStripper(HTMLParser):
Expand Down Expand Up @@ -116,9 +117,9 @@ def removeFromZIP(zipfname, *filenames):
for item in zipread.infolist():
if item.filename not in filenames:
zipwrite.writestr(item, zipread.read(item.filename))
move(tempname, zipfname)
copy(tempname, zipfname)
finally:
rmtree(tempdir)
rmtree(tempdir, True)


def sanitizeTrace(traceback):
Expand All @@ -133,10 +134,10 @@ def dependencyCheck(level):
if level > 2:
try:
from PyQt5.QtCore import qVersion as qtVersion
if StrictVersion('5.4.0') > StrictVersion(qtVersion()):
missing.append('PyQt 5.4.0+')
if StrictVersion('5.2.1') > StrictVersion(qtVersion()):
missing.append('PyQt 5.2.1+')
except ImportError:
missing.append('PyQt 5.4.0+')
missing.append('PyQt 5.2.1+')
if level > 1:
try:
from psutil import __version__ as psutilVersion
Expand All @@ -156,12 +157,13 @@ def dependencyCheck(level):
missing.append('Pillow 2.8.2+')
except ImportError:
missing.append('Pillow 2.8.2+')
try:
from scandir import __version__ as scandirVersion
if StrictVersion('1.1') > StrictVersion(scandirVersion):
if version_info[1] < 5:
try:
from scandir import __version__ as scandirVersion
if StrictVersion('1.1') > StrictVersion(scandirVersion):
missing.append('scandir 1.1+')
except ImportError:
missing.append('scandir 1.1+')
except ImportError:
missing.append('scandir 1.1+')
if len(missing) > 0:
print('ERROR: ' + ', '.join(missing) + ' is not installed!')
exit(1)
13 changes: 8 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
Usage (Mac OS X):
python3 setup.py py2app
"""

from sys import platform, version_info, argv
from kcc import __version__
if version_info[0] != 3:
print('ERROR: This is Python 3 script!')
exit(1)


NAME = 'KindleComicConverter'
VERSION = __version__
MAIN = 'kcc.py'
extra_options = {}


if platform == 'darwin':
from setuptools import setup
from os import chmod, makedirs, system
Expand All @@ -33,7 +33,7 @@
py2app=dict(
argv_emulation=True,
iconfile='icons/comic2ebook.icns',
includes=['sip'],
includes=['sip', 'PyQt5.QtPrintSupport'],
resources=['LICENSE.txt', 'other/qt.conf', 'other/Additional-LICENSE.txt', 'other/unrar', 'other/7za'],
plist=dict(
CFBundleName='Kindle Comic Converter',
Expand All @@ -49,6 +49,7 @@
CFBundleTypeRole='Editor',
)
],
CFBundleIdentifier='com.kindlecomicconverter.KindleComicConverter',
LSMinimumSystemVersion='10.8.0',
LSEnvironment=dict(
PATH='./../Resources:/usr/local/bin:/usr/bin:/bin'
Expand Down Expand Up @@ -136,10 +137,12 @@
'Pillow>=2.8.2',
'psutil>=3.0.0',
'python-slugify>=1.1.3',
'scandir>=1.1.0',
],
zip_safe=False,
)
if version_info[1] < 5:
extra_options['install_requires'].append('scandir>=1.1.0')


setup(
name=NAME,
Expand Down

0 comments on commit 1fa6d31

Please sign in to comment.