From b6fa993c1755a8b19f5a0a7746b45b3080850df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 8 Mar 2013 17:05:17 +0100 Subject: [PATCH 1/4] Fixed splitCount global --- kcc/comic2ebook.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 53cb599..92026a7 100755 --- a/kcc/comic2ebook.py +++ b/kcc/comic2ebook.py @@ -266,9 +266,7 @@ def applyImgOptimization(img, isSplit=False, toRight=False): def dirImgProcess(path): - global options - global splitCount - splitCount = 0 + global options, splitCount if options.righttoleft: facing = "right" else: @@ -428,7 +426,7 @@ def Usage(): def main(argv=None): - global parser, options, epub_path + global parser, options, epub_path, splitCount usage = "Usage: %prog [options] comic_file|comic_folder" parser = OptionParser(usage=usage, version=__version__) parser.add_option("-p", "--profile", action="store", dest="profile", default="KHD", @@ -467,6 +465,7 @@ def main(argv=None): path = getWorkFolder(args[0]) if options.title == 'defaulttitle': options.title = os.path.splitext(os.path.basename(args[0]))[0] + splitCount = 0 if options.imgproc: print "Processing images..." dirImgProcess(path + "/OEBPS/Images/") From d76ce6c92fc1c7cd74e4b3ebfa3e1e6f83c752b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 8 Mar 2013 17:27:54 +0100 Subject: [PATCH 2/4] Improved setup_console.py --- setup_console.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/setup_console.py b/setup_console.py index 605838f..58001d0 100644 --- a/setup_console.py +++ b/setup_console.py @@ -8,15 +8,15 @@ import sys from cx_Freeze import setup, Executable sys.path.insert(0, 'kcc') -setup( name = "KindleComicConverter", - version = "2.7", - author = "Ciro Mattia Gonano", - author_email = "ciromattia@gmail.com", - description = "A tool to convert comics (CBR/CBZ/PDFs/image folders) to MOBI.", - license= " ISC License (ISCL)", - keywords= "kindle comic mobipocket mobi cbz cbr manga", - url = "http://github.com/ciromattia/kcc", - options = {"build_exe": {}}, - executables = [Executable("kcc/comic2ebook.py", appendScriptToExe=True, appendScriptToLibrary=False), - Executable("kcc/kindlestrip.py", appendScriptToExe=True, appendScriptToLibrary=False)] - ) \ No newline at end of file +setup( + name = "KindleComicConverter", + version = "2.7", + author = "Ciro Mattia Gonano", + author_email = "ciromattia@gmail.com", + description = "A tool to convert comics (CBR/CBZ/PDFs/image folders) to MOBI.", + license= "ISC License (ISCL)", + keywords= "kindle comic mobipocket mobi cbz cbr manga", + url = "http://github.com/ciromattia/kcc", + executables = [Executable("kcc/comic2ebook.py", appendScriptToExe=True, appendScriptToLibrary=False), + Executable("kcc/kindlestrip.py", appendScriptToExe=True, appendScriptToLibrary=False)] +) \ No newline at end of file From 0fd3f6bc0f60549af57423c5ce191fac14a91bc9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Fri, 8 Mar 2013 17:55:26 +0100 Subject: [PATCH 3/4] setup.py py2exe/app -> cx_freeze Not tested on OS X. --- .gitignore | 4 +-- setup.py | 95 +++++++++++++----------------------------------------- 2 files changed, 24 insertions(+), 75 deletions(-) diff --git a/.gitignore b/.gitignore index ac29f95..d540bee 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,4 @@ *.cbr .idea build -KindleComicConverter.egg-info -awkcc -dist \ No newline at end of file +awkcc \ No newline at end of file diff --git a/setup.py b/setup.py index 5e8af6e..8106f72 100644 --- a/setup.py +++ b/setup.py @@ -1,88 +1,39 @@ """ -py2app/py2exe build script for KCC. +cx_freeze build script for KCC. -Will automatically ensure that all build prerequisites are available -via ez_setup +Will automatically ensure that all build prerequisites are available via ez_setup -Usage (Mac OS X): - python setup.py py2app - -Usage (Windows): +Usage (Windows/Mac OS X): python setup.py build """ from ez_setup import use_setuptools use_setuptools() import sys -from setuptools import setup +from cx_Freeze import setup, Executable -NAME = 'KindleComicConverter' +NAME = "KindleComicConverter" VERSION = "2.7" -mainscript = 'kcc.py' +MAIN = "kcc.py" -if sys.platform == 'darwin': - extra_options = dict( - setup_requires=['py2app'], - app=[mainscript], - options=dict( - py2app=dict( - argv_emulation=True, - iconfile='comic2ebook.icns', - plist=dict( - CFBundleName=NAME, - CFBundleShortVersionString=VERSION, - CFBundleGetInfoString=NAME + " " + VERSION + ", written 2012-2013 by Ciro Mattia Gonano", - CFBundleExecutable=NAME, - CFBundleIdentifier='com.github.ciromattia.kcc', - CFBundleSignature='dplt' - ) - ) - ) - ) -elif sys.platform == 'win32': - from cx_Freeze import setup, Executable +if sys.platform == "darwin": + icon = "comic2ebook.icns" + base = None + buildEXEOptions = {} +elif sys.platform == "win32": + icon = "comic2ebook.ico" base = "Win32GUI" - extra_options = dict( - executables=[Executable("kcc.py", base=base, icon='comic2ebook.ico', - appendScriptToExe=True, appendScriptToLibrary=False)], - options=dict( - build_exe=dict( - compressed=True - ) - ) - ) -else: - extra_options = dict( - # Normally unix-like platforms will use "setup.py install" - # and install the main script as such - scripts=[mainscript], - ) + buildEXEOptions = {"include_files": ["comic2ebook.ico"]} setup( - name=NAME, - version=VERSION, - author="Ciro Mattia Gonano", - author_email="ciromattia@gmail.com", - description="A tool to convert comics (CBR/CBZ/PDFs/image folders) to Mobipocket.", - license="ISC License (ISCL)", - keywords="kindle comic mobipocket mobi cbz cbr manga", - url="http://github.com/ciromattia/kcc", - classifiers=[ - 'Development Status :: 4 - Beta' - 'License :: OSI Approved :: ISC License (ISCL)', - 'Environment :: Console', - 'Environment :: MacOS X', - 'Environment :: Win32 (MS Windows)', - 'Environment :: X11 Applications', - 'Intended Audience :: End Users/Desktop', - 'Operating System :: OS Independent', - 'Programming Language :: Python', - 'Programming Language :: Python :: 2.7', - 'Topic :: Multimedia :: Graphics :: Graphics Conversion', - 'Topic :: Utilities' - ], - packages=['kcc'], - # make sure to add custom_fixers to the MANIFEST.in - include_package_data=True, - **extra_options + name = NAME, + version = VERSION, + author = "Ciro Mattia Gonano", + author_email = "ciromattia@gmail.com", + description = "A tool to convert comics (CBR/CBZ/PDFs/image folders) to MOBI.", + license = "ISC License (ISCL)", + keywords = "kindle comic mobipocket mobi cbz cbr manga", + url = "http://github.com/ciromattia/kcc", + options = {"build_exe": buildEXEOptions}, + executables = [Executable(MAIN, base=base, icon=icon, appendScriptToExe=True, appendScriptToLibrary=False, compress=True)] ) From a72d1128dd174ba3b0ec0320e96f5f1fe7f6b7f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Jastrz=C4=99bski?= Date: Sat, 9 Mar 2013 16:16:01 +0100 Subject: [PATCH 4/4] Fixed OS X build script --- .gitignore | 3 ++- setup.py | 60 +++++++++++++++++++++++++++++++++++++++++++++--------- 2 files changed, 52 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index d540bee..025e7f4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,5 @@ *.cbr .idea build -awkcc \ No newline at end of file +awkcc +.DS_Store diff --git a/setup.py b/setup.py index 8106f72..44caed6 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,54 @@ """ -cx_freeze build script for KCC. +cx_freeze/py2app build script for KCC. Will automatically ensure that all build prerequisites are available via ez_setup -Usage (Windows/Mac OS X): +Usage (Windows): python setup.py build + +Usage (OS X): + python setup.py py2app """ from ez_setup import use_setuptools use_setuptools() import sys -from cx_Freeze import setup, Executable NAME = "KindleComicConverter" VERSION = "2.7" MAIN = "kcc.py" if sys.platform == "darwin": - icon = "comic2ebook.icns" - base = None - buildEXEOptions = {} + from setuptools import setup + extra_options = dict( + setup_requires=['py2app'], + app=[MAIN], + options=dict( + py2app=dict( + argv_emulation=True, + iconfile='comic2ebook.icns', + plist=dict( + CFBundleName=NAME, + CFBundleShortVersionString=VERSION, + CFBundleGetInfoString=NAME + " " + VERSION + ", written 2012-2013 by Ciro Mattia Gonano", + CFBundleExecutable=NAME, + CFBundleIdentifier='com.github.ciromattia.kcc', + CFBundleSignature='dplt' + ) + ) + ) + ) elif sys.platform == "win32": - icon = "comic2ebook.ico" + from cx_Freeze import setup, Executable base = "Win32GUI" - buildEXEOptions = {"include_files": ["comic2ebook.ico"]} + extra_options = dict( + options = {"build_exe": {"include_files": ["comic2ebook.ico"]}}, + executables=[Executable(MAIN, base=base, icon="comic2ebook.ico", appendScriptToExe=True, appendScriptToLibrary=False, compress=True)] + ) +else: + extra_options = dict( + scripts=[MAIN], + ) setup( name = NAME, @@ -34,6 +59,21 @@ setup( license = "ISC License (ISCL)", keywords = "kindle comic mobipocket mobi cbz cbr manga", url = "http://github.com/ciromattia/kcc", - options = {"build_exe": buildEXEOptions}, - executables = [Executable(MAIN, base=base, icon=icon, appendScriptToExe=True, appendScriptToLibrary=False, compress=True)] + classifiers=[ + 'Development Status :: 4 - Beta' + 'License :: OSI Approved :: ISC License (ISCL)', + 'Environment :: Console', + 'Environment :: MacOS X', + 'Environment :: Win32 (MS Windows)', + 'Environment :: X11 Applications', + 'Intended Audience :: End Users/Desktop', + 'Operating System :: OS Independent', + 'Programming Language :: Python', + 'Programming Language :: Python :: 3', + 'Topic :: Multimedia :: Graphics :: Graphics Conversion', + 'Topic :: Utilities' + ], + packages=['kcc'], + include_package_data=True, + **extra_options )