~oubiwann/ubuntu-community-accomplishments/946809-module-changes

« back to all changes in this revision

Viewing changes to scripts/ubuntu-community/first-bug-confirmed.py

  • Committer: Jono Bacon
  • Date: 2012-03-02 18:10:20 UTC
  • mfrom: (31.1.1 community)
  • Revision ID: jono@ubuntu.com-20120302181020-hgah0gw12kvczajp
Merging in Bruno's First Bug Confirmed accomplishment. Thanks!

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/python
 
2
 
 
3
import traceback, sys
 
4
import libaccomplishments
 
5
 
 
6
try:
 
7
    import json, sys, os, pwd, subprocess
 
8
    from ubuntuone.couch import auth
 
9
    from launchpadlib.launchpad import Launchpad
 
10
 
 
11
    libaccom = libaccomplishments.Accomplishments()
 
12
 
 
13
    f = libaccom.getExtraInformation("ubuntu-community", "launchpad-email")
 
14
 
 
15
    if bool(f[0]["launchpad-email"]) == False:
 
16
        sys.exit(4)
 
17
    else:
 
18
        email = f[0]["launchpad-email"]
 
19
 
 
20
    # Get count of bugs reported by user from Launchpad, using email to identify
 
21
    l=Launchpad.login_anonymously('ubuntu-community accomplishments','production')
 
22
    me=l.people.getByEmail(email=email)
 
23
 
 
24
    if me == None:
 
25
        sys.exit(1)
 
26
    else:
 
27
        ubuntu=l.projects['ubuntu']
 
28
        bugs_reported = ubuntu.searchTasks(bug_reporter=me, 
 
29
            status=['Confirmed', 'Triaged', 
 
30
            'In Progress', 'Fix Committed', 'Fix Released'])
 
31
 
 
32
        if len(bugs_reported) > 0:
 
33
            sys.exit(0)
 
34
        else:
 
35
            sys.exit(1)
 
36
 
 
37
except SystemExit, e:
 
38
    sys.exit(e.code)
 
39
except:
 
40
    traceback.print_exc()
 
41
    sys.exit(2)
 
42