Open CookieCaptainD opened 2 years ago
@CookieCaptainD Thanks for your contributions to KCC too :thumbsup: :wink:
I don't own a Native Apple silicon machine but I started working on this (pipeline_test branch).
pyinstaller supports multi-arch https://pyinstaller.org/en/stable/feature-notes.html#macos-multi-arch-support
Github is now providing actions/runner binaries for Apple Silicon.... but self-hosted only. 😠https://github.blog/changelog/2022-08-09-github-actions-self-hosted-runners-now-support-apple-m1-hardware/
But unfortunately, GitHub Actions Runner Images don't work with this arch yet. Python needs to be installed from source
you'll have to compile any non pure Python dependency from source
And those tools will need to be adapted to work with native apple silicon https://github.com/darodi/kcc/tree/beta_release/other/osx
Those links might help later
situation so far... I'm getting an error with PyQt5
see https://github.com/darodi/kcc/actions/runs/3192912436/jobs/5210920025
27894 INFO: Executing - strip-S/Users/runner/Library/Application Support/pyinstaller/bincache10_py38_64bit/universal2/adhoc/no-entitlements/lib-dynload/_codecs_tw.cpython-38-darwin.so
28002 INFO: Executing - strip-S/Users/runner/Library/Application Support/pyinstaller/bincache10_py38_64bit/universal2/adhoc/no-entitlements/lib-dynload/_codecs_hk.cpython-38-darwin.so
28114 INFO: Executing - strip-S/Users/runner/Library/Application Support/pyinstaller/bincache10_py38_64bit/universal2/adhoc/no-entitlements/PyQt5/QtCore.abi3.so
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 194, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/runpy.py", line 87, in _run_code
exec(code, run_globals)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 189, in <module>
run()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 179, in run
run_build(pyi_config, spec_file, **vars(args))
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/__main__.py", line 60, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 962, in main
build(specfile, distpath, workpath, clean_build)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/build_main.py", line 884, in build
exec(code, spec_namespace)
File "/Users/runner/work/kcc/kcc/Kindle Comic Converter.spec", line 24, in <module>
exe = EXE(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 518, in __init__
self.pkg = PKG(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 218, in __init__
self.__postinit__()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/datastruct.py", line 173, in __postinit__
self.assemble()
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/api.py", line 281, in assemble
fnm = checkCache(
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/building/utils.py", line 381, in checkCache
osxutils.binary_to_target_arch(cachedfile, target_arch, display_name=fnm)
File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/PyInstaller/utils/osx.py", line 312, in binary_to_target_arch
raise IncompatibleBinaryArchError(f"{display_name} is not a fat binary!")
edit darodi wiki page added here: https://github.com/ciromattia/kcc/wiki/How-to-build-M1
I figure out a way to build it on M1. Here the result: https://static.celogeek.com/KCC/M1/KindleComicConverter_osx_5.5.3b17.dmg
So to do that: I use pyenv.
So for the repo
pyenv install 3.9.16
pyenv virtualenv 3.9.16 kindle
pyenv activate kindle
brew install pyqt@5 boost-python3 cmake
export PYTHONPATH=/opt/homebrew/Cellar/pyqt@5/5.15.7_1/lib/python3.9/site-packages
pip install -r requirements.txt
You need a m1 compatible version of 7z:
git clone https://github.com/p7zip-project/p7zip.git
cd p7zip
git checkout v17.04
make -j4 7z
In the bin directory, you will have
bin
├── 7z
├── 7z.so
├── 7za
└── Codecs
└── Rar.so
Copy and replace those files into other/osx
git status
modified: other/osx/7z
modified: other/osx/7z.so
modified: other/osx/Rar.so
rm -rf dist
python setup.py build_binary
You should have in the dist directory the DMG that should works.
To update I think until we have a solution:
git stash
git pull
git stash pop
rm -rf dist
python setup.py build_binary
Let me know if it works for you.
Hi @darodi
I've made a fast and native version in Go Lang of the tools to convert Comic to Epub: https://github.com/celogeek/go-comic-converter
For 190 Pages, in KS profile, from a CBZ, it take 8s on my M1.
It support Crop, CBZ, ZIP, CBR, RAR, PDF. It support split for epub (with size). It add a first page with Title, Part X / Y. It easy to install. It should work on Mac (all arch), linux (all arch), and may be windows.
Each image is loaded, convert into grayscale, margin crop, resize.
Give it a try ;)
I will add comment soon on the code. And improve readability.
@celogeek
Hi @darodi
I've made a fast and native version in Go Lang of the tools to convert Comic to Epub: https://github.com/celogeek/go-comic-converter
For 190 Pages, in KS profile, from a CBZ, it take 8s on my M1.
It support Crop, CBZ, ZIP, CBR, RAR, PDF. It support split for epub (with size). It add a first page with Title, Part X / Y. It easy to install. It should work on Mac (all arch), linux (all arch), and may be windows.
Each image is loaded, convert into grayscale, margin crop, resize.
Give it a try ;)
I will add comment soon on the code. And improve readability.
You haven't been idle lately :) Thanks for the link! Do you plan to add a License in your project?
Oh, yeah, good idea. + doc in the code, cleanup and more. May be next year ;) I want to add a way to auto contrast image. I need to search how to do that. I will try some guess.
I suggest adding pyinstaller
to the requirements.txt
file and the steps for installing appdmg
brew install node
npm install -g appdmg
to avoid this error when running python setup.py build_binary
:
sh: pyinstaller: command not found
sh: appdmg: command not found
Hi there,
First of all, @darodi thank you for your amazing work so far. I don't know if is available yet but it is possible to compile kcc as native apple silicon? Thank you once again.