|
1 | | -""" |
2 | | -Package installation via setup() |
3 | | -""" |
4 | | -import codecs |
5 | | -import os |
| 1 | +#!/usr/bin/env python |
| 2 | +# -*- encoding: utf-8 -*- |
| 3 | +from __future__ import absolute_import |
| 4 | +from __future__ import print_function |
| 5 | + |
| 6 | +import io |
6 | 7 | import re |
| 8 | +from glob import glob |
| 9 | +from os.path import basename |
| 10 | +from os.path import dirname |
| 11 | +from os.path import join |
| 12 | +from os.path import splitext |
| 13 | + |
| 14 | +from setuptools import find_packages |
7 | 15 | from setuptools import setup |
8 | 16 |
|
9 | | -#Allow single version in source file to be used here |
10 | | -#From https://packaging.python.org/guides/single-sourcing-package-version/ |
11 | | -def read(*parts): |
12 | | - # intentionally *not* adding an encoding option to open |
13 | | - # see here: https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 |
14 | | - here = os.path.abspath(os.path.dirname(__file__)) |
15 | | - return codecs.open(os.path.join(here, *parts), 'r').read() |
16 | | -def find_version(*file_paths): |
17 | | - version_file = read(*file_paths) |
18 | | - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |
19 | | - version_file, re.M) |
20 | | - if version_match: |
21 | | - return version_match.group(1) |
22 | | - raise RuntimeError("Unable to find version string.") |
23 | 17 |
|
24 | | -setup(name="simplify-docx", |
25 | | - version=find_version('simplify_docx', '__init__.py'), |
26 | | - description="A utility for simplifying python-docx document objects", |
27 | | - author="Microsoft Research", |
28 | | - packages=['simplify_docx'], |
29 | | - license='UNLICENSED', |
30 | | - install_requires=["python-docx"]) |
| 18 | +def read(*names, **kwargs): |
| 19 | + return io.open( |
| 20 | + join(dirname(__file__), *names), encoding=kwargs.get("encoding", "utf8") |
| 21 | + ).read() |
| 22 | + |
| 23 | + |
| 24 | +setup( |
| 25 | + name="simplify-docx", |
| 26 | + version="0.1.0", |
| 27 | + description="A utility for simplifying python-docx document objects", |
| 28 | + long_description="%s\n%s" |
| 29 | + % ( |
| 30 | + re.compile("^.. start-badges.*^.. end-badges", re.M | re.S).sub( |
| 31 | + "", read("README.md") |
| 32 | + ), |
| 33 | + re.sub(":[a-z]+:`~?(.*?)`", r"``\1``", read("CHANGELOG.md")), |
| 34 | + ), |
| 35 | + author="Microsoft Research", |
| 36 | + author_email="jathorpe@microsoft.com", |
| 37 | + url="https://microsofteconomics.visualstudio.com/EconTools/_git/loadify?_a=history", |
| 38 | + packages=find_packages("src"), |
| 39 | + package_dir={"": "src"}, |
| 40 | + py_modules=[splitext(basename(path))[0] for path in glob("src/*.py")], |
| 41 | + include_package_data=True, |
| 42 | + zip_safe=False, |
| 43 | + classifiers=[ |
| 44 | + # complete classifier list: http://pypi.python.org/pypi?%3Aaction=list_classifiers |
| 45 | + "Development Status :: 5 - Production/Stable", |
| 46 | + "Intended Audience :: Developers", |
| 47 | + "Operating System :: Unix", |
| 48 | + "Operating System :: POSIX", |
| 49 | + "Operating System :: Microsoft :: Windows", |
| 50 | + "Programming Language :: Python", |
| 51 | + "Programming Language :: Python :: 2.7", |
| 52 | + "Programming Language :: Python :: 3", |
| 53 | + "Programming Language :: Python :: 3.4", |
| 54 | + "Programming Language :: Python :: 3.5", |
| 55 | + "Programming Language :: Python :: 3.6", |
| 56 | + "Programming Language :: Python :: 3.7", |
| 57 | + "Programming Language :: Python :: Implementation :: CPython", |
| 58 | + "Programming Language :: Python :: Implementation :: PyPy", |
| 59 | + "Topic :: Utilities", |
| 60 | + ], |
| 61 | + keywords=["sql", "csv"], |
| 62 | + install_requires=[ |
| 63 | + "lxml==4.3.3", |
| 64 | + "more-itertools==7.0.0", |
| 65 | + "python-docx==0.8.10", |
| 66 | + "six==1.12.0", |
| 67 | + "wincertstore==0.2", |
| 68 | + ], |
| 69 | + extras_require={':python_version=="2.6"': ["argparse"]}, |
| 70 | + entry_points={"console_scripts": ["loadify = loadify:loadify"]}, |
| 71 | +) |
0 commit comments