1
1
#!/usr/bin/env python3
2
2
3
3
# Template by pypi-mobans
4
- import os
5
- import sys
6
4
import codecs
7
5
import locale
6
+ import os
8
7
import platform
8
+ import sys
9
9
from shutil import rmtree
10
10
11
- from setuptools import Command , setup , find_packages
11
+ from setuptools import Command , find_packages , setup
12
12
13
13
PY2 = sys .version_info [0 ] == 2
14
14
PY26 = PY2 and sys .version_info [1 ] < 7
@@ -22,52 +22,56 @@ PY33 = sys.version_info < (3, 4)
22
22
try :
23
23
lc = locale .getlocale ()
24
24
pf = platform .system ()
25
- if pf != ' Windows' and lc == (None , None ):
26
- locale .setlocale (locale .LC_ALL , ' C.UTF-8' )
25
+ if pf != " Windows" and lc == (None , None ):
26
+ locale .setlocale (locale .LC_ALL , " C.UTF-8" )
27
27
except (ValueError , UnicodeError , locale .Error ):
28
- locale .setlocale (locale .LC_ALL , ' en_US.UTF-8' )
28
+ locale .setlocale (locale .LC_ALL , " en_US.UTF-8" )
29
29
30
- NAME = ''
31
- AUTHOR = ''
32
- VERSION = ''
33
- EMAIL = ''
34
- LICENSE = ''
30
+ NAME = "pypi-mobans"
31
+ AUTHOR = "C.W."
32
+ VERSION = ""
33
+
34
+ LICENSE = "NEW BSD"
35
35
DESCRIPTION = (
36
- 'test'
36
+ "Scaffolding templates for your Python project."
37
37
)
38
- URL = ' https://github.com//'
39
- DOWNLOAD_URL = ' %s/archive/. tar.gz' % URL
40
- FILES = [' README.rst' , ' CHANGELOG.rst' ]
38
+ URL = " https://github.com/moremoban/pypi-mobans"
39
+ DOWNLOAD_URL = " %s/archive/0.0.0. tar.gz" % URL
40
+ FILES = [" README.rst" , " CHANGELOG.rst" ]
41
41
KEYWORDS = [
42
- ' python' ,
42
+ " python" ,
43
43
]
44
44
45
45
CLASSIFIERS = [
46
- 'Topic :: Software Development :: Libraries' ,
47
- 'Programming Language :: Python' ,
48
- 'Intended Audience :: Developers' ,
49
- 'Programming Language :: Python :: 2.6' ,
50
- 'Programming Language :: Python :: 2.7' ,
51
- 'Programming Language :: Python :: 3.3' ,
52
- 'Programming Language :: Python :: 3.4' ,
53
- 'Programming Language :: Python :: 3.5' ,
54
- 'Programming Language :: Python :: 3.6' ,
46
+ "Topic :: Software Development :: Libraries" ,
47
+ "Programming Language :: Python" ,
48
+ "Intended Audience :: Developers" ,
49
+ "Programming Language :: Python :: 2.6" ,
50
+ "Programming Language :: Python :: 2.7" ,
51
+ "Programming Language :: Python :: 3.3" ,
52
+ "Programming Language :: Python :: 3.4" ,
53
+ "Programming Language :: Python :: 3.5" ,
54
+ "Programming Language :: Python :: 3.6" ,
55
+
56
+ "Programming Language :: Python :: 3.7" ,
57
+
58
+ "Programming Language :: Python :: 3.8" ,
59
+
55
60
]
56
61
57
62
INSTALL_REQUIRES = [
58
63
]
59
64
SETUP_COMMANDS = {}
60
65
61
66
62
- PACKAGES = find_packages (exclude = [' ez_setup' , ' examples' , ' tests' ])
67
+ PACKAGES = find_packages (exclude = [" ez_setup" , " examples" , " tests" ])
63
68
EXTRAS_REQUIRE = {}
64
69
# You do not need to read beyond this line
65
- PUBLISH_COMMAND = '{0} setup.py sdist bdist_wheel upload -r pypi' .format (
66
- sys .executable )
67
- GS_COMMAND = ('gs v ' +
68
- "Find in changelog for more details" )
69
- NO_GS_MESSAGE = ('Automatic github release is disabled. ' +
70
- 'Please install gease to enable it.' )
70
+ PUBLISH_COMMAND = "{0} setup.py sdist bdist_wheel upload -r pypi" .format (sys .executable )
71
+ GS_COMMAND = ("gs pypi-mobans v0.0.0 " +
72
+ "Find 0.0.0 in changelog for more details" )
73
+ NO_GS_MESSAGE = ("Automatic github release is disabled. " +
74
+ "Please install gease to enable it." )
71
75
UPLOAD_FAILED_MSG = (
72
76
'Upload failed. please run "%s" yourself.' % PUBLISH_COMMAND )
73
77
HERE = os .path .abspath (os .path .dirname (__file__ ))
@@ -76,13 +80,13 @@ HERE = os.path.abspath(os.path.dirname(__file__))
76
80
class PublishCommand (Command ):
77
81
"""Support setup.py upload."""
78
82
79
- description = ' Build and publish the package on github and pypi'
83
+ description = " Build and publish the package on github and pypi"
80
84
user_options = []
81
85
82
86
@staticmethod
83
87
def status (s ):
84
88
"""Prints things in bold."""
85
- print (' \033 [1m{0}\033 [0m' .format (s ))
89
+ print (" \033 [1m{0}\033 [0m" .format (s ))
86
90
87
91
def initialize_options (self ):
88
92
pass
@@ -92,14 +96,14 @@ class PublishCommand(Command):
92
96
93
97
def run (self ):
94
98
try :
95
- self .status (' Removing previous builds...' )
96
- rmtree (os .path .join (HERE , ' dist' ))
97
- rmtree (os .path .join (HERE , ' build' ))
98
- rmtree (os .path .join (HERE , ' .egg-info' ))
99
+ self .status (" Removing previous builds..." )
100
+ rmtree (os .path .join (HERE , " dist" ))
101
+ rmtree (os .path .join (HERE , " build" ))
102
+ rmtree (os .path .join (HERE , "pypi_mobans .egg-info" ))
99
103
except OSError :
100
104
pass
101
105
102
- self .status (' Building Source and Wheel (universal) distribution...' )
106
+ self .status (" Building Source and Wheel (universal) distribution..." )
103
107
run_status = True
104
108
if has_gease ():
105
109
run_status = os .system (GS_COMMAND ) == 0
@@ -113,7 +117,7 @@ class PublishCommand(Command):
113
117
114
118
115
119
SETUP_COMMANDS .update ({
116
- ' publish' : PublishCommand
120
+ " publish" : PublishCommand
117
121
})
118
122
119
123
@@ -142,7 +146,7 @@ def read_files(*files):
142
146
def read (afile ):
143
147
"""Read a file into setup"""
144
148
the_relative_file = os .path .join (HERE , afile )
145
- with codecs .open (the_relative_file , 'r' , ' utf-8' ) as opened_file :
149
+ with codecs .open (the_relative_file , "r" , " utf-8" ) as opened_file :
146
150
content = filter_out_test_code (opened_file )
147
151
content = "" .join (list (content ))
148
152
return content
@@ -151,11 +155,11 @@ def read(afile):
151
155
def filter_out_test_code (file_handle ):
152
156
found_test_code = False
153
157
for line in file_handle .readlines ():
154
- if line .startswith (' .. testcode:' ):
158
+ if line .startswith (" .. testcode:" ):
155
159
found_test_code = True
156
160
continue
157
161
if found_test_code is True :
158
- if line .startswith (' ' ):
162
+ if line .startswith (" " ):
159
163
continue
160
164
else :
161
165
empty_line = line .strip ()
@@ -165,14 +169,14 @@ def filter_out_test_code(file_handle):
165
169
found_test_code = False
166
170
yield line
167
171
else :
168
- for keyword in [' |version|' , ' |today|' ]:
172
+ for keyword in [" |version|" , " |today|" ]:
169
173
if keyword in line :
170
174
break
171
175
else :
172
176
yield line
173
177
174
178
175
- if __name__ == ' __main__' :
179
+ if __name__ == " __main__" :
176
180
setup (
177
181
test_suite = "tests" ,
178
182
name = NAME ,
@@ -186,7 +190,7 @@ if __name__ == '__main__':
186
190
license = LICENSE ,
187
191
keywords = KEYWORDS ,
188
192
extras_require = EXTRAS_REQUIRE ,
189
- tests_require = [' nose' ],
193
+ tests_require = [" nose" ],
190
194
install_requires = INSTALL_REQUIRES ,
191
195
packages = PACKAGES ,
192
196
include_package_data = True ,
0 commit comments