[users at bb.net] Sort tags in natural order

Ryan Schmidt buildbot at ryandesign.com
Fri Aug 5 13:57:57 UTC 2016


With buildbot 0.8.12, I notice that when a list of tags is printed, either at the top of the waterfall, or the top of the console page, or when used to group the builders on the console page, the tags are sorted in alphabetical order. I would like them sorted in natural order instead (i.e. "10.9" comes before "10.10").


To fix console.py, I changed this line:

        tags = sorted(builderList.keys())

With this line:

        tags = util.naturalSort(builderList.keys())


In waterfall.py, in this block:

        # get alphabetically sorted list of all tags
        tags = set()
        builderNames = status.getBuilderNames()
        for builderName in builderNames:
            builder = status.getBuilder(builderName)
            tags.update(builder.getTags() or [])
        tags = sorted(tags)
        ctx['tags'] = tags

I tried replacing this line:

        tags = sorted(tags)

With this line:

        tags = util.naturalSort(tags)

And I got this error:

exceptions.TypeError: 'set' object has no attribute '__getitem__'

I guess this is because in the waterfall, tags is a set not a list, but I do not know Python so I don't know how best to fix it.






More information about the users mailing list