From 38511212bffa8e4dc0bed9c8fd0086ade5197144 Mon Sep 17 00:00:00 2001 From: Matěj Cepl Date: Mon, 10 Jul 2017 17:24:01 +0200 Subject: Generated tags should be sorted and deduplicated. --- cucutags.py | 7 ++++++- setup.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/cucutags.py b/cucutags.py index 9e19f4a..28bce1a 100755 --- a/cucutags.py +++ b/cucutags.py @@ -21,6 +21,7 @@ # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. import io +import itertools import logging import os import os.path @@ -84,6 +85,9 @@ class Feature(object): def __str__(self): return self.__unicode__().encode("utf-8") + def __cmp__(self, other): + return cmp(self.text, other.text) + def match(self, targlist): """ Returns the first Target matching the current Feature line. @@ -170,7 +174,8 @@ class Session(object): logging.debug("trg.filename = %s", rel_filename) logging.debug("trg.lineno = %s", trg.lineno) out.append((feat, rel_filename, trg.lineno,)) - + out = sorted(out) + out = [x for x, _ in itertools.groupby(out)] return out def get_step(self, feature): diff --git a/setup.py b/setup.py index 9b20ed5..cc1cdf0 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ def read(fname): setup( name='cucutags', py_modules=['cucutags'], - version="0.7.3", + version="0.7.4", description='Generates ctags for BDD .feature/behave steps', author=u'Matěj Cepl', author_email='mcepl@redhat.com', -- cgit