8000 Merge branch 'master' into many_repeated_spaces_timeout · kingking888/python-readability@494b19e · GitHub
[go: up one dir, main page]

Skip to content

Commit 494b19e

Browse files
authored
Merge branch 'master' into many_repeated_spaces_timeout
2 parents 2bbb70b + dca6e21 commit 494b19e

File tree

5 files changed

+41
-4
lines changed

5 files changed

+41
-4
lines changed

.travis.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@ language: python
33
python:
44
- "3.6"
55

6+
# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs
7+
matrix:
8+
include:
9+
- name: "Python: 3.7"
10+
python: "3.7"
11+
dist: xenial
12+
sudo: true
13+
env: TOX_ENV=py37
14+
615
env:
716
- TOX_ENV=py27
817
- TOX_ENV=py34

readability/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
__version__ = "0.7"
2+
13
from .readability import Document

setup.py

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
#!/usr/bin/env python
2+
23
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
48
import sys
59

610
lxml_requirement = "lxml"
@@ -16,13 +20,32 @@
1620
# Test timeouts
1721
"timeout_decorator",
1822
]
23+
1924
extras = {
2025
'test': test_deps,
2126
}
2227

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+
2346
setup(
2447
name="readability-lxml",
25-
version="0.7",
48+
version=find_version("readability", "__init__.py"),
2649
author="Yuri Baburov",
2750
author_email="burchik@gmail.com",
2851
description="fast html to text parser (article readability tool) with python3 support",
@@ -53,5 +76,6 @@
5376
"Programming Language :: Python :: 3.4",
5477
"Programming Language :: Python :: 3.5",
5578
"Programming Language :: Python :: 3.6",
79+
"Programming Language :: Python :: 3.7",
5680
],
5781
)

tests/test_article_only.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
def load_sample(filename):
1212
"""Helper to get the content out of the sample files"""
13-
return open(os.path.join(SAMPLES, filename)).read()
13+
with open(os.path.join(SAMPLES, filename)) as f:
14+
html = f.read()
15+
return html
1416

1517

1618
class TestArticleOnly(unittest.TestCase):

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# and then run "tox" from this directory.
55

66
[tox]
7-
envlist = py27, py35, py36
7+
envlist = py27, py35, py36, py37
88

99
[testenv]
1010
deps=pytest

0 commit comments

Comments
 (0)
0