Skip to content

Commit 210adc7

Browse files
committed
Invalid includes will no longer throw errors. Added some debug functionality. Bumped version.
1 parent 9050304 commit 210adc7

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

CHANGELOG.adoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
= Verace Changelog
22

3+
== verace-0.3.1 (2018-01-12)
4+
=== Release highlights
5+
- Convenience updates.
6+
7+
=== All additions and changes
8+
- Invalid `VerChecker.include()` results will no longer produce errors.
9+
- Added `debug` property to `VerChecker`.
10+
11+
=== Bug fixes
12+
Not applicable.
13+
314
== verace-0.3.0 (2017-02-16)
415
=== Release highlights
516
- Added convenience function.

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Get the string found by the checker:
4949
[source,python]
5050
--------
5151
print("version found = " + mychk.string())
52-
# version found = 0.3.0
52+
# version found = 0.3.1
5353
--------
5454

5555
The string can be updated in all associated files:

lib/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
setup(
55
name = "verace",
6-
version = "0.3.0",
6+
version = "0.3.1",
77
author = "Jeff Rimko",
88
author_email = "jeffrimko@gmail.com",
99
description = "Library for checking version strings in project files.",

lib/verace.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from __future__ import print_function
1212

1313
import copy
14+
import inspect
1415
import os
1516
import os.path as op
1617
from collections import namedtuple
@@ -20,7 +21,7 @@
2021
##==============================================================#
2122

2223
#: Library version string.
23-
__version__ = "0.3.0"
24+
__version__ = "0.3.1"
2425

2526
#: Contains information for a single checked item.
2627
VerInfo = namedtuple("VerInfo", "path linenum string")
@@ -47,6 +48,7 @@ def __init__(self, name, root):
4748
self._vinfos = []
4849
self._string = None
4950
self._checks = []
51+
self.debug = False
5052
def string(self):
5153
"""Returns the string if `run()` found no inconsistencies,
5254
otherwise None is returned. Always calls `run()`."""
@@ -73,16 +75,19 @@ def include(self, path, func=None, opts=None, updatable=True, **kwargs):
7375
def iter_vinfo(self, get_updatable=False):
7476
"""Iterates over the associated VerInfo objects. Optionally returns if
7577
the associated file is updatable."""
78+
dprint = get_vprint(self.debug)
7679
for c in self._checks:
7780
path = c.path
7881
if not op.isabs(path):
7982
path = op.join(self.root, path)
8083
path = op.normpath(path)
8184
vinfos = c.func(path, **c.opts)
85+
dprint((inspect.stack()[0][3], c, vinfos))
8286
if list != type(vinfos):
8387
vinfos = [vinfos]
8488
for vi in vinfos:
85-
yield (vi, c.updatable) if get_updatable else vi
89+
if vi:
90+
yield (vi, c.updatable) if get_updatable else vi
8691
def run(self, verbose=True):
8792
"""Runs checks on all included items, reports any inconsistencies.
8893
Returns string if consistent else None."""

0 commit comments

Comments
 (0)