Commit Graph

29235 Commits

Author SHA1 Message Date
Eli Schwartz 45f68f552b python3: make coffee build
add polyglot.socketserver wrapper and fix BaseHTTPServer.HTTPServer
2019-03-21 01:27:21 -04:00
Eli Schwartz 8aceae428e py3: make setup.py gui work
Apparently compileUi explicitly opens the file/buffer as unicode, not
bytes, and then writes a unicode header string (containing the source
file). So the previous attempt to use BytesIO was wrong in this case.

Also images.qrc is being constructed completely in the right here and
now from a bunch of unicode strings, so just use exactly that.
2019-03-20 23:56:30 -04:00
Eli Schwartz 8e125b56a0 python3: listify the range() generator before appending to it
We explicitly need a list here.
2019-03-20 23:56:30 -04:00
Kovid Goyal 9386839320 Various ixes for the previous polyglot commit 2019-03-20 21:11:45 +05:30
Eli Schwartz e828a4bd98 python3: more use of unicode_type
These metadata sources files are part of the infrastructure, not the
parts which are downloaded.
2019-03-20 08:44:26 -04:00
Eli Schwartz 83b055122a python3: add polyglot.queue wrapper 2019-03-20 08:44:23 -04:00
Eli Schwartz ea6a210e70 python3: wire up more code to polyglot.http_server 2019-03-20 08:43:58 -04:00
Eli Schwartz 8594f52fe8 python3: add more urllib wrappers 2019-03-20 08:43:54 -04:00
Eli Schwartz 1653c790db remove dead code
Initially added in commit c1ef643b8e but I
cannot tell what it was ever used for.
2019-03-20 08:43:22 -04:00
Eli Schwartz 2d382274cd py3: gettext no longer has a unicode= argument
This is unicode by default "since there's no point in translating to
byte strings." Good riddance.
2019-03-20 08:43:22 -04:00
Kovid Goyal 042d740593 ... 2019-03-20 15:02:31 +05:30
Kovid Goyal ae735b2ea3 De-vendor html2text 2019-03-20 14:42:46 +05:30
Kovid Goyal 40a12c31c1 Remove unused code 2019-03-20 10:41:19 +05:30
Kovid Goyal d02a6ea36a Remove unused code 2019-03-19 18:00:20 +05:30
Kovid Goyal c4d30dd75f Misc fixes for the cStriongIO -> io commit 2019-03-19 17:58:16 +05:30
Kovid Goyal 0801ce96a5 Merge branch 'stringio' of https://github.com/eli-schwartz/calibre 2019-03-19 17:55:38 +05:30
Kovid Goyal ac5f1e9039 ... 2019-03-19 12:35:12 +05:30
Kovid Goyal f760326ed2 Fix #1820549 [Ampersand is not escaped from strings on right-click menu](https://bugs.launchpad.net/calibre/+bug/1820549) 2019-03-19 12:21:22 +05:30
Kovid Goyal 14e4682f29 Fix #1820548 [Backups backtrace](https://bugs.launchpad.net/calibre/+bug/1820548) 2019-03-18 07:34:36 +05:30
Kovid Goyal 651344027c Nicer error message if the progress_indicator plugin fails to load 2019-03-17 20:18:06 +05:30
Kovid Goyal dc4c444a71 Handle passing str to json_loads 2019-03-17 20:07:22 +05:30
Kovid Goyal 7d7731f5d0 ... 2019-03-17 19:46:58 +05:30
Eli Schwartz c1fb63378f python3: migrate lots of code to io.(Bytes|String)IO instead of c?StringIO
This is the only IO representation on python3, and it is backported to
python2 to aid in porting but requires determining whether to handle
bytes or unicode...  which is sort of the point of porting, so let's
handle this properly everywhere we can.
2019-03-17 09:15:02 -04:00
Eli Schwartz 0b252e8659 palmdoc: consistently use bytes when writing to the buffer 2019-03-17 09:15:02 -04:00
Eli Schwartz e02f836bd0 lit reader: consistently use bytes when writing to the buffer 2019-03-17 09:15:02 -04:00
Eli Schwartz e37cf6ab3c Update PyRSS2Gen to 1.1
Pull functional changes adapted to in-tree calibre cleanups. Upstream
officially supports python3 so this should be all that is needed.
2019-03-17 09:15:02 -04:00
Eli Schwartz 9505fdf226 Remove ancient db migration code.
The last caller for this function was removed in 2012.
This gets rid of a python2-specific cStringIO import.
2019-03-17 09:15:02 -04:00
Kovid Goyal 86c1d17474 Migrate .pickle config files to JSON format on first read 2019-03-17 18:37:12 +05:30
Kovid Goyal d0b99d7e68 Move the old .py based config files to JSON
The .py format relied on pickle for serialization of complex datatypes
and is not stable against multiple python versions.

As witht he migration of the .pickle config files, an upgrade/downgrade
will make the settings disjoint.
2019-03-17 18:23:09 +05:30
Kovid Goyal 1e1ad23ec7 Forgot to keep from/to_json in config namespace 2019-03-16 14:23:25 +05:30
Kovid Goyal 7b2620a0ac Move JSON serialization function into config_base 2019-03-16 14:12:23 +05:30
Kovid Goyal dcb128eb8b py3: Allow serializing utf-8 bytestrings to JSON
This matches behavior of py2
2019-03-16 14:06:15 +05:30
Kovid Goyal b23ba9dbdb ... 2019-03-16 13:58:54 +05:30
Kovid Goyal 256d770f47 Use a more efficient serialization for notified versions 2019-03-16 13:56:32 +05:30
Kovid Goyal 457ab4616e ... 2019-03-16 13:30:32 +05:30
Kovid Goyal f6e15704b3 Do not use pickle to store DynamicConfig
pickle is not portable between python versions, which makes it
particularly unsuited for config files.

Old settings are automatically migrated from *.pickle to *.pickle.json

Note this has the unfortunate side-effect that upgrading/downgrading or
using multiple versions of calibre on the same config directory will
make the settings disjoint. I dont see a reasonable way to avoid that.
2019-03-16 13:29:10 +05:30
Kovid Goyal dc274d8c1c Use ABC to test for numbers type
This is important as long does not exist on py3 and anyway using an ABC
is more robust.  Also fix a few uses of long() for py3.
2019-03-16 12:17:14 +05:30
Kovid Goyal 8921bb8324 Reduce file lock time 2019-03-16 11:09:23 +05:30
Kovid Goyal 138a0338f7 DRYer 2019-03-16 10:22:54 +05:30
Kovid Goyal 869c2bf89e Persist QByteArray as python bytearrays in JSONConfig 2019-03-16 09:59:37 +05:30
Kovid Goyal 4a967a28c3 Remove unused code 2019-03-16 09:06:47 +05:30
Kovid Goyal d3ccd4369b Make use of pickle in ipc.pool work on py3 as well 2019-03-15 21:57:32 +05:30
Kovid Goyal 20b9cc3a81 Remove unused code 2019-03-15 21:46:48 +05:30
Kovid Goyal dbcb63c290 Ensure worker env keys are bytes/unicodeon py2/3 2019-03-15 21:45:54 +05:30
Kovid Goyal e73e782b56 Remove use of pickle for passing listen address to calibre workers 2019-03-15 21:33:26 +05:30
Kovid Goyal 313ce6b0c9 A spot of refactoring 2019-03-15 21:16:37 +05:30
Kovid Goyal e9b26ebb00 Dont rely on constants from the pickle module 2019-03-15 15:48:32 +05:30
Kovid Goyal fae355fe65 Replace use of pickle for icon theme cache on Linux 2019-03-15 15:38:12 +05:30
Kovid Goyal 69210a7783 Dont use pickle to calculate etags for tag browser data dumps 2019-03-15 15:25:58 +05:30
Kovid Goyal c98cc3383d Dont use pickle for calculating book hashes for the server
This has the unfortunate side-effect of making existing caches stale,
but cant be helped, given the instability of pickle as a serialization
format.
2019-03-15 15:06:26 +05:30