44 from ez_setup import use_setuptools
55 use_setuptools ()
66 from setuptools import setup , find_packages
7+ import sys
8+ PY2 = sys .version_info [0 ] == 2
9+ PY26 = PY2 and sys .version_info [1 ] < 7
710
811NAME = 'pyexcel-text'
912AUTHOR = 'C.W.'
1013VERSION = '0.2.4'
1114EMAIL = 'wangc_2011 (at) hotmail.com'
1215LICENSE = 'New BSD'
13- PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
1416DESCRIPTION = (
1517 'A plugin to pyexcel and provides the capability to present and write d' +
1618 'ata in text formats' +
3335 "json"
3436]
3537
36- INSTALL_REQUIRES = [
37- 'pyexcel>=0.2.2' ,
38- 'tabulate>=0.7.4' ,
39- ]
40-
41- EXTRAS_REQUIRE = {
42- }
43-
4438CLASSIFIERS = [
4539 'Topic :: Office/Business' ,
4640 'Topic :: Utilities' ,
5549 'Programming Language :: Python :: Implementation :: PyPy'
5650]
5751
52+ INSTALL_REQUIRES = [
53+ 'pyexcel>=0.2.2' ,
54+ 'tabulate>=0.7.4' ,
55+ ]
56+
57+
58+ PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
59+ EXTRAS_REQUIRE = {
60+ }
61+
5862
5963def read_files (* files ):
6064 """Read files into setup"""
6165 text = ""
6266 for single_file in files :
63- text = text + read (single_file ) + "\n "
67+ content = read (single_file )
68+ text = text + content + "\n "
6469 return text
6570
6671
6772def read (afile ):
6873 """Read a file into setup"""
6974 with open (afile , 'r' ) as opened_file :
70- return opened_file .read ()
75+ content = filter_out_test_code (opened_file )
76+ content = "" .join (list (content ))
77+ return content
78+
79+
80+ def filter_out_test_code (file_handle ):
81+ found_test_code = False
82+ for line in file_handle .readlines ():
83+ if line .startswith ('.. testcode:' ):
84+ found_test_code = True
85+ continue
86+ if found_test_code is True :
87+ if line .startswith (' ' ):
88+ continue
89+ else :
90+ empty_line = line .strip ()
91+ if len (empty_line ) == 0 :
92+ continue
93+ else :
94+ found_test_code = False
95+ yield line
96+ else :
97+ yield line
7198
7299
73100if __name__ == '__main__' :
@@ -77,14 +104,14 @@ def read(afile):
77104 version = VERSION ,
78105 author_email = EMAIL ,
79106 description = DESCRIPTION ,
80- install_requires = INSTALL_REQUIRES ,
107+ long_description = read_files ('README.rst' , 'CHANGELOG.rst' ),
108+ license = LICENSE ,
81109 keywords = KEYWORDS ,
82110 extras_require = EXTRAS_REQUIRE ,
111+ tests_require = ['nose' ],
112+ install_requires = INSTALL_REQUIRES ,
83113 packages = PACKAGES ,
84114 include_package_data = True ,
85- long_description = read_files ('README.rst' , 'CHANGELOG.rst' ),
86115 zip_safe = False ,
87- tests_require = ['nose' ],
88- license = LICENSE ,
89116 classifiers = CLASSIFIERS
90117 )
0 commit comments