Commit Graph
14 Commits
Author SHA1 Message Date
JMR-devandClaude Opus 4.8 838700fbec Remove Python 2 compatibility shims
The plugins target calibre 5/6 (Python 3) and the Poetry environment
pins Python >=3.8, so the Python 2 fallbacks are dead code. This removes
them throughout both plugins (behaviour on Python 3 is unchanged):

  - Drop all `from __future__` imports.
  - Collapse `if sys.version_info[0] == 2: ... else: ...` blocks to their
    Python 3 branch (ineptpdf, mobidedrm, kindlekey, kgenpids, alfcrypto,
    erdr2pml, ineptepub, obok, and the various unpad() helpers, etc.).
  - Replace `_winreg` import fallbacks with plain `import winreg`, and
    delete the py2-only adobekey_winreg_unicode module (now unreferenced).
  - Drop py2 name shims: `unicode`/`unichr`, `.iteritems()`,
    `from StringIO import StringIO`, `htmlentitydefs` fallback, and the
    Windows CommandLineToArgvW dance in unicode_argv (py3 sys.argv is
    already Unicode on every platform).
  - Remove the "Calibre < 5" (py2) bugfix block from the compat header.

Verified: every .py file in both plugins still byte-compiles.

Scope: the maintained DeDRM_plugin and Obok_plugin only. The archival
standalone scripts under Other_Tools/ are left as historical snapshots.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 18:42:33 -05:00
NoDRM e4e5808894 Fix file lock issue in androidkindlekey.py 2023-12-03 10:42:41 +01:00
NoDRM eb45c71fd9 Cleanup 2022-09-10 11:44:55 +02:00
NoDRM a0bb84fbfc Move unicode_argv to its own file 2022-08-06 20:19:18 +02:00
NoDRM b283777c0a Add back unpad to fix Python2 support 2022-03-19 10:14:45 +01:00
a980e066a01 a1dd63ae5f Remove OpenSSL support; only support PyCryptodome
This allows us to clean up the code a lot.

On Windows, it isn't installed by default and
most of the time not be found at all.

On M1 Macs, the kernel will kill the process instead.

Closes #33.
2022-03-18 15:45:39 +00:00
NoDRM 90910ab106 Add back Python2 support (ADEPT) 2021-11-16 11:09:03 +01:00
Apprentice Harper 5ec9c98a0b Python 3 fixes for Android kindle key retrieval 2020-11-27 15:46:06 +00:00
Aldo Bleeker 74bcf33591 Python 3 fixes 2020-11-22 16:03:45 +01:00
Apprentice Harper 781268e17e More general changes, and get mobidedrm and kindlekey to work on Mac. 2020-10-14 16:23:49 +01:00
Apprentice Harper e31752e334 Mostly Mac fixes. mobidedrm.py now works, and k4mobidedrm for at least some input. kindlekey.py should be working too. But lots more changes and testing to do. 2020-10-04 20:36:12 +01:00
Apprentice Harper de50a02af9 More generic 3.0 changes, to be tested. 2020-09-27 11:54:49 +01:00
Apprentice Harper afa4ac5716 Starting on Version 7.0 using the work done by others. Completely untested. I will be testing things, but I thought I'd get this base version up for others to give pull requests.
THIS IS ON THE MASTER BRANCH. The Master branch will be Python 3.0 from now on. While Python 2.7 support will not be deliberately broken, all efforts should now focus on Python 3.0 compatibility.

I can see a lot of work has been done. There's more to do. I've bumped the version number of everything I came across to the next major number for Python 3.0 compatibility indication.

Thanks everyone. I hope to update here at least once a week until we have a stable 7.0 release for calibre 5.0
2020-09-26 21:22:47 +01:00
Apprentice Harper 92bf51bc8f Remove stand-alone apps. Only support the two plugins. 2020-02-16 10:12:25 +00:00