31298 Commits

Author SHA1 Message Date
Kovid Goyal
692230147c
Start work on porting to beautifulsoup4 2019-03-24 12:18:42 +05:30
Kovid Goyal
78b7112012
Fix using --insert-metadata with ebook-convert not inserting the title and author metadata from the source document 2019-03-24 12:17:21 +05:30
Eli Schwartz
4f545af415
autopep8 2019-03-24 01:18:27 -04:00
Eli Schwartz
a623717d96
python3: apply various fixes from python-modernize "dict_six"
Imports were then fixed and consolidated to derive from the internal
polyglot.builtins
2019-03-24 01:18:27 -04:00
Eli Schwartz
f61dcf6b1a
python3: more BytesIO 2019-03-24 00:54:58 -04:00
Eli Schwartz
69711828bd
python3: make lopen a direct alias for the builtin open
Thanks to PEP 0446, its reason to exist no longer applies and it is the
default behavior. However, trying to use it on python3 resulted in
errors since "e" is no longer a valid open() mode.
2019-03-24 00:54:58 -04:00
Eli Schwartz
391ca722e0
python3: PEP 3114 compliance for next() and iterators 2019-03-24 00:23:15 -04:00
Eli Schwartz
9ecadb9c13
python3: use exec() instead of execfile() 2019-03-24 00:23:15 -04:00
Kovid Goyal
930624d2be
pep8 2019-03-22 23:48:01 +05:30
Kovid Goyal
3c86c9be6f
pep8 2019-03-21 20:40:28 +05:30
Kovid Goyal
47ed2df137
Various fixes for the latest py3 commit 2019-03-21 18:33:19 +05:30
Eli Schwartz
d66fdc2df7
autopep8 2019-03-21 01:27:21 -04:00
Eli Schwartz
cb85e778d8
python3: fix various uses of itertools.i(map|zip)
Use the existing polyglot.builtins / future_builtins versions.
Also smooth over izip_longest, but don't bother with another polyglot
module for one function used in two places.
2019-03-21 01:27:21 -04:00
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 c1ef643b8ed6c1740438692e345761a401fea1af 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