diff options
-rw-r--r-- | README.md | 2 | ||||
-rw-r--r-- | other/LinuxInit.py | 14 | ||||
-rwxr-xr-x | setup.py | 36 | ||||
-rw-r--r-- | setup.sh | 25 |
4 files changed, 30 insertions, 47 deletions
diff --git a/README.md b/README.md index 6f58a76..26037cd 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ sudo pip3 install pillow python-slugify psutil ``` ### For freezing code: -- Windows/Linux - [cx_Freeze](https://bitbucket.org/anthony_tuininga/cx_freeze) version 4.3.2 with [this](https://bitbucket.org/anthony_tuininga/cx_freeze/pull-request/29/conversions-to-support-untranslated-wide) patchset. +- Windows - [cx_Freeze](https://bitbucket.org/anthony_tuininga/cx_freeze) version 4.3.2 with [this](https://bitbucket.org/anthony_tuininga/cx_freeze/pull-request/29/conversions-to-support-untranslated-wide) patchset. - OS X - [py2app](https://bitbucket.org/ronaldoussoren/py2app) HEAD version. ## USAGE diff --git a/other/LinuxInit.py b/other/LinuxInit.py deleted file mode 100644 index 7fa1150..0000000 --- a/other/LinuxInit.py +++ /dev/null @@ -1,14 +0,0 @@ -import os -import sys -import zipimport - -sys.frozen = True -sys.path = sys.path[:4] -sys.path.insert(0, '/usr/lib/kcc') -sys.path.insert(0, '/usr/local/lib/kcc') -sys.path.insert(0, os.path.join(DIR_NAME, '..', 'lib')) - -m = __import__("__main__") -importer = zipimport.zipimporter(INITSCRIPT_ZIP_FILE_NAME) -code = importer.get_code(m.__name__) -exec(code, m.__dict__) diff --git a/setup.py b/setup.py index 9d73375..6ca1a59 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ cx_Freeze build script for KCC. Usage (Mac OS X): python setup.py py2app -Usage (Windows/Linux): +Usage (Windows): python setup.py build """ from sys import platform, version_info @@ -80,23 +80,8 @@ elif platform == "win32": icon="icons/comic2ebook.ico", compress=False)]) else: - import platform as arch - import os - from cx_Freeze import setup, Executable - if arch.architecture()[0] == '64bit': - library = 'x86_64' - else: - library = 'x86' - extra_options = dict( - options={"build_exe": {"optimize": 2, - "copy_dependent_files": True, - "create_shared_zip": False, - "append_script_to_exe": True, - "init_script": os.path.join(os.getcwd(), 'other', 'LinuxInit.py'), - "excludes": ['tkinter']}}, - executables=[Executable(MAIN, - base=None, - compress=False)]) + print('Please use setup.sh to build Linux package.') + exit() #noinspection PyUnboundLocalVariable setup( @@ -118,17 +103,4 @@ if platform == "darwin": makedirs('dist/' + NAME + '.app/Contents/PlugIns/platforms') 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/7za', 0o777) - -if platform == "linux": - from os import chmod, makedirs, remove - from shutil import copyfile, copytree - makedirs('dist/kcc/bin') - # noinspection PyUnboundLocalVariable - copyfile('build/exe.linux-' + library + '-3.3/kcc', 'dist/kcc/bin/kcc') - chmod('dist/kcc/bin/kcc', 0o755) - # noinspection PyUnboundLocalVariable - copytree('build/exe.linux-' + library + '-3.3', 'dist/kcc/lib') - remove('dist/kcc/lib/kcc') - copyfile('LICENSE.txt', 'dist/kcc/LICENSE.txt') - copyfile('icons/comic2ebook.png', 'dist/kcc/kcc.png') \ No newline at end of file + chmod('dist/' + NAME + '.app/Contents/Resources/7za', 0o777) \ No newline at end of file diff --git a/setup.sh b/setup.sh new file mode 100644 index 0000000..0190722 --- /dev/null +++ b/setup.sh @@ -0,0 +1,25 @@ +#!/bin/bash +# Linux Python package build script + +VERSION="4.0" + +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 \ No newline at end of file |