Ejemplo n.º 1
0
 def __init__(self, projectfolder):
     self._projectfolder = os.path.normpath(projectfolder)
     self._validation_context = ValidationContext(self.projectfolder,
                                                  locality='Configs')
     self._validation_errors = ErrorCollector()
     try:
         self._configdata = self.get_configs_file()
     except IOError:
         raise self.NoProjectErrorType(self._projectfolder)
Ejemplo n.º 2
0
 def __init__(self, projectfolder, use_cached=True, **kwargs):
     self.projectfolder = os.path.normpath(projectfolder)
     self._namebase = os.path.relpath(self.projectfolder, PROJECTS_ROOT)
     self._validation_context = ValidationContext(self.projectfolder,
                                                  'BOMParser')
     self._validation_errors = ErrorCollector()
     self.line_gen = None
     self._use_cached = use_cached
     self._generator_args = kwargs
Ejemplo n.º 3
0
 def validation_errors(self):
     # Regenerate Validation reconstructed structures
     lverrors = self._validate()
     rval = ErrorCollector()
     rval.add(self._validation_errors)
     # Obtain validation errors from Configs load
     rval.add(self._configs.validation_errors)
     # Obtain validation errors collected during construction
     # from Parser -> BOM -> OBOM
     rval.add(self._obom.validation_errors)
     rval.add(lverrors)
     return rval
Ejemplo n.º 4
0
 def _reload(self):
     # Not handled :
     #   - Name changes
     #   - Ripple effects to any downstream objects
     self._validation_errors = ErrorCollector()
     self._configs = None
     self._bom = None
     self._obom = None
     self._status = None
     self._strategy = None
     self._changelog = None
     self.ident = self._modulename
     self.validate()
Ejemplo n.º 5
0
    def _validate(self):
        # One Time Validators
        temp = self.configs
        temp = self.status
        temp = self.strategy
        temp = self.changelog
        temp = self.bom

        # Validators for Reconstructed Structures
        lvalidation_errors = ErrorCollector()
        # Validate all OBOM line devices
        # Validate all OBOM line idents
        # Validate all OBOM line quantity types
        self._validate_obom(lvalidation_errors)
        self._sourcing_errors = self.obom.sourcing_errors
        # TODO Check for valid snoseries
        # TODO Check for empty groups?
        # TODO Check for unused motifs?
        # TODO Validate all motifs as configured
        # TODO Validate all SJs are accounted for
        # TODO Validate all Generators are expected
        # TODO Higher order configuration validation
        self._validated = True
        return lvalidation_errors
Ejemplo n.º 6
0
    def _get_production_strategy(self):
        rval = {}
        configdata = self.configs.rawconfig
        ec = ErrorCollector()

        try:
            am = get_dict_val(configdata, self._pspol_doc_am)
        except ValidationError as e:
            am = e.policy.default
            ec.add(e)
        if am is True:
            # Assembly manifest should be used
            rval['prodst'] = "@AM"
            rval['genmanifest'] = True
        else:
            # No Assembly manifest needed
            rval['prodst'] = "@THIS"
            rval['genmanifest'] = False

        try:
            testing = get_dict_val(configdata, self._pspol_testing)
        except ValidationError as e:
            testing = e.policy.default
            ec.add(e)
        if testing == 'normal':
            # Normal test procedure, Test when made
            rval['testst'] = "@NOW"
        if testing == 'lazy':
            # Lazy test procedure, Test when used
            rval['testst'] = "@USE"

        try:
            labelling = get_dict_val(configdata, self._pspol_labelling)
        except ValidationError as e:
            labelling = e.policy.default
            ec.add(e)
        if labelling == 'normal':
            # Normal test procedure, Label when made
            rval['lblst'] = "@NOW"
        if labelling == 'lazy':
            # Lazy test procedure, Label when used
            rval['lblst'] = "@USE"
        rval['genlabel'] = False
        rval['labels'] = []

        try:
            labeldefs = get_dict_val(configdata, self._pspol_labeldefs)
        except ValidationError as e:
            labeldefs = e.policy.default
            ec.add(e)

        if labeldefs is not None:
            if isinstance(labeldefs, dict):
                for k in sorted(labeldefs.keys()):
                    rval['labels'].append(
                        {'code': k,
                         'ident': self.ident + '.' + configdata['label'][k]}
                    )
                rval['genlabel'] = True
            elif isinstance(labeldefs, str):
                rval['labels'].append(
                    {'code': labeldefs,
                     'ident': self.ident}
                )
                rval['genlabel'] = True
        return rval