Skip to content

Commit

Permalink
hotfix: setup error on Windows
Browse files Browse the repository at this point in the history
* remove non-ascii characters from LICENSE
* refactor file reading in setup.py
  • Loading branch information
Steve Canny committed Jan 6, 2014
1 parent a622807 commit 0832d7d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 13 deletions.
18 changes: 17 additions & 1 deletion HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,27 @@
Release History
---------------

0.3.0a3 (2014-01-06)
++++++++++++++++++++++

- Fix setup.py error on some Windows installs

0.3.0a1 (2014-01-05)
++++++++++++++++++++++

- Full object-oriented rewrite
- Feature-parity with prior version
- text: add paragraph, run, text, bold, italic
- table: add table, add row, add column
- styles: specify style for paragraph, table
- picture: add inline picture, auto-scaling
- breaks: add page break
- tests: full pytest and behave-based 2-layer test suite

0.3.0dev1 (2013-12-14)
++++++++++++++++++++++

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

6 changes: 3 additions & 3 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
The MIT License (MIT)
Copyright © 2013 Steve Canny, https://github.com/scanny
Copyright (c) 2013 Steve Canny, https://github.com/scanny

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

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
Expand Down
2 changes: 1 addition & 1 deletion docx/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from docx.api import Document # noqa

__version__ = '0.3.0a1'
__version__ = '0.3.0a3'


# register custom Part classes with opc package reader
Expand Down
26 changes: 18 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,25 @@

from setuptools import find_packages, setup


def text_of(relpath):
"""
Return string containing the contents of the file at *relpath* relative to
this file.
"""
thisdir = os.path.dirname(__file__)
file_path = os.path.join(thisdir, os.path.normpath(relpath))
with open(file_path) as f:
text = f.read()
text.decode('ascii') # result discarded, just make sure no non-ascii chars
return text

# Read the version from docx.__version__ without importing the package
# (and thus attempting to import packages it depends on that may not be
# installed yet)
thisdir = os.path.dirname(__file__)
init_py = os.path.join(thisdir, 'docx', '__init__.py')
version = re.search("__version__ = '([^']+)'", open(init_py).read()).group(1)
license = os.path.join(thisdir, 'LICENSE')
version = re.search(
"__version__ = '([^']+)'", text_of('docx/__init__.py')
).group(1)


NAME = 'python-docx'
Expand All @@ -21,7 +33,7 @@
AUTHOR = 'Steve Canny'
AUTHOR_EMAIL = '[email protected]'
URL = 'https://github.com/python-openxml/python-docx'
LICENSE = open(license).read()
LICENSE = text_of('LICENSE')
PACKAGES = find_packages(exclude=['tests', 'tests.*'])
PACKAGE_DATA = {'docx': ['templates/*']}

Expand All @@ -46,9 +58,7 @@
'Topic :: Software Development :: Libraries'
]

readme = os.path.join(thisdir, 'README.rst')
history = os.path.join(thisdir, 'HISTORY.rst')
LONG_DESCRIPTION = open(readme).read() + '\n\n' + open(history).read()
LONG_DESCRIPTION = text_of('README.rst') + '\n\n' + text_of('HISTORY.rst')


params = {
Expand Down

0 comments on commit 0832d7d

Please sign in to comment.