Commit Graph

42 Commits

Author SHA1 Message Date
Alex Clark ☺
878d0ca51d Merge pull request #512 from vadmium/pl
Merge from Philippe Lagadec’s OleFileIO_PL fork
2014-03-17 10:41:26 -04:00
Martin Panter
99e7599ce2 OleFileIO: Add MAGIC constant to __all__
This is used by other modules in Pillow.
2014-02-04 04:10:19 +00:00
Martin Panter
caa609c438 Do away with @functools.total_ordering to restore Python 2.6 support
* Manually implement __ne__() and __lt__()
* __gt__() and __ge__() not needed due to operator reflection
2014-01-31 01:32:46 +00:00
Martin Panter
a6fd013a77 Implement rich comparison using @total_ordering (2.7+, 3.2+) 2014-01-30 23:38:04 +00:00
Martin Panter
5143df8561 Use range() rather than xrange(), for Python 3 compatibility 2014-01-30 23:38:04 +00:00
Martin Panter
6977b592e3 Port more stuff to Python 3, dropping some pre-2.6 support 2014-01-30 23:38:04 +00:00
Martin Panter
cd61720845 Merge Pillow changes with Philippe Lagadec’s OleFileIO_PL fork
Conflicts:
	PIL/OleFileIO.py

I kept Philippe’s version of Unicode decoding that uses UTF-16LE. Pillow
started using Python’s “utf_16” codec in the meantime, but I understand it
uses native byte ordering by default.
2014-01-30 23:37:44 +00:00
Martin Panter
ac5cb028be Convert OleFileIO.py to LF newlines before merging 2014-01-30 23:30:58 +00:00
decalage
a468016b63 v0.26: added methods to parse stream/storage timestamps, improved listdir to include storages, fixed parsing of direntry timestamps 2014-01-30 23:29:57 +00:00
decalage
7d37cf071f - getproperties: improved exception handling
- _raise_defect: added option to set exception type
- all non-fatal issues are now recorded, and displayed when run as a script
2014-01-30 23:29:57 +00:00
decalage
8e826441b2 2013-05-24 v0.25 PL: - getproperties: option to not convert some timestamps
- OleMetaData: total_edit_time is now a number of seconds,
                       not a timestamp
                     - getproperties: added support for VT_BOOL, VT_INT, V_UINT
                     - getproperties: filter out null chars from strings
                     - getproperties: raise non-fatal defects instead of
                       exceptions when properties cannot be parsed properly
2014-01-30 23:29:57 +00:00
decalage
5b616ca1be v0.24: slight improvements in OleMetadata, updated readme. 2014-01-30 23:29:57 +00:00
decalage
d5166fd97e - new class OleMetadata to parse standard properties
- added get_metadata method to OleFileIO
2014-01-30 23:29:57 +00:00
decalage
25158fe8b1 - getproperties: added conversion from filetime to python datetime
- main: displays properties with date format
2014-01-30 23:29:54 +00:00
decalage
ab541b1b4d Added comments for patch submitted by mete0r_kr, changed version 2014-01-30 23:21:25 +00:00
mete0r sarangbang
bbee2b5b8a support file-like object
fix #8
2014-01-30 23:21:25 +00:00
decalage
eaeb12f695 Fixed issue 2 - added close method to OleFileIO class 2014-01-30 23:21:25 +00:00
decalage
bd833a6972 Fixed issue 7 in OleFileIO.getproperties reported by chuckleberryfinn 2014-01-30 23:21:23 +00:00
decalage
87a7ec955e version 0.21 2010-01-22 2014-01-30 23:20:28 +00:00
decalage
4248acb7a7 version 0.20 2009-12-11 2014-01-30 23:17:51 +00:00
decalage
61a3ceb812 version 0.19 2009-12-10 2014-01-30 23:17:51 +00:00
decalage
70a99619bc version 0.18 2007-12-05 2014-01-30 23:17:51 +00:00
decalage
18333d8edf version 0.17 2007-12-04 2014-01-30 23:15:35 +00:00
decalage
e614631025 version 0.15 2007-11-25 2014-01-30 23:15:17 +00:00
decalage
d6d3f50205 version 0.14 2007-11-19 2014-01-30 23:15:17 +00:00
decalage
fad61ba20c version 0.13 2007-09-04 2014-01-30 23:12:46 +00:00
François Boulogne
923018dfeb MAINT: s/while 1:/while True:/ 2014-01-07 21:21:24 -05:00
Alex Clark
fd29e707e9 Apply @Arfrever patch, fixes #258 2013-06-30 07:04:42 -04:00
Sandro Mani
194370d89b Fix some docstrings 2013-04-12 21:54:21 +02:00
Alex Clark
3020c16eaa Fix imports 2013-03-07 11:20:28 -05:00
Brian Crowell
a7e3b2e47b py3k: The big push
There are two main issues fixed with this commit:

* bytes vs. str: All file, image, and palette data are now handled as
  bytes. A new _binary module consolidates the hacks needed to do this
  across Python versions. tostring/fromstring methods have been renamed to
  tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old
  names for compatibility. Users should move to tobytes/frombytes.

  One other potentially-breaking change is that text data in image files
  (such as tags, comments) are now explicitly handled with a specific
  character encoding in mind. This works well with the Unicode str in
  Python 3, but may trip up old code expecting a straight byte-for-byte
  translation to a Python string. This also required a change to Gohlke's
  tags tests (in Tests/test_file_png.py) to expect Unicode strings from
  the code.

* True div vs. floor div: Many division operations used the "/" operator
  to do floor division, which is now the "//" operator in Python 3. These
  were fixed.

As of this commit, on the first pass, I have one failing test (improper
handling of a slice object in a C module, test_imagepath.py) in Python 3,
and three that that I haven't tried running yet (test_imagegl,
test_imagegrab, and test_imageqt). I also haven't tested anything on
Windows. All but the three skipped tests run flawlessly against Pythons
2.6 and 2.7.
2013-01-10 08:46:56 -06:00
Brian Crowell
af94e2d93d py3k: Map long type to int
int() is really now long() in py3k, but to avoid breaking 2.6/2.7, we leave
the integer types where they are and just map long to int in py3k.

Also, pretty proud of myself for finding an easy way of detecting py3k.
2013-01-10 08:46:54 -06:00
Brian Crowell
31c454b925 py3k: 2to3's "idiom" filter
This is, I guess, a few things the Python devs were just fed up with.

* "while 1" is now "while True"
* Types are compared with isinstance instead of ==
* Sort a list in one go with sorted()

My own twist is to also replace type('') with str, type(()) with tuple,
type([]) with list, type(1) with int, and type(5000.0) with float.
2013-01-10 08:46:53 -06:00
Brian Crowell
e2283c664b py3k: Integer long literals are no longer valid syntax 2013-01-10 08:46:52 -06:00
Brian Crowell
260c1fad14 py3k: Convert StringIO.StringIO to io.BytesIO
io.BytesIO is already in 2.6. Some of the more obvious bytes literals are
marked in this commit.
2013-01-10 08:46:51 -06:00
Brian Crowell
5076c35cc5 py3k: print is a function
Seriously, if you didn't know that, you've been in a freaking cave, man.
2013-01-10 08:46:46 -06:00
Brian Crowell
3a665a7835 py3k: Add true Unicode support to OleFileIO
The day has arrived when Python provides an official way to handle Unicode
strings.
2013-01-10 08:46:44 -06:00
Brian Crowell
fc035814bd py3k: map and filter to list comprehensions
What's really going on is that map() and filter() return iterators in py3k.
I've just gone ahead and turned them all into list comprehensions, because
I find them much easier to read.
2013-01-10 08:46:43 -06:00
Brian Crowell
09f1081c95 py3k: Fix up uses of dictionary views, ranges, and has_key()
y.has_key(x) is gone (use x in y), and keys(), values(), items(), and
range() all return views.

Some iterables needed to be packed into lists, either because the code
expected a list (such as "range(256) * 3") or because the original
collection was being modified (automatic global declarations).

The Tiff ImageFileDictionary is a special case and will be dealt with in
another commit.
2013-01-10 08:46:42 -06:00
Brian Crowell
78575798d7 py3k: Update exception usage to modern syntax 2013-01-10 08:46:33 -06:00
Brian Crowell
37f22ebfcd py3k: Use string methods instead of string module
First, we go for the obvious stuff. The string module methods are gone in
3.0, so we translate them to the appropriate methods on the string class.
2013-01-10 08:42:49 -06:00
Alex Clark
9a640e3157 Forking PIL 2010-07-30 22:52:47 -04:00