Skip to content

Commit 0832d7d

Browse files
author
Steve Canny
committed
hotfix: setup error on Windows
* remove non-ascii characters from LICENSE * refactor file reading in setup.py
1 parent a622807 commit 0832d7d

File tree

4 files changed

+39
-13
lines changed

4 files changed

+39
-13
lines changed

HISTORY.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@
33
Release History
44
---------------
55

6+
0.3.0a3 (2014-01-06)
7+
++++++++++++++++++++++
8+
9+
- Fix setup.py error on some Windows installs
10+
11+
0.3.0a1 (2014-01-05)
12+
++++++++++++++++++++++
13+
14+
- Full object-oriented rewrite
15+
- Feature-parity with prior version
16+
- text: add paragraph, run, text, bold, italic
17+
- table: add table, add row, add column
18+
- styles: specify style for paragraph, table
19+
- picture: add inline picture, auto-scaling
20+
- breaks: add page break
21+
- tests: full pytest and behave-based 2-layer test suite
22+
623
0.3.0dev1 (2013-12-14)
724
++++++++++++++++++++++
825

926
- Round-trip .docx file, preserving all parts and relationships
1027
- Load default "template" .docx on open with no filename
1128
- Open from stream and save to stream (file-like object)
1229
- Add paragraph at and of document
13-

LICENSE

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
The MIT License (MIT)
2-
Copyright © 2013 Steve Canny, https://github.com/scanny
2+
Copyright (c) 2013 Steve Canny, https://github.com/scanny
33

44
Permission is hereby granted, free of charge, to any person obtaining a copy
5-
of this software and associated documentation files (the Software), to deal
5+
of this software and associated documentation files (the "Software"), to deal
66
in the Software without restriction, including without limitation the rights
77
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
88
copies of the Software, and to permit persons to whom the Software is
@@ -11,7 +11,7 @@ furnished to do so, subject to the following conditions:
1111
The above copyright notice and this permission notice shall be included in
1212
all copies or substantial portions of the Software.
1313

14-
THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1515
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1616
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1717
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER

docx/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
from docx.api import Document # noqa
44

5-
__version__ = '0.3.0a1'
5+
__version__ = '0.3.0a3'
66

77

88
# register custom Part classes with opc package reader

setup.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,25 @@
55

66
from setuptools import find_packages, setup
77

8+
9+
def text_of(relpath):
10+
"""
11+
Return string containing the contents of the file at *relpath* relative to
12+
this file.
13+
"""
14+
thisdir = os.path.dirname(__file__)
15+
file_path = os.path.join(thisdir, os.path.normpath(relpath))
16+
with open(file_path) as f:
17+
text = f.read()
18+
text.decode('ascii') # result discarded, just make sure no non-ascii chars
19+
return text
20+
821
# Read the version from docx.__version__ without importing the package
922
# (and thus attempting to import packages it depends on that may not be
1023
# installed yet)
11-
thisdir = os.path.dirname(__file__)
12-
init_py = os.path.join(thisdir, 'docx', '__init__.py')
13-
version = re.search("__version__ = '([^']+)'", open(init_py).read()).group(1)
14-
license = os.path.join(thisdir, 'LICENSE')
24+
version = re.search(
25+
"__version__ = '([^']+)'", text_of('docx/__init__.py')
26+
).group(1)
1527

1628

1729
NAME = 'python-docx'
@@ -21,7 +33,7 @@
2133
AUTHOR = 'Steve Canny'
2234
AUTHOR_EMAIL = 'python-docx@googlegroups.com'
2335
URL = 'https://github.com/python-openxml/python-docx'
24-
LICENSE = open(license).read()
36+
LICENSE = text_of('LICENSE')
2537
PACKAGES = find_packages(exclude=['tests', 'tests.*'])
2638
PACKAGE_DATA = {'docx': ['templates/*']}
2739

@@ -46,9 +58,7 @@
4658
'Topic :: Software Development :: Libraries'
4759
]
4860

49-
readme = os.path.join(thisdir, 'README.rst')
50-
history = os.path.join(thisdir, 'HISTORY.rst')
51-
LONG_DESCRIPTION = open(readme).read() + '\n\n' + open(history).read()
61+
LONG_DESCRIPTION = text_of('README.rst') + '\n\n' + text_of('HISTORY.rst')
5262

5363

5464
params = {

0 commit comments

Comments
 (0)