diff --git a/.gitignore b/.gitignore index d4fbd53a..6b1ecfed 100644 --- a/.gitignore +++ b/.gitignore @@ -10,8 +10,6 @@ test solaio kindlegen* *.spec -setup.bat -setup.sh kindlecomicconverter/sentry.py build/ .python-version diff --git a/.travis.yml b/.travis.yml index a8997369..11a98b41 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,24 +1,46 @@ -language: generic -os: osx -osx_image: xcode6.4 +matrix: + include: + - os: linux + language: python + python: 3.6 + dist: trusty + sudo: required + - os: osx + language: generic + osx_image: xcode6.4 + before_install: -- brew update -- brew install python3 -- brew upgrade node -- pip3 install --upgrade pip setuptools wheel -- openssl aes-256-cbc -K $encrypted_a95564d8ff0d_key -iv $encrypted_a95564d8ff0d_iv -in other/osx/sentry.py.enc -out kindlecomicconverter/sentry.py -d +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then sudo apt-get -y install ruby ruby-dev ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then pip install --upgrade pip setuptools wheel ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then openssl aes-256-cbc -K $encrypted_a95564d8ff0d_key -iv $encrypted_a95564d8ff0d_iv -in other/linux/sentry.py.enc -out kindlecomicconverter/sentry.py -d ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew update ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew install python3 ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then brew upgrade node ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then pip3 install --upgrade pip setuptools wheel ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then openssl aes-256-cbc -K $encrypted_a95564d8ff0d_key -iv $encrypted_a95564d8ff0d_iv -in other/osx/sentry.py.enc -out kindlecomicconverter/sentry.py -d ; fi + install: -- pip3 install -r requirements.txt -- pip3 install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip -- npm install -g appdmg +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then pip install -r requirements.txt ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then pip install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip ; fi +- if [ "$TRAVIS_OS_NAME" == "linux" ] ; then gem install fpm ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then pip3 install -r requirements.txt ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then pip3 install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip ; fi +- if [ "$TRAVIS_OS_NAME" == "osx" ] ; then npm install -g appdmg ; fi + script: python3 setup.py build_binary + +before_deploy: +- shopt -s extglob +- rm -r dist/!(*.deb|*.dmg) + deploy: - provider: releases - api_key: - secure: ZsluoJQ+diDTIjh5tvqdjAdWc1MJX6wSk5vTGFqLAMV0wK8ypGa2+qxDB0sTFR7SRhQlAfBFi0q//li+XdWn6rUkUTqjOuS9xwfdKIYXuIrIJolgsbSeenYuLeAM23VYdH6NYBHVSjIK6O1H7enRkzot4GKZk91A3MZ/SnqBjsc1KvUVmQF19xmLha1y0WYitDCy7P1cT8517Cbhg6q8yTBUn/YjfFKyuDdbQFWe894n767mr33yvm1asHtYUsPYSif6ZdvhNDtMxUMaJTX0lPG6pZQLYV2HQipppMYSdbmsQOhamjPVcF6Chy3TAK5433smk3SiNGjg2wyGiN74JYpcc0MnGE5a5ZaDzBaavSvFrGZiHeygzaZUtFx3spsqcTgdJ1LZZ1aDRTrDhzi3FMjUFDLuwyDD5nJyS9bRHE30T9me7VSAcdJGrz1joShSYK6VMFvHUG3wUk0Bd+3KJZ75lJnP6TqVLgLjkWN4rcaN9caWylzT3ximKuHDg2S2aB23YYC4HFOrYdABM9fGcnuCVDwr16bBNM8zOGxNPswKfLBX1YWBr6EOXbrypMnekZDK2T5aqTP8L0IbImGety7P8b54r7nRTqFnELYrkVxmM+fUKPMPXMm/mZadrGg3bHjZYXm+nq7V6oMI2gEcNbpzKxx6l9XOjiBjN0uk/A0= - file_glob: true - file: dist/KindleComicConverter_osx_* + provider: s3 skip_cleanup: true + access_key_id: AKIAIQNL5R4FI4C4NJYQ + secret_access_key: + secure: X66hYplxB4QSueljwvDfamNH/MQmHjo3mCofBcaTHAr7n2fp+yd2NzD2yy9h8NbsL0LWwx9wtJa/jpkIE02ZDfi9NrMLvKKFazzdpiyTMN5Yh85lHHyD1XIOCZRd4igaZ+O8975tJAEaEOPS+PE9XGZcRBh+y/eSJ+fMEgohaJ1MtDFbQR7X1cEw3iqbjrV2rlghZNCk/9mZEfObzAEjQiSDpv5G0IuIPRvYg/BgZt8chHVAe03B6oqcBa7uCBCTlfHIiNh1MWtP0B3NNBq3dcu9QHOFri1YqoZKuaPVCf6TFQL/NW5dFihegev2t9IwFyaBxytiT8fBkgQhP0VX8cuCwBAfnQGIogAu0eLSPp+E6dB/7Cpt2GDCk39+As8WKqt9hCRHmrvYhPA1Mq9QyEgKy/TKKKfDby3qVTIqYOQYpuQ1B7sIU651L5A+hBvZ1dqWIUz25h0zqjjeSFrcfNnf1e4tkk0QJvvnKqz0xsVaJxA2p07VJMRn8SlZQIJ2GEbMDeB5jxYtf5JzXywChP9adlPNjLna9G8ScnGSU1f7ZhsBQUEgY5jBlnX1lveyl3DUe6NP+qOTyljLWYwjx3AF4Zg10LYSecRS6hnqAUrGRmibDCIYclUzlJkVyjKGJ9uEyrUiCp0P0IsAzE1XhPVAWEyGUcWWGJG+jgmohSk= + bucket: kcc-deploy + region: eu-central-1 + local_dir: dist on: repo: AcidWeb/kcc - tags: true diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 00000000..2a477212 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,27 @@ +environment: + PYTHON: "C:\\Python36-x64" + +install: + - set PATH="%PYTHON%\\Scripts";"C:\\Program Files (x86)\\Inno Setup 5";%PATH% + - "%PYTHON%\\python.exe -m pip install --upgrade pip setuptools wheel" + - "%PYTHON%\\python.exe -m pip install -r requirements.txt" + - "%PYTHON%\\python.exe -m pip install certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip" + - nuget install secure-file -ExcludeVersion + - nuget install verpatch -ExcludeVersion + - secure-file\tools\secure-file -decrypt other\windows\Cert.pfx.enc -secret %ENCRYPTION% + - secure-file\tools\secure-file -decrypt other\windows\sentry.py.enc -out kindlecomicconverter\sentry.py -secret %ENCRYPTION% + +build_script: + - "%PYTHON%\\python.exe setup.py build_binary" + +after_build: + - ps: Get-ChildItem .\dist\KindleComicConverter_win_* | % { Push-AppveyorArtifact $_.FullName -FileName $_.Name } + +deploy: + provider: S3 + access_key_id: + secure: pWfyU8wtAHt354mBILwM41TemOjb+My9n3CRMnrpLzI= + secret_access_key: + secure: G0Xpxe355LMqV3s8v+TsdJYdmhFoKKA+mxK37Tlu8yNwKXKJgcnY7pcFKSdX5xS5 + bucket: kcc-deploy + region: eu-central-1 diff --git a/docker/Build b/docker/Build deleted file mode 100755 index 53ca5577..00000000 --- a/docker/Build +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -set -e - -pip3 install --upgrade pip setuptools wheel -pip3 install pillow python-slugify psutil raven pyqt5 certifi https://github.com/pyinstaller/pyinstaller/archive/develop.zip -gem install fpm - -cd /app -pyinstaller -F -s kcc.py -mkdir -p dist/usr/bin dist/usr/share/applications dist/usr/share/doc/kindlecomicconverter dist/usr/share/kindlecomicconverter dist/usr/share/lintian/overrides -mv dist/kcc dist/usr/bin -cp icons/comic2ebook.png dist/usr/share/kindlecomicconverter -cp LICENSE.txt dist/usr/share/doc/kindlecomicconverter/copyright -cp other/linux/kindlecomicconverter.desktop dist/usr/share/applications -cp other/linux/kindlecomicconverter dist/usr/share/lintian/overrides - -cd /app/dist -fpm -f -s dir -t deb -n kindlecomicconverter -v $KCCVER -m "Paweł Jastrzębski " --license "ISC" --description "$(printf "Comic and Manga converter for e-book readers.\nThis app allows you to transform your PNG, JPG, GIF, CBZ, CBR and CB7 files\ninto EPUB or MOBI format e-books.")" --url "https://kcc.iosphe.re/" --deb-priority "optional" --vendor "" --category "graphics" -d "unrar | unrar-free" -d "p7zip-full" -d "libc6" usr diff --git a/docker/Dockerfile b/docker/Dockerfile deleted file mode 100644 index 89dd7e36..00000000 --- a/docker/Dockerfile +++ /dev/null @@ -1,12 +0,0 @@ -# acidweb/kcc -FROM debian:stretch -MAINTAINER Paweł Jastrzębski - -ADD ./Build /Build - -RUN apt-get update && apt-get -y dist-upgrade -RUN apt-get -y install build-essential curl ruby ruby-dev libpng-dev libjpeg-dev python3 python3-dev python3-pyqt5 -RUN curl https://bootstrap.pypa.io/get-pip.py | python3 -RUN apt-get clean -y && apt-get autoclean -y && apt-get autoremove -y && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -CMD /Build diff --git a/other/linux/sentry.py.enc b/other/linux/sentry.py.enc new file mode 100644 index 00000000..c38a68ce Binary files /dev/null and b/other/linux/sentry.py.enc differ diff --git a/other/windows/Cert.pfx.enc b/other/windows/Cert.pfx.enc new file mode 100644 index 00000000..147cb971 Binary files /dev/null and b/other/windows/Cert.pfx.enc differ diff --git a/other/windows/sentry.py.enc b/other/windows/sentry.py.enc new file mode 100644 index 00000000..930988bf --- /dev/null +++ b/other/windows/sentry.py.enc @@ -0,0 +1,3 @@ +d7э|lz6nI_:-!nBCD}fzIe|\9KWfHLY7^@m*Ym_z`3WSD{"a@>;}\,D·!yX薁~~Y_xd B T +B𢯣 +u|91u~PaLDjh \ No newline at end of file diff --git a/setup.bat b/setup.bat new file mode 100644 index 00000000..ac9de586 --- /dev/null +++ b/setup.bat @@ -0,0 +1,4 @@ +@echo off +verpatch\lib\win\verpatch dist\KCC.exe %1 /va /pv %1 /s product "Kindle Comic Converter" /s description "Kindle Comic Converter" /s copyright "Copyright (C) 2012-2017 Ciro Mattia Gonano and Pawel Jastrzebski" +"C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe" sign /f "%APPVEYOR_BUILD_FOLDER%\other\windows\Cert.pfx" /p "%CERT_PASS%" /t http://time.certum.pl /d "Kindle Comic Converter" /du "http://kcc.iosphe.re/" dist/KCC.exe +iscc /SSignTool="""C:\Program Files (x86)\Windows Kits\8.1\bin\x64\signtool.exe"" sign /f ""%APPVEYOR_BUILD_FOLDER%\other\windows\Cert.pfx"" /p ""%CERT_PASS%"" /t http://time.certum.pl $p" kcc.iss >nul 2>&1 diff --git a/setup.py b/setup.py index 563e5cbf..fc033626 100755 --- a/setup.py +++ b/setup.py @@ -31,12 +31,11 @@ def initialize_options(self): def finalize_options(self): pass + # noinspection PyShadowingNames def run(self): + VERSION = __version__ if sys.platform == 'darwin': - if os.path.isfile('Kindle Comic Converter.spec'): - os.system('pyinstaller "Kindle Comic Converter.spec"') - else: - os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s kcc.py') + os.system('pyinstaller -y -F -i icons/comic2ebook.icns -n "Kindle Comic Converter" -w -s kcc.py') shutil.copy('other/osx/7za', 'dist/Kindle Comic Converter.app/Contents/Resources') shutil.copy('other/osx/unrar', 'dist/Kindle Comic Converter.app/Contents/Resources') shutil.copy('other/osx/Info.plist', 'dist/Kindle Comic Converter.app/Contents') @@ -44,20 +43,32 @@ def run(self): shutil.copy('other/windows/Additional-LICENSE.txt', 'dist/Kindle Comic Converter.app/Contents/Resources') os.chmod('dist/Kindle Comic Converter.app/Contents/Resources/unrar', 0o777) os.chmod('dist/Kindle Comic Converter.app/Contents/Resources/7za', 0o777) - if os.path.isfile('setup.sh'): - os.system('./setup.sh') os.system('appdmg kcc.json dist/KindleComicConverter_osx_' + VERSION + '.dmg') exit(0) elif sys.platform == 'win32': - if os.path.isfile('KCC.spec'): - os.system('pyinstaller KCC.spec') - else: - os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w --noupx kcc.py') - if os.path.isfile('setup.bat'): - os.system('setup.bat') + os.system('pyinstaller -y -F -i icons\comic2ebook.ico -n KCC -w --noupx kcc.py') + if os.getenv('APPVEYOR'): + if len(VERSION) == 3: + VERSION = VERSION + '.0' + os.system('setup.bat ' + VERSION) exit(0) else: - os.system('docker run --rm -v ' + os.getcwd() + ':/app -e KCCVER=' + VERSION + ' acidweb/kcc') + os.system('pyinstaller -F -s kcc.py') + os.system('mkdir -p dist/usr/bin dist/usr/share/applications dist/usr/share/doc/kindlecomicconverter ' + 'dist/usr/share/kindlecomicconverter dist/usr/share/lintian/overrides') + os.system('mv dist/kcc dist/usr/bin') + os.system('cp icons/comic2ebook.png dist/usr/share/kindlecomicconverter') + os.system('cp LICENSE.txt dist/usr/share/doc/kindlecomicconverter/copyright') + os.system('cp other/linux/kindlecomicconverter.desktop dist/usr/share/applications') + os.system('cp other/linux/kindlecomicconverter dist/usr/share/lintian/overrides') + os.chdir('dist') + os.system('fpm -f -s dir -t deb -n kindlecomicconverter -v ' + VERSION + + ' -m "Paweł Jastrzębski " --license "ISC" ' + '--description "$(printf "Comic and Manga converter for e-book ' + 'readers.\nThis app allows you to transform your PNG, JPG, GIF, ' + 'CBZ, CBR and CB7 files\ninto EPUB or MOBI format e-books.")" ' + '--url "https://kcc.iosphe.re/" --deb-priority "optional" --vendor "" ' + '--category "graphics" -d "unrar | unrar-free" -d "p7zip-full" -d "libc6" usr') exit(0) setuptools.setup(