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+
13from .readability import Document
Original file line number Diff line number Diff line change 11#!/usr/bin/env python
2+
23from __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
48import sys
59
610lxml_requirement = "lxml"
1216 print ("Using lxml<2.4" )
1317 lxml_requirement = "lxml<2.4"
1418
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+
1539setup (
1640 name = "readability-lxml" ,
17- version = "0.7" ,
41+ version = find_version ( "readability" , "__init__.py" ) ,
1842 author = "Yuri Baburov" ,
19432044 description = "fast html to text parser (article readability tool) with python3 support" ,
You can’t perform that action at this time.
0 commit comments