@@ -141,53 +141,54 @@ def run(self):
141
141
shutil .copy (str (dll_file ), str (dest_path ))
142
142
143
143
144
- # Compile and link options----------------------------------------------------
145
-
146
- os_name = os .name
147
- gcfg = get_gsl_config ()
148
-
149
- # On macOS, dynamic linking may not be needed
150
- if sys .platform == "darwin" :
151
- libraries = []
152
- else :
153
- libraries = ["gsl" ]
154
-
155
- include_dirs = [MYDIR ] + gcfg ["include_dirs" ]
156
- library_dirs = gcfg ["library_dirs" ]
157
- define_macros = []
158
- extra_objects = []
159
- extra_compile_args = []
160
- extra_link_args = []
161
-
162
- compiler_type = get_compiler_type ()
163
- if compiler_type in ("unix" , "cygwin" , "mingw32" ):
164
- extra_compile_args = ["-std=c++11" , "-Wall" , "-Wno-write-strings" , "-O3" , "-funroll-loops" , "-ffast-math" ]
165
- # Check for static GSL libraries and add them if found.
166
- static_libs = [
167
- os .path .join (p , "libgsl.a" ) for p in gcfg ["library_dirs" ] if os .path .isfile (os .path .join (p , "libgsl.a" ))
168
- ]
169
- if static_libs :
170
- extra_objects += static_libs
171
- # Use static linking: remove "-lgsl" to avoid dynamic linking conflicts.
172
- libraries = []
173
- elif compiler_type == "msvc" :
174
- define_macros += [("_USE_MATH_DEFINES" , None )]
175
- extra_compile_args = ["/EHs" ]
176
-
177
- # Extension keyword arguments.
178
- ext_kws = {
179
- "include_dirs" : include_dirs ,
180
- "libraries" : libraries ,
181
- "library_dirs" : library_dirs ,
182
- "define_macros" : define_macros ,
183
- "extra_compile_args" : extra_compile_args ,
184
- "extra_link_args" : extra_link_args ,
185
- "extra_objects" : extra_objects ,
186
- }
187
-
188
-
189
144
def create_extensions ():
190
145
"""Create the list of Extension objects for the build."""
146
+ # lazy evaluation prevents build sdist failure
147
+ try :
148
+ gcfg = get_gsl_config ()
149
+ except EnvironmentError :
150
+ return []
151
+
152
+ # On macOS, dynamic linking may not be needed
153
+ if sys .platform == "darwin" :
154
+ libraries = []
155
+ else :
156
+ libraries = ["gsl" ]
157
+
158
+ include_dirs = [MYDIR ] + gcfg ["include_dirs" ]
159
+ library_dirs = gcfg ["library_dirs" ]
160
+ define_macros = []
161
+ extra_objects = []
162
+ extra_compile_args = []
163
+ extra_link_args = []
164
+
165
+ compiler_type = get_compiler_type ()
166
+ if compiler_type in ("unix" , "cygwin" , "mingw32" ):
167
+ extra_compile_args = ["-std=c++11" , "-Wall" , "-Wno-write-strings" , "-O3" , "-funroll-loops" , "-ffast-math" ]
168
+ # Check for static GSL libraries and add them if found.
169
+ static_libs = [
170
+ os .path .join (p , "libgsl.a" )
171
+ for p in gcfg ["library_dirs" ]
172
+ if os .path .isfile (os .path .join (p , "libgsl.a" ))
173
+ ]
174
+ if static_libs :
175
+ extra_objects += static_libs
176
+ # Use static linking: remove "-lgsl" to avoid dynamic linking conflicts.
177
+ libraries = []
178
+ elif compiler_type == "msvc" :
179
+ define_macros += [("_USE_MATH_DEFINES" , None )]
180
+ extra_compile_args = ["/EHs" ]
181
+
182
+ # Extension keyword arguments.
183
+ ext_kws = {
184
+ "include_dirs" : include_dirs ,
185
+ "libraries" : libraries ,
186
+ "library_dirs" : library_dirs ,
187
+ "define_macros" : define_macros ,
188
+ "extra_compile_args" : extra_compile_args ,
189
+ "extra_link_args" : extra_link_args ,
190
+ "extra_objects" : extra_objects ,
191
+ }
191
192
ext = Extension ("diffpy.pdffit2.pdffit2" , glob .glob ("src/extensions/**/*.cc" ), ** ext_kws )
192
193
return [ext ]
193
194
0 commit comments