1
0
mirror of https://github.com/ciromattia/kcc synced 2025-12-13 01:36:27 +00:00

Added experimental Linux setup

This commit is contained in:
Paweł Jastrzębski
2014-01-22 16:47:55 +01:00
parent a2b9b5aa8b
commit aa96381eb5
5 changed files with 65 additions and 40 deletions

View File

@@ -24,7 +24,7 @@ If you find **KCC** valuable you can consider donating to the authors:
You can find the latest released binary at the following links:
- **Windows:** [http://kcc.vulturis.eu/Windows/](http://kcc.vulturis.eu/Windows/)
- **Linux:** [http://kcc.vulturis.eu/Linux/](http://kcc.vulturis.eu/Linux/)
- **OS X 10.8+:** [http://kcc.vulturis.eu/OSX/](http://kcc.vulturis.eu/OSX/)
- **OS X (10.8+):** [http://kcc.vulturis.eu/OSX/](http://kcc.vulturis.eu/OSX/)
## INPUT FORMATS
**KCC** can understand and convert, at the moment, the following input types:
@@ -46,8 +46,14 @@ You can find the latest released binary at the following links:
- [psutil](https://pypi.python.org/pypi/psutil)
- [python-slugify](http://pypi.python.org/pypi/python-slugify)
On Debian based distributions these two commands should install all dependencies:
```
sudo apt-get install python3 python3-dev python3-pip python3-pyqt5 libtiff-dev libpng-dev libjpeg-dev p7zip-full unrar
sudo pip3 install pillow python-slugify psutil
```
### For freezing code:
- 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.
- 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.
- OS X - [py2app](https://bitbucket.org/ronaldoussoren/py2app) HEAD version.
## USAGE

View File

@@ -47,7 +47,6 @@ Source: "build\exe.win-amd64-3.3\platforms\*"; DestDir: "{app}\platforms\"; Flag
Source: "build\exe.win-amd64-3.3\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "build\exe.win-amd64-3.3\*.pyd"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "build\exe.win-amd64-3.3\*.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "build\exe.win-amd64-3.3\*.zip"; DestDir: "{app}"; Flags: ignoreversion; Check: Is64BitInstallMode
Source: "other\vcredist_x64.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall; Check: Is64BitInstallMode
; x86 files
Source: "build\exe.win32-3.3\imageformats\*"; DestDir: "{app}\imageformats\"; Flags: ignoreversion; Check: not Is64BitInstallMode
@@ -55,7 +54,6 @@ Source: "build\exe.win32-3.3\platforms\*"; DestDir: "{app}\platforms\"; Flags: i
Source: "build\exe.win32-3.3\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "build\exe.win32-3.3\*.pyd"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "build\exe.win32-3.3\*.dll"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "build\exe.win32-3.3\*.zip"; DestDir: "{app}"; Flags: ignoreversion; Check: not Is64BitInstallMode
Source: "other\vcredist_x86.exe"; DestDir: "{tmp}"; Flags: ignoreversion deleteafterinstall; Check: not Is64BitInstallMode
; Common files
Source: "LICENSE.txt"; DestDir: "{app}"; Flags: ignoreversion solidbreak

14
other/LinuxInit.py Normal file
View File

@@ -0,0 +1,14 @@
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__)

View File

@@ -5,10 +5,13 @@ cx_Freeze build script for KCC.
Usage (Mac OS X):
python setup.py py2app
Usage (Windows):
Usage (Windows/Linux):
python setup.py build
"""
from sys import platform
from sys import platform, version_info
if version_info[0] != 3:
print('ERROR: This is Python 3 script!')
exit(1)
NAME = "KindleComicConverter"
VERSION = "4.0"
@@ -60,24 +63,40 @@ elif platform == "win32":
library = 'libEGL32.dll'
base = "Win32GUI"
extra_options = dict(
options={"build_exe": {"include_files": ['LICENSE.txt',
options={"build_exe": {"optimize": 2,
"include_files": ['LICENSE.txt',
['other/UnRAR.exe', 'UnRAR.exe'],
['other/7za.exe', '7za.exe'],
['other/Additional-LICENSE.txt', 'Additional-LICENSE.txt'],
['other/' + library, 'libEGL.dll']
], "compressed": True,
],
"copy_dependent_files": True,
"create_shared_zip": False,
"append_script_to_exe": True,
"excludes": ['tkinter']}},
executables=[Executable(MAIN,
base=base,
targetName="KCC.exe",
icon="icons/comic2ebook.ico",
copyDependentFiles=True,
appendScriptToExe=True,
appendScriptToLibrary=False,
compress=True)])
compress=False)])
else:
print('Please use setup.sh to build Linux package.')
exit()
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)])
#noinspection PyUnboundLocalVariable
setup(
@@ -99,4 +118,17 @@ 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)
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')

View File

@@ -1,25 +0,0 @@
#!/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