@@ -211,6 +211,9 @@ def __init__ (self, verbose=0, dry_run=0, force=0):
211211 self .__macros = MacroExpander (self .__version )
212212 else :
213213 self .__root = r"Software\Microsoft\Devstudio"
214+ self .initialized = False
215+
216+ def initialize (self ):
214217 self .__paths = self .get_msvc_paths ("path" )
215218
216219 if len (self .__paths ) == 0 :
@@ -290,6 +293,7 @@ def compile(self, sources,
290293 output_dir = None , macros = None , include_dirs = None , debug = 0 ,
291294 extra_preargs = None , extra_postargs = None , depends = None ):
292295
296+ if not self .initialized : self .initialize ()
293297 macros , objects , extra_postargs , pp_opts , build = \
294298 self ._setup_compile (output_dir , macros , include_dirs , sources ,
295299 depends , extra_postargs )
@@ -381,6 +385,7 @@ def create_static_lib (self,
381385 debug = 0 ,
382386 target_lang = None ):
383387
388+ if not self .initialized : self .initialize ()
384389 (objects , output_dir ) = self ._fix_object_args (objects , output_dir )
385390 output_filename = \
386391 self .library_filename (output_libname , output_dir = output_dir )
@@ -414,6 +419,7 @@ def link (self,
414419 build_temp = None ,
415420 target_lang = None ):
416421
422+ if not self .initialized : self .initialize ()
417423 (objects , output_dir ) = self ._fix_object_args (objects , output_dir )
418424 (libraries , library_dirs , runtime_library_dirs ) = \
419425 self ._fix_lib_args (libraries , library_dirs , runtime_library_dirs )
0 commit comments