forked from python-openxml/python-docx
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 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
Showing
4 changed files
with
39 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' | ||
|
@@ -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/*']} | ||
|
||
|
@@ -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 = { | ||
|