mirror of
https://github.com/ciromattia/kcc
synced 2025-12-13 09:46:25 +00:00
Overhauled startup functions for PyPI packaging
This commit is contained in:
1
MANIFEST.in
Normal file
1
MANIFEST.in
Normal file
@@ -0,0 +1 @@
|
|||||||
|
exclude kindlecomicconverter/sentry.py
|
||||||
@@ -23,14 +23,9 @@ if sys.version_info[0] != 3:
|
|||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
from kindlecomicconverter.shared import dependencyCheck
|
|
||||||
dependencyCheck(2)
|
|
||||||
|
|
||||||
from multiprocessing import freeze_support
|
from multiprocessing import freeze_support
|
||||||
from kindlecomicconverter import __version__
|
from kindlecomicconverter.startup import startC2E
|
||||||
from kindlecomicconverter.comic2ebook import main
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
freeze_support()
|
freeze_support()
|
||||||
print('comic2ebook v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
|
startC2E()
|
||||||
sys.exit(main(sys.argv[1:]))
|
|
||||||
|
|||||||
@@ -23,14 +23,9 @@ if sys.version_info[0] != 3:
|
|||||||
print('ERROR: This is Python 3 script!')
|
print('ERROR: This is Python 3 script!')
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
from kindlecomicconverter.shared import dependencyCheck
|
|
||||||
dependencyCheck(1)
|
|
||||||
|
|
||||||
from multiprocessing import freeze_support
|
from multiprocessing import freeze_support
|
||||||
from kindlecomicconverter import __version__
|
from kindlecomicconverter.startup import startC2P
|
||||||
from kindlecomicconverter.comic2panel import main
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
freeze_support()
|
freeze_support()
|
||||||
print('comic2panel v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
|
startC2P()
|
||||||
sys.exit(main(sys.argv[1:]))
|
|
||||||
20
kcc.py
20
kcc.py
@@ -63,24 +63,10 @@ if getattr(sys, 'frozen', False):
|
|||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
from kindlecomicconverter.shared import dependencyCheck
|
|
||||||
dependencyCheck(3)
|
|
||||||
|
|
||||||
from multiprocessing import freeze_support
|
from multiprocessing import freeze_support
|
||||||
from kindlecomicconverter import KCC_gui
|
from kindlecomicconverter.startup import start
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
freeze_support()
|
freeze_support()
|
||||||
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = "1"
|
start()
|
||||||
KCCAplication = KCC_gui.QApplicationMessaging(sys.argv)
|
|
||||||
if KCCAplication.isRunning():
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
KCCAplication.sendMessage(sys.argv[1])
|
|
||||||
else:
|
|
||||||
KCCAplication.sendMessage('ARISE')
|
|
||||||
else:
|
|
||||||
KCCWindow = KCC_gui.QMainWindowKCC()
|
|
||||||
KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow)
|
|
||||||
if len(sys.argv) > 1:
|
|
||||||
KCCUI.handleMessage(sys.argv[1])
|
|
||||||
sys.exit(KCCAplication.exec_())
|
|
||||||
|
|||||||
53
kindlecomicconverter/startup.py
Normal file
53
kindlecomicconverter/startup.py
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
#
|
||||||
|
# Copyright (c) 2012-2014 Ciro Mattia Gonano <ciromattia@gmail.com>
|
||||||
|
# Copyright (c) 2013-2017 Pawel Jastrzebski <pawelj@iosphe.re>
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for
|
||||||
|
# any purpose with or without fee is hereby granted, provided that the
|
||||||
|
# above copyright notice and this permission notice appear in all
|
||||||
|
# copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
|
||||||
|
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
|
||||||
|
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
|
||||||
|
# AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
|
||||||
|
# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
|
||||||
|
# OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
|
||||||
|
# TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
#
|
||||||
|
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
from . import __version__
|
||||||
|
from .shared import dependencyCheck
|
||||||
|
|
||||||
|
def start():
|
||||||
|
dependencyCheck(3)
|
||||||
|
from . import KCC_gui
|
||||||
|
os.environ['QT_AUTO_SCREEN_SCALE_FACTOR'] = "1"
|
||||||
|
KCCAplication = KCC_gui.QApplicationMessaging(sys.argv)
|
||||||
|
if KCCAplication.isRunning():
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
KCCAplication.sendMessage(sys.argv[1])
|
||||||
|
else:
|
||||||
|
KCCAplication.sendMessage('ARISE')
|
||||||
|
else:
|
||||||
|
KCCWindow = KCC_gui.QMainWindowKCC()
|
||||||
|
KCCUI = KCC_gui.KCCGUI(KCCAplication, KCCWindow)
|
||||||
|
if len(sys.argv) > 1:
|
||||||
|
KCCUI.handleMessage(sys.argv[1])
|
||||||
|
sys.exit(KCCAplication.exec_())
|
||||||
|
|
||||||
|
def startC2E():
|
||||||
|
dependencyCheck(2)
|
||||||
|
from .comic2ebook import main
|
||||||
|
print('comic2ebook v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
|
|
||||||
|
def startC2P():
|
||||||
|
dependencyCheck(1)
|
||||||
|
from .comic2panel import main
|
||||||
|
print('comic2panel v' + __version__ + ' - Written by Ciro Mattia Gonano and Pawel Jastrzebski.')
|
||||||
|
sys.exit(main(sys.argv[1:]))
|
||||||
54
setup.py
54
setup.py
@@ -6,7 +6,7 @@ Usage (Windows):
|
|||||||
py -3 setup.py build_binary
|
py -3 setup.py build_binary
|
||||||
|
|
||||||
Usage (Linux/OS X):
|
Usage (Linux/OS X):
|
||||||
python3 setup.py build_binary or python3 setup.py build_binary --pyz
|
python3 setup.py build_binary
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
@@ -60,42 +60,8 @@ class BuildBinaryCommand(distutils.cmd.Command):
|
|||||||
os.system('setup.bat')
|
os.system('setup.bat')
|
||||||
exit(0)
|
exit(0)
|
||||||
else:
|
else:
|
||||||
if self.pyz:
|
os.system('docker run --rm -v ' + os.getcwd() + ':/app -e KCCVER=' + VERSION + ' acidweb/kcc')
|
||||||
script = '''
|
exit(0)
|
||||||
cp kcc.py __main__.py
|
|
||||||
zip kcc.zip __main__.py kindlecomicconverter/*.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 kindlecomicconverter/*.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 kindlecomicconverter/*.py
|
|
||||||
echo "#!/usr/bin/env python3" > kcc-c2p-bin
|
|
||||||
cat kcc-c2p.zip >> kcc-c2p-bin
|
|
||||||
chmod +x kcc-c2p-bin
|
|
||||||
|
|
||||||
mkdir dist
|
|
||||||
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 dist/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
|
|
||||||
'''
|
|
||||||
os.system("bash -c '%s'" % script)
|
|
||||||
exit(0)
|
|
||||||
else:
|
|
||||||
os.system('docker run --rm -v ' + os.getcwd() + ':/app -e KCCVER=' + VERSION + ' acidweb/kcc')
|
|
||||||
exit(0)
|
|
||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
cmdclass={
|
cmdclass={
|
||||||
@@ -109,12 +75,18 @@ setuptools.setup(
|
|||||||
license='ISC License (ISCL)',
|
license='ISC License (ISCL)',
|
||||||
keywords=['kindle', 'kobo', 'comic', 'manga', 'mobi', 'epub', 'cbz'],
|
keywords=['kindle', 'kobo', 'comic', 'manga', 'mobi', 'epub', 'cbz'],
|
||||||
url='http://github.com/ciromattia/kcc',
|
url='http://github.com/ciromattia/kcc',
|
||||||
scripts=['kcc.py',
|
entry_points={
|
||||||
'kcc-c2e.py',
|
'console_scripts': [
|
||||||
'kcc-c2p.py'],
|
'kcc-c2e = kindlecomicconverter.startup:startC2E',
|
||||||
|
'kcc-c2p = kindlecomicconverter.startup:startC2P',
|
||||||
|
],
|
||||||
|
'gui_scripts': [
|
||||||
|
'kcc = kindlecomicconverter.startup:start',
|
||||||
|
],
|
||||||
|
},
|
||||||
packages=['kindlecomicconverter'],
|
packages=['kindlecomicconverter'],
|
||||||
install_requires=[
|
install_requires=[
|
||||||
'PyQt5>=5.6.0'
|
'PyQt5>=5.6.0',
|
||||||
'Pillow>=4.0.0',
|
'Pillow>=4.0.0',
|
||||||
'psutil>=5.0.0',
|
'psutil>=5.0.0',
|
||||||
'python-slugify>=1.2.1',
|
'python-slugify>=1.2.1',
|
||||||
|
|||||||
Reference in New Issue
Block a user