1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-15 18:56:28 +00:00

Updated README and Setup

This commit is contained in:
Paweł Jastrzębski
2015-03-09 19:34:42 +01:00
parent 00d239e1d8
commit 561af90b06
3 changed files with 105 additions and 84 deletions

View File

@@ -29,20 +29,8 @@ You can find the latest released binary at the following links:
- **Linux:** [http://kcc.iosphe.re/Linux/](http://kcc.iosphe.re/Linux/) - **Linux:** [http://kcc.iosphe.re/Linux/](http://kcc.iosphe.re/Linux/)
- **OS X (10.8+):** [http://kcc.iosphe.re/OSX/](http://kcc.iosphe.re/OSX/) - **OS X (10.8+):** [http://kcc.iosphe.re/OSX/](http://kcc.iosphe.re/OSX/)
## INPUT FORMATS ## DEPENDENCIES
**KCC** can understand and convert, at the moment, the following input types: Following software is required to run Linux version of **KCC** and/or bare sources:
- Folders containing: PNG, JPG or GIF files
- CBZ, ZIP
- CBR, RAR *(With `unrar` executable)*
- CB7, 7Z *(With `7za` executable)*
- PDF *(Only extracting JPG images)*
## OPTIONAL REQUIREMENTS
- [KindleGen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211) v2.9+ in a directory reachable by your _PATH_ or in _KCC_ directory *(For MOBI generation)*
- [UnRAR](http://www.rarlab.com/download.htm) *(For CBR/RAR support)*
- [7za](http://www.7-zip.org/download.html) *(For 7z/CB7 support)*
### For running from source:
- Python 3.3+ - Python 3.3+
- [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+ - [PyQt](http://www.riverbankcomputing.co.uk/software/pyqt/download5) 5.2.0+
- [Pillow](http://pypi.python.org/pypi/Pillow/) 2.7.0+ - [Pillow](http://pypi.python.org/pypi/Pillow/) 2.7.0+
@@ -50,15 +38,24 @@ You can find the latest released binary at the following links:
- [python-slugify](http://pypi.python.org/pypi/python-slugify) 0.1.0+ - [python-slugify](http://pypi.python.org/pypi/python-slugify) 0.1.0+
- [scandir](https://pypi.python.org/pypi/scandir) 0.9+ - [scandir](https://pypi.python.org/pypi/scandir) 0.9+
On Debian based distributions these two commands should install all dependencies: On Debian based distributions these two commands should install all needed dependencies:
``` ```
sudo apt-get install python3 python3-dev python3-pip python3-pyqt5 libpng-dev libjpeg-dev p7zip-full unrar sudo apt-get install python3 python3-dev python3-pip python3-pyqt5 libpng-dev libjpeg-dev p7zip-full unrar
sudo pip3 install pillow python-slugify psutil scandir sudo pip3 install pillow python-slugify psutil scandir
``` ```
### For freezing code: ### Optional dependencies
- Windows - [py2exe](https://pypi.python.org/pypi/py2exe) 0.9.2.2+ - [KindleGen](http://www.amazon.com/gp/feature.html?ie=UTF8&docId=1000765211) v2.9+ in a directory reachable by your _PATH_ or in _KCC_ directory *(For MOBI generation)*
- OS X - [py2app](https://bitbucket.org/ronaldoussoren/py2app) 0.9.0+ - [UnRAR](http://www.rarlab.com/download.htm) *(For CBR/RAR support)*
- [7za](http://www.7-zip.org/download.html) *(For 7z/CB7 support)*
## INPUT FORMATS
**KCC** can understand and convert, at the moment, the following input types:
- Folders containing: PNG, JPG or GIF files
- CBZ, ZIP
- CBR, RAR *(With `unrar` executable)*
- CB7, 7Z *(With `7za` executable)*
- PDF *(Only extracting JPG images)*
## USAGE ## USAGE
@@ -160,7 +157,7 @@ The app relies and includes the following scripts:
## CHANGELOG ## CHANGELOG
####4.5: ####4.5:
* Added simple ComicRack medadata editor * Added simple ComicRack metadata editor
* Re-enabled Manga Cover Database support * Re-enabled Manga Cover Database support
* ComicRack bookmarks are now parsed * ComicRack bookmarks are now parsed
* Fixed glitches in Kindle Voyage profile * Fixed glitches in Kindle Voyage profile

129
setup.py
View File

@@ -1,25 +1,32 @@
#!/usr/bin/env python3 #!/usr/bin/env python3
""" """
py2exe/py2app build script for KCC. pip/py2exe/py2app build script for KCC.
Usage (Windows): Usage (Windows):
python setup.py py2exe py -3.4 setup.py py2exe
Usage (Linux):
python3 setup.py make_pyz or python3 setup.py install
Usage (Mac OS X): Usage (Mac OS X):
python setup.py py2app python3 setup.py py2app
""" """
from sys import platform, version_info from sys import platform, version_info, argv
from kcc import __version__ from kcc import __version__
if version_info[0] != 3: if version_info[0] != 3:
print('ERROR: This is Python 3 script!') print('ERROR: This is Python 3 script!')
exit(1) exit(1)
NAME = "KindleComicConverter" NAME = 'KindleComicConverter'
VERSION = __version__ VERSION = __version__
MAIN = "kcc.py" MAIN = 'kcc.py'
extra_options = {}
if platform == "darwin": # noinspection PyUnresolvedReferences
if platform == 'darwin':
from setuptools import setup from setuptools import setup
from os import chmod, makedirs
from shutil import copyfile
extra_options = dict( extra_options = dict(
setup_requires=['py2app'], setup_requires=['py2app'],
app=[MAIN], app=[MAIN],
@@ -32,8 +39,8 @@ if platform == "darwin":
plist=dict( plist=dict(
CFBundleName=NAME, CFBundleName=NAME,
CFBundleShortVersionString=VERSION, CFBundleShortVersionString=VERSION,
CFBundleGetInfoString=NAME + " " + VERSION + CFBundleGetInfoString=NAME + ' ' + VERSION +
", written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski", ', written 2012-2015 by Ciro Mattia Gonano and Pawel Jastrzebski',
CFBundleExecutable=NAME, CFBundleExecutable=NAME,
CFBundleDocumentTypes=[ CFBundleDocumentTypes=[
dict( dict(
@@ -52,12 +59,12 @@ if platform == "darwin":
) )
) )
) )
elif platform == "win32": elif platform == 'win32':
# noinspection PyUnresolvedReferences # noinspection PyUnresolvedReferences
import py2exe import py2exe
import platform from platform import architecture
from distutils.core import setup from distutils.core import setup
if platform.architecture()[0] == '64bit': if architecture()[0] == '64bit':
suffix = '_64' suffix = '_64'
else: else:
suffix = '' suffix = ''
@@ -70,44 +77,86 @@ elif platform == "win32":
'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libGLESv2.dll', 'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libGLESv2.dll',
'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libEGL.dll'])] 'C:\Python34' + suffix + '\Lib\site-packages\PyQt5\libEGL.dll'])]
extra_options = dict( extra_options = dict(
options={'py2exe': {"bundle_files": 1, options={'py2exe': {'bundle_files': 1,
"dist_dir": "dist" + suffix, 'dist_dir': 'dist' + suffix,
"compressed": True, 'compressed': True,
"includes": ["sip"], 'includes': ['sip'],
"excludes": ["tkinter"], 'excludes': ['tkinter'],
"optimize": 2}}, 'optimize': 2}},
windows=[{"script": MAIN, windows=[{'script': MAIN,
"dest_base": "KCC", 'dest_base': 'KCC',
"version": VERSION, 'version': VERSION,
"copyright": "Ciro Mattia Gonano, Pawel Jastrzebski © 2012-2015", 'copyright': 'Ciro Mattia Gonano, Pawel Jastrzebski © 2012-2015',
"legal_copyright": "ISC License (ISCL)", 'legal_copyright': 'ISC License (ISCL)',
"product_version": VERSION, 'product_version': VERSION,
"product_name": "Kindle Comic Converter", 'product_name': 'Kindle Comic Converter',
"file_description": "Kindle Comic Converter", 'file_description': 'Kindle Comic Converter',
"icon_resources": [(1, "icons\comic2ebook.ico")]}], 'icon_resources': [(1, 'icons\comic2ebook.ico')]}],
zipfile=None, zipfile=None,
data_files=additional_files) data_files=additional_files)
else: else:
print('Please use setup.sh to build Linux package.') if argv[1] == 'make_pyz':
exit() from os import system
script = '''
cp kcc.py __main__.py
zip kcc.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-bin
cat kcc.zip >> kcc-bin
chmod +x kcc-bin
cp kcc-c2e.py __main__.py
zip kcc-c2e.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-c2e-bin
cat kcc-c2e.zip >> kcc-c2e-bin
chmod +x kcc-c2e-bin
cp kcc-c2p.py __main__.py
zip kcc-c2p.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-c2p-bin
cat kcc-c2p.zip >> kcc-c2p-bin
chmod +x kcc-c2p-bin
tar --xform s:^.*/:: --xform s/LICENSE.txt/LICENSE/ --xform s/kcc-bin/kcc/ --xform s/kcc-c2p-bin/kcc-c2p/ \
--xform s/kcc-c2e-bin/kcc-c2e/ --xform s/comic2ebook/kcc/ -czf KindleComicConverter_linux_'''\
+ VERSION + '''.tar.gz kcc-bin kcc-c2e-bin kcc-c2p-bin LICENSE.txt README.md icons/comic2ebook.png
rm __main__.py kcc.zip kcc-c2e.zip kcc-c2p.zip kcc-bin kcc-c2e-bin kcc-c2p-bin
'''
system("bash -c '%s'" % script)
exit(0)
else:
from setuptools import setup
from os import makedirs
from shutil import copyfile
makedirs('build/_scripts/', exist_ok=True)
copyfile('kcc.py', 'build/_scripts/kcc')
copyfile('kcc-c2e.py', 'build/_scripts/kcc-c2e')
copyfile('kcc-c2p.py', 'build/_scripts/kcc-c2p')
extra_options = dict(
scripts=['build/_scripts/kcc', 'build/_scripts/kcc-c2e', 'build/_scripts/kcc-c2p'],
packages=['kcc'],
install_requires=[
'Pillow>=2.7.0',
'psutil>=2.0',
'python-slugify>=0.1.0',
'scandir>=0.9',
],
zip_safe=False,
)
# noinspection PyUnboundLocalVariable
setup( setup(
name=NAME, name=NAME,
version=VERSION, version=VERSION,
author="Ciro Mattia Gonano, Pawel Jastrzebski", author='Ciro Mattia Gonano, Pawel Jastrzebski',
author_email="ciromattia@gmail.com, pawelj@iosphe.re", author_email='ciromattia@gmail.com, pawelj@iosphe.re',
description="Kindle Comic Converter", description='Comic and manga converter for E-Book readers.',
license="ISC License (ISCL)", license='ISC License (ISCL)',
keywords="kindle comic mobipocket mobi cbz cbr manga", keywords='kindle comic mobipocket mobi cbz cbr manga',
url="http://github.com/ciromattia/kcc", url='http://github.com/ciromattia/kcc',
**extra_options **extra_options
) )
if platform == "darwin": if platform == 'darwin':
from os import chmod, makedirs makedirs('dist/' + NAME + '.app/Contents/PlugIns/platforms', exist_ok=True)
from shutil import copyfile
makedirs('dist/' + NAME + '.app/Contents/PlugIns/platforms')
copyfile('other/libqcocoa.dylib', 'dist/' + NAME + '.app/Contents/PlugIns/platforms/libqcocoa.dylib') copyfile('other/libqcocoa.dylib', 'dist/' + NAME + '.app/Contents/PlugIns/platforms/libqcocoa.dylib')
chmod('dist/' + NAME + '.app/Contents/Resources/unrar', 0o777) chmod('dist/' + NAME + '.app/Contents/Resources/unrar', 0o777)
chmod('dist/' + NAME + '.app/Contents/Resources/7za', 0o777) chmod('dist/' + NAME + '.app/Contents/Resources/7za', 0o777)

View File

@@ -1,25 +0,0 @@
#!/bin/bash
# Linux Python package build script
VERSION="4.5"
cp kcc.py __main__.py
zip kcc.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-bin
cat kcc.zip >> kcc-bin
chmod +x kcc-bin
cp kcc-c2e.py __main__.py
zip kcc-c2e.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-c2e-bin
cat kcc-c2e.zip >> kcc-c2e-bin
chmod +x kcc-c2e-bin
cp kcc-c2p.py __main__.py
zip kcc-c2p.zip __main__.py kcc/*.py
echo "#!/usr/bin/env python3" > kcc-c2p-bin
cat kcc-c2p.zip >> kcc-c2p-bin
chmod +x kcc-c2p-bin
tar --xform s:^.*/:: --xform s/kcc-bin/kcc/ --xform s/kcc-c2p-bin/kcc-c2p/ --xform s/kcc-c2e-bin/kcc-c2e/ --xform s/comic2ebook/kcc/ -czf KindleComicConverter_linux_${VERSION}.tar.gz kcc-bin kcc-c2e-bin kcc-c2p-bin LICENSE.txt icons/comic2ebook.png
rm __main__.py kcc.zip kcc-c2e.zip kcc-c2p.zip kcc-bin kcc-c2e-bin kcc-c2p-bin