275 # confnode asks for some LDFLAGS |
275 # confnode asks for some LDFLAGS |
276 if CTNLDFLAGS: |
276 if CTNLDFLAGS: |
277 # LDFLAGS can be either string |
277 # LDFLAGS can be either string |
278 if type(CTNLDFLAGS)==type(str()): |
278 if type(CTNLDFLAGS)==type(str()): |
279 LDFLAGS=[CTNLDFLAGS] |
279 LDFLAGS=[CTNLDFLAGS] |
280 #or list of strings |
280 # or list of strings |
281 elif type(CTNLDFLAGS)==type(list()): |
281 elif type(CTNLDFLAGS)==type(list()): |
282 LDFLAGS=CTNLDFLAGS[:] |
282 LDFLAGS=CTNLDFLAGS[:] |
283 else: |
283 else: |
284 LDFLAGS=[] |
284 LDFLAGS=[] |
285 |
285 |
288 new_location = CTNChild.GetCurrentLocation() |
288 new_location = CTNChild.GetCurrentLocation() |
289 # How deep are we in the tree ? |
289 # How deep are we in the tree ? |
290 depth=len(new_location) |
290 depth=len(new_location) |
291 _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \ |
291 _LocationCFilesAndCFLAGS, _LDFLAGS, _extra_files = \ |
292 CTNChild._Generate_C( |
292 CTNChild._Generate_C( |
293 #keep the same path |
293 # keep the same path |
294 buildpath, |
294 buildpath, |
295 # filter locations that start with current IEC location |
295 # filter locations that start with current IEC location |
296 [loc for loc in locations if loc["LOC"][0:depth] == new_location ]) |
296 [loc for loc in locations if loc["LOC"][0:depth] == new_location ]) |
297 # stack the result |
297 # stack the result |
298 LocationCFilesAndCFLAGS += _LocationCFilesAndCFLAGS |
298 LocationCFilesAndCFLAGS += _LocationCFilesAndCFLAGS |
559 ConfigTreeNode.__init__(_self) |
559 ConfigTreeNode.__init__(_self) |
560 # check name is unique |
560 # check name is unique |
561 NewCTNName = _self.FindNewName(CTNName) |
561 NewCTNName = _self.FindNewName(CTNName) |
562 # If dir have already be made, and file exist |
562 # If dir have already be made, and file exist |
563 if os.path.isdir(_self.CTNPath(NewCTNName)): #and os.path.isfile(_self.ConfNodeXmlFilePath(CTNName)): |
563 if os.path.isdir(_self.CTNPath(NewCTNName)): #and os.path.isfile(_self.ConfNodeXmlFilePath(CTNName)): |
564 #Load the confnode.xml file into parameters members |
564 # Load the confnode.xml file into parameters members |
565 _self.LoadXMLParams(NewCTNName) |
565 _self.LoadXMLParams(NewCTNName) |
566 # Basic check. Better to fail immediately. |
566 # Basic check. Better to fail immediately. |
567 if (_self.BaseParams.getName() != NewCTNName): |
567 if (_self.BaseParams.getName() != NewCTNName): |
568 msg = _("Project tree layout do not match confnode.xml {a1}!={a2} ").\ |
568 msg = _("Project tree layout do not match confnode.xml {a1}!={a2} ").\ |
569 format(a1 = NewCTNName, a2 = _self.BaseParams.getName()) |
569 format(a1 = NewCTNName, a2 = _self.BaseParams.getName()) |
574 # Check that IEC_Channel is not already in use. |
574 # Check that IEC_Channel is not already in use. |
575 _self.FindNewIEC_Channel(_self.BaseParams.getIEC_Channel()) |
575 _self.FindNewIEC_Channel(_self.BaseParams.getIEC_Channel()) |
576 # Call the confnode real __init__ |
576 # Call the confnode real __init__ |
577 if getattr(CTNClass, "__init__", None): |
577 if getattr(CTNClass, "__init__", None): |
578 CTNClass.__init__(_self) |
578 CTNClass.__init__(_self) |
579 #Load and init all the children |
579 # Load and init all the children |
580 _self.LoadChildren() |
580 _self.LoadChildren() |
581 #just loaded, nothing to saved |
581 # just loaded, nothing to saved |
582 _self.ChangesToSave = False |
582 _self.ChangesToSave = False |
583 else: |
583 else: |
584 # If confnode do not have corresponding file/dirs - they will be created on Save |
584 # If confnode do not have corresponding file/dirs - they will be created on Save |
585 _self.CTNMakeDir() |
585 _self.CTNMakeDir() |
586 # Find an IEC number |
586 # Find an IEC number |
587 _self.FindNewIEC_Channel(IEC_Channel) |
587 _self.FindNewIEC_Channel(IEC_Channel) |
588 # Call the confnode real __init__ |
588 # Call the confnode real __init__ |
589 if getattr(CTNClass, "__init__", None): |
589 if getattr(CTNClass, "__init__", None): |
590 CTNClass.__init__(_self) |
590 CTNClass.__init__(_self) |
591 _self.CTNRequestSave() |
591 _self.CTNRequestSave() |
592 #just created, must be saved |
592 # just created, must be saved |
593 _self.ChangesToSave = True |
593 _self.ChangesToSave = True |
594 |
594 |
595 def _getBuildPath(_self): |
595 def _getBuildPath(_self): |
596 return self._getBuildPath() |
596 return self._getBuildPath() |
597 |
597 |