1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 09:46:25 +00:00

Merge pull request #156 from ciromattia/dev

4.6.5
This commit is contained in:
Paweł Jastrzębski
2015-09-17 15:44:42 +02:00
11 changed files with 56 additions and 31 deletions

View File

@@ -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+
@@ -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

View File

@@ -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"

1
kcc.py
View File

@@ -30,6 +30,7 @@ if sys.platform.startswith('darwin'):
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)))

View File

@@ -1127,6 +1127,8 @@ class KCCGUI(KCC_ui.Ui_KCC):
'<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')

View File

@@ -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'

View File

@@ -22,7 +22,10 @@ from zipfile import is_zipfile, ZipFile
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

View File

@@ -28,7 +28,7 @@ from urllib.request import Request, urlopen
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
@@ -37,12 +37,15 @@ from slugify import slugify as slugifyExt
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
@@ -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
@@ -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.")

View File

@@ -24,12 +24,15 @@ from shutil import rmtree, copytree, move
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):

View File

@@ -75,12 +75,12 @@ class MetadataParser:
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()
@@ -168,5 +168,5 @@ class MetadataParser:
extracted = True
if not extracted:
rmtree(workdir)
raise OSError
raise OSError('Failed to modify 7ZIP file.')
rmtree(workdir)

View File

@@ -17,11 +17,12 @@
#
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
@@ -29,7 +30,7 @@ from traceback import format_tb
try:
from scandir import walk
except ImportError:
walk = None
walk = os.walk
class HTMLStripper(HTMLParser):
@@ -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):
@@ -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
@@ -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)

View File

@@ -11,17 +11,17 @@ Usage (Linux):
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
@@ -33,7 +33,7 @@ if platform == 'darwin':
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',
@@ -49,6 +49,7 @@ if platform == 'darwin':
CFBundleTypeRole='Editor',
)
],
CFBundleIdentifier='com.kindlecomicconverter.KindleComicConverter',
LSMinimumSystemVersion='10.8.0',
LSEnvironment=dict(
PATH='./../Resources:/usr/local/bin:/usr/bin:/bin'
@@ -136,10 +137,12 @@ else:
'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,