File tree Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Expand file tree Collapse file tree 2 files changed +28
-2
lines changed Original file line number Diff line number Diff line change
1
+ __version__ = "0.7"
2
+
1
3
from .readability import Document
Original file line number Diff line number Diff line change 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"
12
16
print ("Using lxml<2.4" )
13
17
lxml_requirement = "lxml<2.4"
14
18
19
+
20
+ # Adapted from https://github.com/pypa/pip/blob/master/setup.py
21
+ def find_version (* file_paths ):
22
+ here = os .path .abspath (os .path .dirname (__file__ ))
23
+
24
+ # Intentionally *not* adding an encoding option to open, See:
25
+ # https://github.com/pypa/virtualenv/issues/201#issuecomment-3145690
26
+ with codecs .open (os .path .join (here , * file_paths ), 'r' ) as fp :
27
+ version_file = fp .read ()
28
+ version_match = re .search (
29
+ r"^__version__ = ['\"]([^'\"]*)['\"]" ,
30
+ version_file ,
31
+ re .M ,
32
+ )
33
+ if version_match :
34
+ return version_match .group (1 )
35
+
36
+ raise RuntimeError ("Unable to find version string." )
37
+
38
+
15
39
setup (
16
40
name = "readability-lxml" ,
17
- version = "0.7" ,
41
+ version = find_version ( "readability" , "__init__.py" ) ,
18
42
author = "Yuri Baburov" ,
19
43
author_email = "burchik@gmail.com" ,
20
44
description = "fast html to text parser (article readability tool) with python3 support" ,
You can’t perform that action at this time.
0 commit comments