diff --git a/kicost/edas/eda.py b/kicost/edas/eda.py new file mode 100644 index 000000000..6b238ff69 --- /dev/null +++ b/kicost/edas/eda.py @@ -0,0 +1,46 @@ +# MIT license +# +# Copyright (C) 2020 by Hildo Guillardi Junior +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Libraries. + + +from .global_vars import * + + +__all__ = ['eda_class'] + + +class eda_class(object): + def __init__(self, name, logger): + self.name = name + self.logger = logger + +def get_part_groups(in_file): + '''Get groups of identical parts from an generic CSV file and return them as a dictionary. + @param in_file `str()` with the file name. + @param ignore_fields `list()` fields do be ignored on the read action. + @param variant `str()` in regular expression to match with the design version of the BOM. + For now, `variant`is not used on CSV read, just kept to compatibility with the other EDA submodules. + @return `dict()` of the parts designed. The keys are the components references. + ''' + + #TODO this file aims to be a base class file for create all the BOM readers. \ No newline at end of file diff --git a/kicost/edas/eda_altium.py b/kicost/edas/eda_altium.py index 5d5b91478..e8c428d49 100644 --- a/kicost/edas/eda_altium.py +++ b/kicost/edas/eda_altium.py @@ -41,6 +41,12 @@ from .tools import field_name_translations, remove_dnp_parts from .tools import PART_REF_REGEX_NOT_ALLOWED +from .eda import eda_class + +class eda_altium(eda_class): + def __init__(self): + pass + # Add to deal with the fileds of Altium and WEB tools. field_name_translations.update( { diff --git a/kicost/edas/eda_kicad.py b/kicost/edas/eda_kicad.py index fac46699e..7c25be25a 100644 --- a/kicost/edas/eda_kicad.py +++ b/kicost/edas/eda_kicad.py @@ -31,6 +31,13 @@ from .tools import field_name_translations, remove_dnp_parts +from .eda import eda_class + +class eda_altium(eda_class): + def __init__(self): + pass + + __all__ = ['get_part_groups'] from . import eda_dict diff --git a/kicost/edas/generic_csv.py b/kicost/edas/generic_csv.py index 711d2090c..e2807ba26 100644 --- a/kicost/edas/generic_csv.py +++ b/kicost/edas/generic_csv.py @@ -38,6 +38,12 @@ from .tools import field_name_translations, remove_dnp_parts, split_refs from ..distributors.global_vars import distributor_dict +from .eda import eda_class + +class generic_csv(eda_class): + def __init__(self): + pass + # Add to deal with the generic CSV header purchase list. field_name_translations.update( { @@ -93,7 +99,7 @@ def get_part_groups(in_file, ignore_fields, variant): @param ignore_fields `list()` fields do be ignored on the read action. @param variant `str()` in regular expression to match with the design version of the BOM. For now, `variant`is not used on CSV read, just kept to compatibility with the other EDA submodules. - @return `dict()` of the parts designed. The keys are the componentes references. + @return `dict()` of the parts designed. The keys are the components references. ''' ign_fields = [str(f.lower()) for f in ignore_fields] diff --git a/kicost/edas/global_vars.py b/kicost/edas/global_vars.py new file mode 100644 index 000000000..5c984e62d --- /dev/null +++ b/kicost/edas/global_vars.py @@ -0,0 +1,25 @@ +# -*- coding: utf-8 -*- +# MIT license +# +# Copyright (C) 2018 by XESS Corporation / Hildo Guillardi Junior +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to deal +# in the Software without restriction, including without limitation the rights +# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +# copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +# THE SOFTWARE. + +# Heritage of the above global vars. +from ..global_vars import * # Debug information and `SEPRTR`.