|
1 | 1 | #!/usr/bin/env python |
| 2 | + |
2 | 3 | from __future__ import print_function |
3 | | -from setuptools import setup, find_packages |
| 4 | +import codecs |
| 5 | +import os |
| 6 | +import re |
| 7 | +from setuptools import setup |
4 | 8 | import sys |
5 | 9 |
|
6 | 10 | lxml_requirement = "lxml" |
|
16 | 20 | # Test timeouts |
17 | 21 | "timeout_decorator", |
18 | 22 | ] |
| 23 | + |
19 | 24 | extras = { |
20 | 25 | 'test': test_deps, |
21 | 26 | } |
22 | 27 |
|
| 28 | +# Adapted from https://github.com/pypa/pip/blob/master/setup.py |
| 29 | +def find_version(*file_paths): |
| 30 | + here = os.path.abspath(os.path.dirname(__file__)) |
| 31 | + |
| 32 | + # Intentionally *not* adding an encoding option to open, See: |
| 33 | + # https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690 |
| 34 | + with codecs.open(os.path.join(here, *file_paths), 'r') as fp: |
| 35 | + version_file = fp.read() |
| 36 | + version_match = re.search( |
| 37 | + r"^__version__ = ['\"]([^'\"]*)['\"]", |
| 38 | + version_file, |
| 39 | + re.M, |
| 40 | + ) |
| 41 | + if version_match: |
| 42 | + return version_match.group(1) |
| 43 | + |
| 44 | + raise RuntimeError("Unable to find version string.") |
| 45 | + |
23 | 46 | setup( |
24 | 47 | name="readability-lxml", |
25 | | - version="0.7", |
| 48 | + version=find_version("readability", "__init__.py"), |
26 | 49 | author="Yuri Baburov", |
27 | 50 | |
28 | 51 | description="fast html to text parser (article readability tool) with python3 support", |
|
53 | 76 | "Programming Language :: Python :: 3.4", |
54 | 77 | "Programming Language :: Python :: 3.5", |
55 | 78 | "Programming Language :: Python :: 3.6", |
| 79 | + "Programming Language :: Python :: 3.7", |
56 | 80 | ], |
57 | 81 | ) |
0 commit comments