Beispiel #1
0
def shell_complete_ppa(ppa_to_complete):
    """ Complete from available ppas """

    # connect to LP and get ppa to complete
    try:
        launchpad = launchpadaccess.initialize_lpi(False)
    except launchpadaccess.launchpad_connection_error:
        sys.exit(0)
    available_ppas = []
    if launchpad:
        try:
            (ppa_user, ppa_name) = get_ppa_parameters(launchpad, ppa_to_complete)
        except user_team_not_found:
            pass
        else:
            for current_ppa_name, current_ppa_displayname in get_all_ppas(launchpad, ppa_user):
                # print user/ppa form
                available_ppas.append("%s/%s" % (ppa_user.name, current_ppa_name))
                # if it's the user, print in addition just "ppa_name" syntax
                if ppa_user.name == launchpad.me.name:
                    available_ppas.append(current_ppa_name)
                # if we don't have provided a team, show all teams were we are member off
                if not "/" in ppa_to_complete:
                    team = [
                        mem.team
                        for mem in launchpad.me.memberships_details
                        if mem.status in ("Approved", "Administrator")
                    ]
                    for elem in team:
                        available_ppas.append(elem.name + "/")
        return available_ppas
Beispiel #2
0
def shell_complete_ppa(ppa_to_complete):
    ''' Complete from available ppas '''

    # connect to LP and get ppa to complete
    try:
        launchpad = launchpadaccess.initialize_lpi(False)
    except launchpadaccess.launchpad_connection_error:
        sys.exit(0)
    available_ppas = []
    if launchpad:
        try:
            (ppa_user, ppa_name) = get_ppa_parameters(launchpad, ppa_to_complete)
        except user_team_not_found:
            pass
        else:
            for current_ppa_name, current_ppa_displayname in get_all_ppas(launchpad, ppa_user):
                # print user/ppa form
                available_ppas.append("%s/%s" % (ppa_user.name, current_ppa_name))
                # if it's the user, print in addition just "ppa_name" syntax
                if ppa_user.name == launchpad.me.name:
                    available_ppas.append(current_ppa_name)
                # if we don't have provided a team, show all teams were we are member off
                if not '/' in ppa_to_complete:
                    team = [mem.team for mem in launchpad.me.memberships_details if mem.status in ("Approved", "Administrator")]
                    for elem in team:
                        available_ppas.append(elem.name + '/')
        return available_ppas
Beispiel #3
0
if len(args) == 1:
    proposed_version = None
elif len(args) == 2:
    proposed_version = args[1]
elif len(args) > 2:
    proposed_version = args[1]
    commit_msg = " ".join(args[2:])

# warning: project_name can be different from project.name (one local, one on launchpad)
if not configurationhandler.project_config:
    configurationhandler.loadConfig()
project_name = configurationhandler.project_config['project']

# connect to LP
try:
    launchpad = launchpadaccess.initialize_lpi()
except launchpadaccess.launchpad_connection_error, e:
    print(e)
    sys.exit(1)

# push the gpg key and email to the env
try:
    keyid = quicklyutils.get_right_gpg_key_id(launchpad)
except quicklyutils.gpg_error, e:
    print(e)
    sys.exit(1)

# get the project now and save the url into setup.py
try:
    project = launchpadaccess.get_project(launchpad)
except launchpadaccess.launchpad_project_error, e:
if len(args) == 1:
    proposed_version = None
elif len(args) == 2:
    proposed_version = args[1]
elif len(args) > 2:
    proposed_version = args[1]
    commit_msg = " ".join(args[2:])

# warning: project_name can be different from project.name (one local, one on launchpad)
if not configurationhandler.project_config:
    configurationhandler.loadConfig()
project_name = configurationhandler.project_config['project']

# connect to LP
try:
    launchpad = launchpadaccess.initialize_lpi()
except launchpadaccess.launchpad_connection_error, e:
    print(e)
    sys.exit(1)

# push the gpg key and email to the env
try:
    keyid = quicklyutils.get_right_gpg_key_id(launchpad)
except quicklyutils.gpg_error, e:
    print(e)
    sys.exit(1)

# get the project now and save the url into setup.py
try:
    project = launchpadaccess.get_project(launchpad)
except launchpadaccess.launchpad_project_error, e: