try:
    project = launchpadaccess.get_project(launchpad)
except launchpadaccess.launchpad_project_error, e:
    print(e)
    sys.exit(1)
project_url = launchpadaccess.launchpad_url + '/' + project.name
quicklyutils.set_setup_value('url', project_url)
about_dialog_file_name = quicklyutils.get_about_file_name()
if about_dialog_file_name:
    quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                 "name", "website", project_url, {})

# choose right ppa parameter (users, etc.) ppa or staging if ppa_name is None
try:
    (ppa_user, ppa_name, dput_ppa_name,
     ppa_url) = packaging.choose_ppa(launchpad, ppa_name)
except packaging.user_team_not_found, e:
    print(_("User or Team %s not found on Launchpad") % e)
    sys.exit(1)
except packaging.not_ppa_owner, e:
    print(_("You have to be a member of %s team to upload to its ppas") % e)
    sys.exit(1)

try:
    ppa_name = packaging.check_and_return_ppaname(
        launchpad, ppa_user, ppa_name
    )  # ppa_name can be ppa name or ppa display name. Find the right one if exists
except packaging.ppa_not_found, e:
    print(
        _("%s does not exist. Please create it on launchpad if you want to push a package to it. %s has the following ppas available:"
          ) % (e, ppa_user.name))
Example #2
0
# get the project now and save the url into setup.py
try:
    project = launchpadaccess.get_project(launchpad)
except launchpadaccess.launchpad_project_error, e:
    print(e)
    sys.exit(1)
project_url  = launchpadaccess.launchpad_url + '/' + project.name
quicklyutils.set_setup_value('url', project_url)
about_dialog_file_name = quicklyutils.get_about_file_name()
if about_dialog_file_name:
    quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                 "name", "website", project_url, {})

# choose right ppa parameter (users, etc.) ppa or staging if ppa_name is None
try:
    (ppa_user, ppa_name, dput_ppa_name, ppa_url) = packaging.choose_ppa(launchpad, ppa_name)
except packaging.user_team_not_found, e:
    print(_("User or Team %s not found on Launchpad") % e)
    sys.exit(1)
except packaging.not_ppa_owner, e:
    print(_("You have to be a member of %s team to upload to its ppas") % e)
    sys.exit(1)

try:
    ppa_name = packaging.check_and_return_ppaname(launchpad, ppa_user, ppa_name) # ppa_name can be ppa name or ppa display name. Find the right one if exists
except packaging.ppa_not_found, e:
    print(_("%s does not exist. Please create it on launchpad if you want to push a package to it. %s has the following ppas available:") % (e, ppa_user.name))
    user_has_ppa = False
    for ppa_name, ppa_display_name in packaging.get_all_ppas(launchpad, ppa_user):
        print "%s - %s" % (ppa_name, ppa_display_name)
        user_has_ppa = True
Example #3
0
    if len(argv) != 3:
        templatetools.print_usage(options['ppa'])
        print _("\nUse shell completion to find all available PPAs")
        sys.exit(4)

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

    ppa_name = argv[2]
    # choose right ppa parameter (users, etc.) ppa or staging
    try:
        (ppa_user, ppa_name, dput_ppa_name, ppa_url) = packaging.choose_ppa(launchpad, ppa_name)
    except packaging.user_team_not_found, e:
        print(_("User or team %s not found on Launchpad") % e)
        sys.exit(1)
    except packaging.not_ppa_owner, e:
        print(_("You have to be a member of %s team to upload to its PPAs") % e)
        sys.exit(1)

    try:
        ppa_name = packaging.check_and_return_ppaname(launchpad, ppa_user, ppa_name) # ppa_name can be ppa name or ppa display name. Find the right one if exists
    except packaging.ppa_not_found, e:
        print(_("%s does not exist. Please create it on launchpad if you want to upload to it. %s has the following PPAs available:") % (e, ppa_user.name))
        for ppa_name, ppa_display_name in packaging.get_all_ppas(launchpad, ppa_user):
            print "%s - %s" % (ppa_name, ppa_display_name)
        sys.exit(1)