Skip to content

Commit

Permalink
Fixed issue #12.
Browse files Browse the repository at this point in the history
* Bumped version.
  • Loading branch information
Dave Vandenbout committed Feb 17, 2017
1 parent 17c9a58 commit 561f4b7
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 533 deletions.
7 changes: 7 additions & 0 deletions HISTORY.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ History
-------


0.0.9 (2017-02-16)
______________________

* Use getattr() instead of __class__.__dict__ so that subclasses of SKiDL objects
can find attributes named within strings without searching the __mor__.


0.0.8 (2017-01-11)
______________________

Expand Down
177 changes: 0 additions & 177 deletions skidl/netlist_to_skidl.py~

This file was deleted.

2 changes: 1 addition & 1 deletion skidl/pckg_info.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = '0.0.8'
__version__ = '0.0.9'
__author__ = 'XESS Corp.'
__email__ = '[email protected]'
41 changes: 18 additions & 23 deletions skidl/skidl.py
Original file line number Diff line number Diff line change
Expand Up @@ -588,14 +588,13 @@ def __init__(self, filename=None, tool=KICAD, **attribs):
else:
try:
# Use the tool name to find the function for loading the library.
func_name = '_load_sch_lib_{}'.format(tool)
load_func = self.__class__.__dict__[func_name]
load_func = getattr(self, '_load_sch_lib_{}'.format(tool))
search_paths_name = 'lib_search_paths_{}'.format(tool)
lib_search_paths = THIS_MODULE[search_paths_name]
load_func(self, filename, lib_search_paths)
load_func(filename, lib_search_paths)
# Cache a reference to the library.
self._cache[filename] = self
except KeyError:
except AttributeError:
# OK, that didn't work so well...
logger.error('Unsupported ECAD tool library: {}'.format(tool))
raise Exception
Expand Down Expand Up @@ -1224,9 +1223,9 @@ def _parse(self, just_get_name=False):
"""

try:
parse_func = self.__class__.__dict__['_parse_{}'.format(self.tool)]
parse_func(self, just_get_name)
except KeyError:
parse_func = getattr(self, '_parse_{}'.format(self.tool))
parse_func(just_get_name)
except AttributeError:
logger.error(
"Can't create a part with an unknown ECAD tool file format: {}.".format(
self.tool))
Expand Down Expand Up @@ -1752,10 +1751,9 @@ def _generate_netlist_component(self, tool=KICAD):
"""

try:
gen_func = self.__class__.__dict__['_gen_netlist_comp_{}'.format(
tool)]
return gen_func(self)
except KeyError:
gen_func = getattr(self, '_gen_netlist_comp_{}'.format(tool))
return gen_func()
except AttributeError:
logger.error(
"Can't generate netlist in an unknown ECAD tool format ({}).".format(
format))
Expand Down Expand Up @@ -1812,10 +1810,9 @@ def _generate_xml_component(self, tool=KICAD):
"""

try:
gen_func = self.__class__.__dict__['_gen_xml_comp_{}'.format(
tool)]
return gen_func(self)
except KeyError:
gen_func = getattr(self, '_gen_xml_comp_{}'.format(tool))
return gen_func()
except AttributeError:
logger.error(
"Can't generate XML in an unknown ECAD tool format ({}).".format(
format))
Expand Down Expand Up @@ -2320,10 +2317,9 @@ def _generate_netlist_net(self, tool=KICAD):
self.test_validity()

try:
gen_func = self.__class__.__dict__['_gen_netlist_net_{}'.format(
tool)]
return gen_func(self)
except KeyError:
gen_func = getattr(self, '_gen_netlist_net_{}'.format(tool))
return gen_func()
except AttributeError:
logger.error(
"Can't generate netlist in an unknown ECAD tool format ({}).".format(
format))
Expand All @@ -2350,10 +2346,9 @@ def _generate_xml_net(self, tool=KICAD):
self.test_validity()

try:
gen_func = self.__class__.__dict__['_gen_xml_net_{}'.format(
tool)]
return gen_func(self)
except KeyError:
gen_func = getattr(self, '_gen_xml_net_{}'.format(tool))
return gen_func()
except AttributeError:
logger.error(
"Can't generate XML in an unknown ECAD tool format ({}).".format(
format))
Expand Down
Loading

0 comments on commit 561f4b7

Please sign in to comment.