10
10
VERSION = '0.2.3'
11
11
EMAIL = 'wangc_2011 (at) hotmail.com'
12
12
LICENSE = 'New BSD'
13
- PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
14
13
DESCRIPTION = (
15
14
'A wrapper library to read, manipulate and write data in xlsx and xlsm ' +
16
15
'format' +
23
22
'xlsx'
24
23
]
25
24
26
- INSTALL_REQUIRES = [
27
- 'openpyxl>=2.2.2' ,
28
- 'pyexcel-io>=0.2.2' ,
29
- ]
30
-
31
-
32
- EXTRAS_REQUIRE = {
33
- }
34
-
35
25
CLASSIFIERS = [
36
26
'Topic :: Office/Business' ,
37
27
'Topic :: Utilities' ,
47
37
'Programming Language :: Python :: Implementation :: PyPy'
48
38
]
49
39
40
+ INSTALL_REQUIRES = [
41
+ 'openpyxl>=2.2.2' ,
42
+ 'pyexcel-io>=0.2.2' ,
43
+ ]
44
+
45
+
46
+ PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
47
+ EXTRAS_REQUIRE = {
48
+ }
49
+
50
50
51
51
def read_files (* files ):
52
52
"""Read files into setup"""
53
53
text = ""
54
54
for single_file in files :
55
- text = text + read (single_file ) + "\n "
55
+ content = read (single_file )
56
+ text = text + content + "\n "
56
57
return text
57
58
58
59
59
60
def read (afile ):
60
61
"""Read a file into setup"""
61
62
with open (afile , 'r' ) as opened_file :
62
- return opened_file .read ()
63
+ content = filter_out_test_code (opened_file )
64
+ content = "" .join (list (content ))
65
+ return content
66
+
67
+
68
+ def filter_out_test_code (file_handle ):
69
+ found_test_code = False
70
+ for line in file_handle .readlines ():
71
+ if line .startswith ('.. testcode:' ):
72
+ found_test_code = True
73
+ continue
74
+ if found_test_code is True :
75
+ if line .startswith (' ' ):
76
+ continue
77
+ else :
78
+ empty_line = line .strip ()
79
+ if len (empty_line ) == 0 :
80
+ continue
81
+ else :
82
+ found_test_code = False
83
+ yield line
84
+ else :
85
+ yield line
63
86
64
87
65
88
if __name__ == '__main__' :
@@ -69,14 +92,14 @@ def read(afile):
69
92
version = VERSION ,
70
93
author_email = EMAIL ,
71
94
description = DESCRIPTION ,
72
- install_requires = INSTALL_REQUIRES ,
95
+ long_description = read_files ('README.rst' , 'CHANGELOG.rst' ),
96
+ license = LICENSE ,
73
97
keywords = KEYWORDS ,
74
98
extras_require = EXTRAS_REQUIRE ,
99
+ tests_require = ['nose' ],
100
+ install_requires = INSTALL_REQUIRES ,
75
101
packages = PACKAGES ,
76
102
include_package_data = True ,
77
- long_description = read_files ('README.rst' , 'CHANGELOG.rst' ),
78
103
zip_safe = False ,
79
- tests_require = ['nose' ],
80
- license = LICENSE ,
81
104
classifiers = CLASSIFIERS
82
105
)
0 commit comments