Skip to content

Commit

Permalink
Fixed error caused when trying to find script name when SKiDL is run …
Browse files Browse the repository at this point in the history
…in interactive mode.

* Silenced errors/warnings when loading KiCad part description (.dcm) files.
* Updated docs.
* Bumped version number.
  • Loading branch information
Dave Vandenbout committed Sep 10, 2016
1 parent e118008 commit 829a688
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 26 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.6 (2016-09-10)
______________________

* Fixed error caused when trying to find script name when SKiDL is run in interactive mode.
* Silenced errors/warnings when loading KiCad part description (.dcm) files.


0.0.5 (2016-09-07)
______________________

Expand Down
Binary file modified docs/_build/doctrees/acknowledgements.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/api.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/authors.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/caveats.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/contributing.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/environment.pickle
Binary file not shown.
Binary file modified docs/_build/doctrees/history.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/index.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/installation.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/readme.doctree
Binary file not shown.
Binary file modified docs/_build/doctrees/usage.doctree
Binary file not shown.
44 changes: 26 additions & 18 deletions docs/_build/singlehtml/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>skidl 0.0.5 documentation</title>
<title>skidl 0.0.6 documentation</title>

<link rel="stylesheet" href="_static/classic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />

<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.0.5',
VERSION: '0.0.6',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
Expand All @@ -29,7 +29,7 @@
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html#document-index">skidl 0.0.5 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html#document-index">skidl 0.0.6 documentation</a> &raquo;</li>
</ul>
</div>

Expand Down Expand Up @@ -1651,32 +1651,39 @@ <h2>Acknowledgements<a class="headerlink" href="#acknowledgements" title="Permal
<span id="document-history"></span><div class="section" id="history">
<h2>History<a class="headerlink" href="#history" title="Permalink to this headline"></a></h2>
<div class="section" id="id1">
<h3>0.0.5 (2016-09-07)<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<h3>0.0.6 (2016-09-10)<a class="headerlink" href="#id1" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>Fixed error caused when trying to find script name when SKiDL is run in interactive mode.</li>
<li>Silenced errors/warnings when loading KiCad part description (.dcm) files.</li>
</ul>
</div>
<div class="section" id="id2">
<h3>0.0.5 (2016-09-07)<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>SKiDL now searches for parts with a user-configurable list of library search paths.</li>
<li>Part descriptions and keywords are now loaded from the .dcm file associated with a .lib file.</li>
</ul>
</div>
<div class="section" id="id2">
<h3>0.0.4 (2016-08-27)<a class="headerlink" href="#id2" title="Permalink to this headline"></a></h3>
<div class="section" id="id3">
<h3>0.0.4 (2016-08-27)<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>SKiDL scripts can now output netlists in XML format.</li>
</ul>
</div>
<div class="section" id="id3">
<h3>0.0.3 (2016-08-25)<a class="headerlink" href="#id3" title="Permalink to this headline"></a></h3>
<div class="section" id="id4">
<h3>0.0.3 (2016-08-25)<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>Added command-line utility to convert netlists into SKiDL programs.</li>
</ul>
</div>
<div class="section" id="id4">
<h3>0.0.2 (2016-08-17)<a class="headerlink" href="#id4" title="Permalink to this headline"></a></h3>
<div class="section" id="id5">
<h3>0.0.2 (2016-08-17)<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>Changed the link to the documentation.</li>
</ul>
</div>
<div class="section" id="id5">
<h3>0.0.1 (2016-08-16)<a class="headerlink" href="#id5" title="Permalink to this headline"></a></h3>
<div class="section" id="id6">
<h3>0.0.1 (2016-08-16)<a class="headerlink" href="#id6" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li>First release on PyPI.</li>
</ul>
Expand Down Expand Up @@ -1721,11 +1728,12 @@ <h3><a href="index.html#document-index">Table Of Contents</a></h3>
</li>
<li class="toctree-l1"><a class="reference internal" href="index.html#document-acknowledgements">Acknowledgements</a></li>
<li class="toctree-l1"><a class="reference internal" href="index.html#document-history">History</a><ul>
<li class="toctree-l2"><a class="reference internal" href="index.html#id1">0.0.5 (2016-09-07)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id2">0.0.4 (2016-08-27)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id3">0.0.3 (2016-08-25)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id4">0.0.2 (2016-08-17)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id5">0.0.1 (2016-08-16)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id1">0.0.6 (2016-09-10)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id2">0.0.5 (2016-09-07)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id3">0.0.4 (2016-08-27)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id4">0.0.3 (2016-08-25)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id5">0.0.2 (2016-08-17)</a></li>
<li class="toctree-l2"><a class="reference internal" href="index.html#id6">0.0.1 (2016-08-16)</a></li>
</ul>
</li>
</ul>
Expand All @@ -1737,7 +1745,7 @@ <h3><a href="index.html#document-index">Table Of Contents</a></h3>
<div class="related" role="navigation" aria-label="related navigation">
<h3>Navigation</h3>
<ul>
<li class="nav-item nav-item-0"><a href="index.html#document-index">skidl 0.0.5 documentation</a> &raquo;</li>
<li class="nav-item nav-item-0"><a href="index.html#document-index">skidl 0.0.6 documentation</a> &raquo;</li>
</ul>
</div>
<div class="footer" role="contentinfo">
Expand Down
Binary file modified docs/_build/singlehtml/objects.inv
Binary file not shown.
18 changes: 11 additions & 7 deletions skidl/skidl.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def _scriptinfo():
#---------------------------------------------------------------------------
# scan through call stack for caller information
#---------------------------------------------------------------------------
trc = ''
for teil in inspect.stack():
# skip system calls
if teil[1].startswith("<"):
Expand Down Expand Up @@ -675,7 +676,7 @@ def _load_sch_lib_kicad(self, filename=None, lib_search_paths=None):
part_desc['keywords'] = ' '.join(line.split()[1:])
elif line.startswith('$ENDCMP'):
try:
part = self.get_part_by_name(part_desc['name'])
part = self.get_part_by_name(part_desc['name'], silent=True)
except Exception:
pass
else:
Expand All @@ -699,7 +700,7 @@ def get_parts(self, **criteria):
A single Part or a list of Parts that match all the criteria. """
return _list_or_scalar(_filter(self.parts, **criteria))

def get_part_by_name(self, name, allow_multiples=False):
def get_part_by_name(self, name, allow_multiples=False, silent=False):
"""
Return a Part with the given name or alias from the part list.
Expand All @@ -708,6 +709,7 @@ def get_part_by_name(self, name, allow_multiples=False):
allow_multiples: If true, return a list of parts matching the name.
If false, return only the first matching part and issue
a warning if there were more than one.
silent: If true, don't issue errors or warnings.
Returns:
A single Part or a list of Parts that match all the criteria.
Expand All @@ -722,8 +724,9 @@ def get_part_by_name(self, name, allow_multiples=False):

# No part with that alias either, so signal an error.
if not parts:
logger.error('Unable to find part {} in library {}.'.format(
name, self.filename))
if not silent:
logger.error('Unable to find part {} in library {}.'.format(
name, self.filename))
raise Exception

# Multiple parts with that name or alias exists, so return the list
Expand All @@ -737,9 +740,10 @@ def get_part_by_name(self, name, allow_multiples=False):
# Just return the first part from the list if multiples are not
# allowed and issue a warning.
else:
logger.warning(
'Found multiple parts matching {}. Selecting {}.'.format(
name, parts[0].name))
if not silent:
logger.warning(
'Found multiple parts matching {}. Selecting {}.'.format(
name, parts[0].name))
parts = parts[0]
parts._parse()

Expand Down
2 changes: 1 addition & 1 deletion skidl/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.0.5'
__version__ = '0.0.6'

0 comments on commit 829a688

Please sign in to comment.