1616JYTHON = sys .platform .startswith ('java' )
1717requirements = []
1818
19- if sys .version_info [0 ] == 2 or (sys .version_info [0 ] == 3
20- and sys .version_info [1 ] < 3 ):
19+ if sys .version_info [0 ] == 2 or (sys .version_info [0 ] == 3 and
20+ sys .version_info [1 ] < 3 ):
2121 requirements .append ('ipaddress' )
2222
2323compile_args = ['-Wall' , '-Wextra' ]
2424
2525if sys .version_info [0 ] == 2 :
2626 compile_args .append ('-fno-strict-aliasing' )
2727
28-
2928ext_module = [
3029 Extension (
3130 'maxminddb.extension' ,
3231 libraries = ['maxminddb' ],
3332 sources = ['maxminddb/extension/maxminddb.c' ],
34- extra_compile_args = compile_args ,
35- )
33+ extra_compile_args = compile_args , )
3634]
3735
3836# Cargo cult code for installing extension with pure Python fallback.
4139if sys .platform == 'win32' :
4240 # 2.6's distutils.msvc9compiler can raise an IOError when failing to
4341 # find the compiler
44- ext_errors += (IOError ,)
42+ ext_errors += (IOError , )
4543
4644
4745class BuildFailed (Exception ):
48-
4946 def __init__ (self ):
5047 self .cause = sys .exc_info ()[1 ] # work around py 2/3 different syntax
5148
@@ -70,6 +67,7 @@ def build_extension(self, ext):
7067 raise BuildFailed ()
7168 raise
7269
70+
7371cmdclass ['build_ext' ] = ve_build_ext
7472
7573#
@@ -81,10 +79,10 @@ def build_extension(self, ext):
8179
8280with open (os .path .join (ROOT , 'maxminddb' , '__init__.py' ), 'rb' ) as fd :
8381 maxminddb_text = fd .read ().decode ('utf8' )
84- LICENSE = re .compile (
85- r".*__license__ = '(.*?)'" , re .S ).match (maxminddb_text ).group (1 )
86- VERSION = re .compile (
87- r".*__version__ = '(.*?)'" , re .S ).match (maxminddb_text ).group (1 )
82+ LICENSE = re .compile (r".*__license__ = '(.*?)'" ,
83+ re .S ).match (maxminddb_text ).group (1 )
84+ VERSION = re .compile (r".*__version__ = '(.*?)'" ,
85+ re .S ).match (maxminddb_text ).group (1 )
8886
8987
9088def status_msgs (* msgs ):
@@ -109,11 +107,12 @@ def run_setup(with_cext):
109107 kwargs = {}
110108 if with_cext :
111109 if Feature :
112- kwargs ['features' ] = {'extension' : Feature (
113- "optional C implementation" ,
114- standard = True ,
115- ext_modules = ext_module
116- )}
110+ kwargs ['features' ] = {
111+ 'extension' : Feature (
112+ "optional C implementation" ,
113+ standard = True ,
114+ ext_modules = ext_module )
115+ }
117116 else :
118117 kwargs ['ext_modules' ] = ext_module
119118
@@ -145,35 +144,30 @@ def run_setup(with_cext):
145144 'Programming Language :: Python :: 3' ,
146145 'Programming Language :: Python :: 3.3' ,
147146 'Programming Language :: Python :: 3.4' ,
147+ 'Programming Language :: Python :: 3.5' ,
148148 'Programming Language :: Python' ,
149149 'Topic :: Internet :: Proxy Servers' ,
150150 'Topic :: Internet' ,
151151 ],
152- ** kwargs
153- )
152+ ** kwargs )
153+
154154
155155if PYPY or JYTHON :
156156 run_setup (False )
157- status_msgs (
158- "WARNING: Disabling C extension due to Python platform." ,
159- "Plain-Python build succeeded."
160- )
157+ status_msgs ("WARNING: Disabling C extension due to Python platform." ,
158+ "Plain-Python build succeeded." )
161159else :
162160 try :
163161 run_setup (True )
164162 except BuildFailed as exc :
165- status_msgs (
166- exc .cause ,
167- "WARNING: The C extension could not be compiled, " +
168- "speedups are not enabled." ,
169- "Failure information, if any, is above." ,
170- "Retrying the build without the C extension now."
171- )
163+ status_msgs (exc .cause ,
164+ "WARNING: The C extension could not be compiled, " +
165+ "speedups are not enabled." ,
166+ "Failure information, if any, is above." ,
167+ "Retrying the build without the C extension now." )
172168
173169 run_setup (False )
174170
175- status_msgs (
176- "WARNING: The C extension could not be compiled, " +
177- "speedups are not enabled." ,
178- "Plain-Python build succeeded."
179- )
171+ status_msgs ("WARNING: The C extension could not be compiled, " +
172+ "speedups are not enabled." ,
173+ "Plain-Python build succeeded." )
0 commit comments