Skip to content
This repository was archived by the owner on May 4, 2020. It is now read-only.

Py3.3 support for xlwt #32

Closed
wants to merge 22 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
e41f1ce
Create README.md
edschofield Aug 16, 2013
036ca12
Add Py3 patches.
edschofield Aug 16, 2013
38dea5e
Add RKbug.py fixes
edschofield Aug 16, 2013
226e638
More fixes on Py3, including the examples
edschofield Aug 16, 2013
e9302bf
Mention Py3 compatibility in setup.py.
edschofield Aug 16, 2013
7179c98
Update README and HISTORY a little bit
edschofield Aug 16, 2013
999fdb5
Compatible iterator support on Py2 / Py3
edschofield Aug 16, 2013
2a78ad9
Revert RKbug.py for now
edschofield Aug 16, 2013
44be5f6
Add back patch to RKbug.py
edschofield Aug 16, 2013
7466627
Add a requirement
goinnn Oct 23, 2013
a4a2cc7
Move the version. I got an error because future package
goinnn Oct 23, 2013
31c991c
Move the version... I try to fix a import error
goinnn Oct 23, 2013
80d5f20
Merge pull request #1 from goinnn/master
edschofield Oct 29, 2013
394285b
Use setuptools if available; update future package to v0.8.1
edschofield Oct 29, 2013
b4c8edc
Initial fixes for ANTLR module
edschofield Oct 29, 2013
d8ea26d
Streamline antlr.py using new (long) int object in python-future >= 0.7
edschofield Oct 29, 2013
5c1b740
More fixes from ``future`` upgrade
edschofield Oct 30, 2013
c0744cf
Update version to v0.8.0 and update docs
edschofield Nov 1, 2013
c97721b
Bump ``future`` version requirement to v0.8.2
edschofield Nov 1, 2013
f537030
Also bump ``future`` version requirement in requirements.txt
edschofield Nov 1, 2013
2bac9b3
Update version in README.html
edschofield Nov 1, 2013
2a75892
Add back John Machin as maintainer in setup.py for pull request
edschofield Nov 1, 2013
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 5 additions & 64 deletions HISTORY.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,74 +2,15 @@
<html>
<head>
<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
<title>xlwt HISTORY</title>
<title>xlwt-future history</title>
</head>
<body>
<p> Version 0.8.0: Fork of github.com/python-excel/xlwt that adds Python 3 support via <a href="https://pypi.python.org/pypi/future">python-future</a>: 2013-11-01. Home of the fork: <a href="https://github.com/PythonCharmers/xlwt-future">github.com/PythonCharmers/xlwt-future</a>
</p>
<p> Version 0.7.5, released 2013-04
</p>
<p> Version 0.7.2, released to the general public via PyPI -- 2009-06-01
</p>
<code><br /> Revision: 3844
<br /> Author: sjmachin
<br /> Date: 11:02:54 AM, Wednesday, 20 May 2009
<br /> Message:
<br /> Added function Utils.rowcol_pair_to_cellrange. (0, 0, 65535, 255) -> "A1:IV65536"
<br /> ----
<br /> Modified : /xlwt/trunk/xlwt/Utils.py
<br />
<br /> Revision: 3843
<br /> Author: sjmachin
<br /> Date: 1:46:05 AM, Tuesday, 19 May 2009
<br /> Message:
<br /> Removed Worksheet property show_empty_as_zero,
<br /> and added attribute show_zero_values (default: 1 == True).
<br /> ----
<br /> Modified : /xlwt/trunk/xlwt/Worksheet.py
<br />
<br /> Revision: 3841
<br /> Author: sjmachin
<br /> Date: 11:58:51 AM, Wednesday, 13 May 2009
<br /> Message:
<br /> Fixed formula code generation problem with formulas
<br /> including MAX/SUM/etc functions with arguments like A1+123.
<br /> Updated version to 0.7.2alpha.
<br /> ----
<br /> Modified : /xlwt/trunk/README.html
<br /> Modified : /xlwt/trunk/setup.py
<br /> Modified : /xlwt/trunk/xlwt/ExcelFormulaParser.py
<br /> Modified : /xlwt/trunk/xlwt/ExcelMagic.py
<br /> Modified : /xlwt/trunk/xlwt/__init__.py
<br /> Modified : /xlwt/trunk/xlwt/excel-formula.g
<br />
<br /> Revision: 3816
<br /> Author: sjmachin
<br /> Date: 8:31:39 PM, Tuesday, 24 March 2009
<br /> Message:
<br /> Added .../doc/pattern_examples.xls and put a pointer to it
<br /> in the easyxf part of Style.py.
<br /> ----
<br /> Modified : /xlwt/trunk/xlwt/Style.py
<br /> Added : /xlwt/trunk/xlwt/doc/pattern_examples.xls
<br />
<br /> Revision: 3815
<br /> Author: sjmachin
<br /> Date: 7:54:52 PM, Tuesday, 24 March 2009
<br /> Message:
<br /> Fixed Row.set_cell_formula() bug introduced in 0.7.1.
<br /> Fixed bug(?) with SCL/magnification handling causing(?) Excel
<br /> to raise a dialogue box if sheet is set to open in page preview mode
<br /> and user then switches to normal view.
<br /> Added color and colour as synonyms for font.colour_index in easyxf.
<br /> Removed unused attribute Row.__has_default_format.
<br /> ----
<br /> Modified : /xlwt/trunk/xlwt/Row.py
<br /> Modified : /xlwt/trunk/xlwt/Style.py
<br /> Modified : /xlwt/trunk/xlwt/Worksheet.py
</code>






<p> Version 0.7.1, released to the general public via PyPI -- 2009-03-04
</p>
<p> Version 0.7.0, released to the general public via PyPI
Expand Down
10 changes: 5 additions & 5 deletions README.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
</p>
<p><b>Licence:</b> BSD-style (see licences.py)
</p>
<p><b>Version of xlwt:</b> 0.7.2
<p><b>Version of xlwt:</b> 0.8.0
</p>
<p><b>Version of Python required:</b> 2.3 to 2.6
<p><b>Version of Python required:</b> 2.6/2.7 or 3.3
</p>
<p><b>External modules required:</b> None
<p><b>External modules required:</b> <code>future</code>
</p>
<p>
The package itself is pure Python with no dependencies on modules or packages
outside the standard Python distribution.
The package itself is pure Python with only one dependency outside the standard
Python distribution (the <code>future</code> package for Py2/3 compatibility).
</p>
<p><b>Quick start:</b>
</p>
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
xlwt-future
===========

Fork of https://github.com/python-excel/xlwt that supports both Python 3.3 and
Python 2.6/2.7. The original supports Python 2.3 to 2.6 only.

Library to create spreadsheet files compatible with MS Excel 97/2000/XP/2003
XLS files, on any platform.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
future>=0.8.2
23 changes: 17 additions & 6 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,35 @@
#!/usr/bin/env python

from distutils.core import setup
from xlwt import __VERSION__
try:
from setuptools import setup
except ImportError:
from distutils.core import setup

__VERSION__ = '0.8.0'

DESCRIPTION = (
'Library to create spreadsheet files compatible with '
'MS Excel 97/2000/XP/2003 XLS files, '
'on any platform, with Python 2.3 to 2.7'
'on any platform, with Python 2.6 to 3.3'
)

LONG_DESCRIPTION = """\
Py2.6+ and Py3.3+ fork of xlwt.

xlwt is a library for generating spreadsheet files that are compatible
with Excel 97/2000/XP/2003, OpenOffice.org Calc, and Gnumeric. xlwt has
full support for Unicode. Excel spreadsheets can be generated on any
platform without needing Excel or a COM server. The only requirement is
Python 2.3 to 2.7.
Python 2.6, 2.7, or 3.3.
"""

CLASSIFIERS = [
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.3',
'License :: OSI Approved :: BSD License',
'Development Status :: 5 - Production/Stable',
'Intended Audience :: Developers',
Expand All @@ -34,12 +44,12 @@
)

setup(
name = 'xlwt',
name = 'xlwt-future',
version = __VERSION__,
maintainer = 'John Machin',
maintainer_email = '[email protected]',
url = 'http://www.python-excel.org/',
download_url = 'http://pypi.python.org/pypi/xlwt',
download_url = 'http://pypi.python.org/pypi/xlwt-future',
description = DESCRIPTION,
long_description = LONG_DESCRIPTION,
license = 'BSD',
Expand All @@ -54,4 +64,5 @@
'tests/*.*',
],
},
install_requires=['future>=0.8.2']
)
37 changes: 22 additions & 15 deletions tests/RKbug.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
from xlwt import *
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from future.builtins import *

import sys
from struct import pack, unpack

from xlwt import *
from xlwt.Utils import pack, unpack


def cellname(rowx, colx):
# quick kludge, works up to 26 cols :-)
return chr(ord('A') + colx) + str(rowx + 1)

def RK_pack_check(num, anint, case=None):
if not(-0x7fffffff - 1 <= anint <= 0x7fffffff):
print "RK_pack_check: not a signed 32-bit int: %r (%r); case: %r" \
% (anint, hex(anint), case)
print("RK_pack_check: not a signed 32-bit int: %r (%r); case: %r" \
% (anint, hex(anint), case))
pstr = pack("<i", anint)
actual = unpack_RK(pstr)
if actual != num:
print "RK_pack_check: round trip failure: %r (%r); case %r; %r in, %r out" \
% (anint, hex(anint), case, num, actual)
print("RK_pack_check: round trip failure: %r (%r); case %r; %r in, %r out" \
% (anint, hex(anint), case, num, actual))


def RK_encode(num, blah=0):
Expand All @@ -25,22 +32,22 @@ def RK_encode(num, blah=0):
rk_encoded = 0
packed = pack('<d', num)

if blah: print
if blah: print repr(num)
if blah: print()
if blah: print(repr(num))
w01, w23 = unpack('<2i', packed)
if not w01 and not(w23 & 3):
# 34 lsb are 0
if blah: print "float RK", w23, hex(w23)
if blah: print("float RK", w23, hex(w23))
return RK_pack_check(num, w23, 0)
# return RKRecord(
# self.__parent.get_index(), self.__idx, self.__xf_idx, w23).get()

if -0x20000000 <= num < 0x20000000:
inum = int(num)
if inum == num:
if blah: print "30-bit integer RK", inum, hex(inum)
if blah: print("30-bit integer RK", inum, hex(inum))
rk_encoded = 2 | (inum << 2)
if blah: print "rk", rk_encoded, hex(rk_encoded)
if blah: print("rk", rk_encoded, hex(rk_encoded))
return RK_pack_check(num, rk_encoded, 2)
# return RKRecord(
# self.__parent.get_index(), self.__idx, self.__xf_idx, rk_encoded).get()
Expand All @@ -50,22 +57,22 @@ def RK_encode(num, blah=0):
w01, w23 = unpack('<2i', packed100)
if not w01 and not(w23 & 3):
# 34 lsb are 0
if blah: print "float RK*100", w23, hex(w23)
if blah: print("float RK*100", w23, hex(w23))
return RK_pack_check(num, w23 | 1, 1)
# return RKRecord(
# self.__parent.get_index(), self.__idx, self.__xf_idx, w23 | 1).get()

if -0x20000000 <= temp < 0x20000000:
itemp = int(round(temp, 0))
if blah: print (itemp == temp), (itemp / 100.0 == num)
if blah: print((itemp == temp), (itemp / 100.0 == num))
if itemp / 100.0 == num:
if blah: print "30-bit integer RK*100", itemp, hex(itemp)
if blah: print("30-bit integer RK*100", itemp, hex(itemp))
rk_encoded = 3 | (itemp << 2)
return RK_pack_check(num, rk_encoded, 3)
# return RKRecord(
# self.__parent.get_index(), self.__idx, self.__xf_idx, rk_encoded).get()

if blah: print "Number"
if blah: print("Number")
# return NumberRecord(
# self.__parent.get_index(), self.__idx, self.__xf_idx, num).get()

Expand Down
Loading