1- from setuptools import setup , find_packages
2-
1+ try :
2+ from setuptools import setup , find_packages
3+ except ImportError :
4+ from ez_setup import use_setuptools
5+ use_setuptools ()
6+ from setuptools import setup , find_packages
7+ from platform import python_implementation
8+ import sys
9+ PY2 = sys .version_info [0 ] == 2
10+ PY26 = PY2 and sys .version_info [1 ] < 7
311
412NAME = 'moban'
5- AUTHOR = 'C.W.'
13+ AUTHOR = 'C. W.'
614VERSION = '0.0.7'
7- EMAIL = " wangc_2011 (at) hotmail.com"
15+ EMAIL = ' wangc_2011@ hotmail.com'
816LICENSE = 'MIT'
917ENTRY_POINTS = {
1018 'console_scripts' : [
11- '%s = moban.main:main' % NAME
19+ 'moban = moban.main:main'
1220 ]
1321}
14- PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
15- DESCRIPTION = 'Yet another jinja2 cli command for static text generation'
16- INSTALL_REQUIRES = ['pyyaml>=3.11' , 'jinja2>=2.7.1' ]
22+ DESCRIPTION = (
23+ 'Yet another jinja2 cli command for static text generation' +
24+ ''
25+ )
26+ URL = 'https://github.com/moremoban/moban'
27+ DOWNLOAD_URL = '%s/archive/0.0.7.tar.gz' % URL
28+ FILES = ['README.rst' , 'CHANGELOG.rst' ]
29+ KEYWORDS = [
30+ 'jinja2' ,
31+ 'moban' ,
32+ 'python'
33+ ]
34+
1735CLASSIFIERS = [
18- 'Development Status :: 3 - Alpha' ,
19- 'License :: OSI Approved :: MIT License' ,
36+ 'Topic :: Office/Business' ,
37+ 'Topic :: Utilities' ,
38+ 'Topic :: Software Development :: Libraries' ,
39+ 'Programming Language :: Python' ,
40+ 'License :: OSI Approved :: BSD License' ,
2041 'Intended Audience :: Developers' ,
42+ 'Programming Language :: Python :: 2.6' ,
43+ 'Programming Language :: Python :: 2.7' ,
44+ 'Programming Language :: Python :: 3.3' ,
45+ 'Programming Language :: Python :: 3.4' ,
46+ 'Programming Language :: Python :: 3.5' ,
47+ 'Programming Language :: Python :: 3.6' ,
2148]
2249
50+ INSTALL_REQUIRES = [
51+ 'pyyaml>=3.11' ,
52+ 'jinja2>=2.7.1' ,
53+ ]
54+
55+
56+ PACKAGES = find_packages (exclude = ['ez_setup' , 'examples' , 'tests' ])
57+ EXTRAS_REQUIRE = {
58+ }
59+
2360
2461def read_files (* files ):
62+ """Read files into setup"""
2563 text = ""
2664 for single_file in files :
27- text = text + read (single_file ) + "\n "
65+ content = read (single_file )
66+ text = text + content + "\n "
2867 return text
2968
3069
3170def read (afile ):
71+ """Read a file into setup"""
3272 with open (afile , 'r' ) as opened_file :
33- return opened_file .read ()
73+ content = filter_out_test_code (opened_file )
74+ content = "" .join (list (content ))
75+ return content
76+
77+
78+ def filter_out_test_code (file_handle ):
79+ found_test_code = False
80+ for line in file_handle .readlines ():
81+ if line .startswith ('.. testcode:' ):
82+ found_test_code = True
83+ continue
84+ if found_test_code is True :
85+ if line .startswith (' ' ):
86+ continue
87+ else :
88+ empty_line = line .strip ()
89+ if len (empty_line ) == 0 :
90+ continue
91+ else :
92+ found_test_code = False
93+ yield line
94+ else :
95+ for keyword in ['|version|' , '|today|' ]:
96+ if keyword in line :
97+ break
98+ else :
99+ yield line
34100
35101
36102if __name__ == '__main__' :
@@ -40,13 +106,17 @@ def read(afile):
40106 version = VERSION ,
41107 author_email = EMAIL ,
42108 description = DESCRIPTION ,
109+ url = URL ,
110+ download_url = DOWNLOAD_URL ,
111+ long_description = read_files (* FILES ),
112+ license = LICENSE ,
113+ keywords = KEYWORDS ,
114+ extras_require = EXTRAS_REQUIRE ,
115+ tests_require = ['nose' ],
43116 install_requires = INSTALL_REQUIRES ,
44117 packages = PACKAGES ,
45118 include_package_data = True ,
46- long_description = read_files ('README.rst' , 'CHANGELOG.rst' ),
47119 zip_safe = False ,
48- tests_require = ['nose' ],
49- license = LICENSE ,
50- classifiers = CLASSIFIERS ,
51- entry_points = ENTRY_POINTS
120+ entry_points = ENTRY_POINTS ,
121+ classifiers = CLASSIFIERS
52122 )
0 commit comments