Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2 EOL - Port MOBI unpack Python code to Vala #241

Closed
paulcarroty opened this issue Feb 22, 2019 · 7 comments
Closed

Python 2 EOL - Port MOBI unpack Python code to Vala #241

paulcarroty opened this issue Feb 22, 2019 · 7 comments
Assignees
Milestone

Comments

@paulcarroty
Copy link

https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

Guess something will be actual for another Linux distros. Do you have any plans to rewrite code to Python 3?

@babluboy
Copy link
Owner

@paulcarroty Thanks for the pointer. I will port the code into Python 3 if possible.
However, the long term goal is to port the python script into Vala for the extraction of the mobi files - maybe I will do that if its harder to port the code into Python 3

If python 3 is present, will the scripts not execute ? I thought it was backwards compatible.

@paulcarroty
Copy link
Author

I thought it was backwards compatible.

Nope, man, they aren't.

About .mobi - just use what's better, maybe the libraries are available.

I'll test to run all scripts in Python 3 later. Here they are (rpm -q --filerequire bookworm):

/usr/share/bookworm/scripts/mobi_lib/mobi_dict.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_html.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_index.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_k8proc.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_ncx.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_opf.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_split.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_uncompress.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_unpack.py	/usr/bin/python2
/usr/share/bookworm/scripts/mobi_lib/mobi_utils.py	/usr/bin/python2

@paulcarroty
Copy link
Author

paulcarroty commented Feb 23, 2019

Update: I've forced Python 3 in all files by change their headers, but can't open any .mobi ebook.

@babluboy
Copy link
Owner

@paulcarroty Many thanks for your work on this - has saved me time for sure.
It will take a lot of time (and learning) to make the mobi script Python 2 & 3 compatible (and learning as well). I guess I'm better off at understanding what part of the code is doing the extraction of files from the mobi format and port the same to Vala. Then there will not be any dependency on Python as well.

@babluboy babluboy changed the title Python 2 EOL Python 2 EOL - Port MOBI unpack Python code to Vala Feb 23, 2019
@babluboy babluboy self-assigned this Feb 23, 2019
@babluboy babluboy added this to the 1.1.2 milestone Feb 23, 2019
@babluboy babluboy modified the milestones: 1.1.2, 1.1.3 Aug 10, 2019
@johnfactotum
Copy link

Newer versions of MobiUnpack, which has been renamed to KindleUnpack, supports Python 3: https://github.com/kevinhendricks/KindleUnpack

@babluboy
Copy link
Owner

babluboy commented Apr 9, 2020

@johnfactotum Many thanks for this. While my longer term goal is to write the unpack code in vala (which will remove the python dependency for the app), I will definitely try the Python 3 version you have mentioned as that will be better than the Python 2 dependency which Bookworm currently have.

Or if I can make a check on the python version and use the different versions it will preserve backward compatibility

@babluboy
Copy link
Owner

I have now updated the mobi unpack library to the new one suggested by @johnfactotum here [https://github.com//issues/241#issuecomment-611328008], this will make Bookworm compatible with Python2.7 and Python 3.

Closing this issue, It will be great if people can compile the code and test and let me know if there are any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants