diff --git a/.gitignore b/.gitignore index ac29f95..025e7f4 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,5 @@ *.cbr .idea build -KindleComicConverter.egg-info awkcc -dist \ No newline at end of file +.DS_Store diff --git a/kcc/comic2ebook.py b/kcc/comic2ebook.py index 03bd72c..e1fd41f 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: @@ -423,7 +421,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", @@ -462,6 +460,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/") diff --git a/setup.py b/setup.py index 5e8af6e..44caed6 100644 --- a/setup.py +++ b/setup.py @@ -1,29 +1,28 @@ """ -py2app/py2exe build script for KCC. +cx_freeze/py2app build script for KCC. -Will automatically ensure that all build prerequisites are available -via ez_setup - -Usage (Mac OS X): - python setup.py py2app +Will automatically ensure that all build prerequisites are available via ez_setup Usage (Windows): python setup.py build + +Usage (OS X): + python setup.py py2app """ from ez_setup import use_setuptools use_setuptools() import sys -from setuptools import setup -NAME = 'KindleComicConverter' +NAME = "KindleComicConverter" VERSION = "2.7" -mainscript = 'kcc.py' +MAIN = "kcc.py" -if sys.platform == 'darwin': +if sys.platform == "darwin": + from setuptools import setup extra_options = dict( setup_requires=['py2app'], - app=[mainscript], + app=[MAIN], options=dict( py2app=dict( argv_emulation=True, @@ -39,50 +38,42 @@ if sys.platform == 'darwin': ) ) ) -elif sys.platform == 'win32': +elif sys.platform == "win32": from cx_Freeze import setup, Executable 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 - ) - ) + 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( - # Normally unix-like platforms will use "setup.py install" - # and install the main script as such - scripts=[mainscript], + scripts=[MAIN], ) 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", + 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", 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' + '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'], - # make sure to add custom_fixers to the MANIFEST.in include_package_data=True, **extra_options ) 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