aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/names.py
blob: 1c54dc2e3146a70d60f51cff1431f2c541b2f8e5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import commands
import os

def uuid():
    return commands.getoutput('uuidgen')

def creator():
    return os.environ["LOGNAME"]

def friendly_name(bugs, ctor):
    last = 0
    for bug in bugs:
        name = bug.name
        if name is None:
            continue
        if name.startswith(ctor):
            num = int(name.split("-")[-1])
            if num > last:
                last = num
    return "%s-%i" % (ctor, last+1)