44
55from distutils .core import Extension
66
7- from distutils .errors import (CCompilerError , DistutilsExecError ,
8- DistutilsPlatformError )
7+ from distutils .errors import CCompilerError , DistutilsExecError , DistutilsPlatformError
98from distutils .command .build_ext import build_ext
109
1110
1211# C Extensions
13- with_extensions = os .getenv (' PENDULUM_EXTENSIONS' , None )
12+ with_extensions = os .getenv (" PENDULUM_EXTENSIONS" , None )
1413
15- if with_extensions == '1' or with_extensions is None :
14+ if with_extensions == "1" or with_extensions is None :
1615 with_extensions = True
1716
18- if with_extensions == '0' or hasattr (sys , ' pypy_version_info' ):
17+ if with_extensions == "0" or hasattr (sys , " pypy_version_info" ):
1918 with_extensions = False
2019
2120extensions = []
2221if with_extensions :
2322 extensions = [
24- Extension ('pendulum._extensions._helpers' ,
25- ['pendulum/_extensions/_helpers.c' ]),
26- Extension ('pendulum.parsing._iso8601' ,
27- ['pendulum/parsing/_iso8601.c' ]),
23+ Extension ("pendulum._extensions._helpers" , ["pendulum/_extensions/_helpers.c" ]),
24+ Extension ("pendulum.parsing._iso8601" , ["pendulum/parsing/_iso8601.c" ]),
2825 ]
2926
3027
@@ -40,39 +37,23 @@ def run(self):
4037 try :
4138 build_ext .run (self )
4239 except (DistutilsPlatformError , FileNotFoundError ):
43- print (
44- "************************************************************"
45- )
46- print (
47- "Cannot compile C accelerator module, use pure python version"
48- )
49- print (
50- "************************************************************"
51- )
40+ print ("************************************************************" )
41+ print ("Cannot compile C accelerator module, use pure python version" )
42+ print ("************************************************************" )
5243
5344 def build_extension (self , ext ):
5445 try :
5546 build_ext .build_extension (self , ext )
56- except (CCompilerError , DistutilsExecError ,
57- DistutilsPlatformError , ValueError ):
58- print (
59- "************************************************************"
60- )
61- print (
62- "Cannot compile C accelerator module, use pure python version"
63- )
64- print (
65- "************************************************************"
66- )
47+ except (CCompilerError , DistutilsExecError , DistutilsPlatformError , ValueError ):
48+ print ("************************************************************" )
49+ print ("Cannot compile C accelerator module, use pure python version" )
50+ print ("************************************************************" )
6751
6852
6953def build (setup_kwargs ):
7054 """
7155 This function is mandatory in order to build the extensions.
7256 """
73- setup_kwargs .update ({
74- 'ext_modules' : extensions ,
75- 'cmdclass' : {
76- 'build_ext' : ExtBuilder
77- }
78- })
57+ setup_kwargs .update (
58+ {"ext_modules" : extensions , "cmdclass" : {"build_ext" : ExtBuilder }}
59+ )
0 commit comments