aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2017-07-10 17:24:01 +0200
committerMatěj Cepl <mcepl@cepl.eu>2017-07-10 17:26:20 +0200
commit38511212bffa8e4dc0bed9c8fd0086ade5197144 (patch)
tree90d5b3f42c549522886d51dd0e7933d0e18cdeb3
parent4545077c547825f2ab5a4704f826e3537baa1fb7 (diff)
downloadcucutags-38511212bffa8e4dc0bed9c8fd0086ade5197144.tar.gz
Generated tags should be sorted and deduplicated.0.7.4
-rwxr-xr-xcucutags.py7
-rw-r--r--setup.py2
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',