Пример #1
0
    if about_dialog_file_name:
        copyright_holders = ""
        authors_holders = ""
        # get copyright holders and authors
        for line in file(fauthors_name, "r"):
            if "copyright" in line.lower() or "(c)" in line.lower():
                copyright_holders += line.decode("UTF-8")
                authors_holders += line.decode("UTF-8")
            else:
                authors_holders += line.decode("UTF-8")

        # update without last \n
        quicklyutils.change_xml_elem(
            about_dialog_file_name,
            "object/property",
            "name",
            "copyright",
            copyright_holders[:-1],
            {"translatable": "yes"},
        )
        quicklyutils.change_xml_elem(
            about_dialog_file_name, "object/property", "name", "authors", authors_holders[:-1], {}
        )
        quicklyutils.change_xml_elem(
            about_dialog_file_name, "object/property", "name", "license", license_content, {"translatable": "yes"}
        )
    copy_license_to_files(license_content)


def shell_completion(argv):
    """Propose available license as the third parameter"""
Пример #2
0
    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:
    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))
Пример #3
0
    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:
    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
Пример #4
0
def updateversion(proposed_version=None, sharing=False):
    """Update versioning with year.month, handling intermediate release"""

    if proposed_version:
        # check manual versionning is correct
        try:
            for number in proposed_version.split("."):
                float(number)
        except ValueError:
            msg = _("Release version specified in command arguments is not a " "valid version scheme like 'x(.y)(.z)'.")
            raise invalid_versionning_scheme(msg)
        new_version = proposed_version
    else:
        # get previous value
        try:
            old_version = quicklyutils.get_setup_value("version")
        except quicklyutils.cant_deal_with_setup_value:
            msg = _("No previous version found in setup.py. Put one please")
            raise invalid_version_in_setup(msg)

        # sharing only add -publicX to last release, no other update, no bumping
        if sharing:
            splitted_release_version = old_version.split("-public")
            if len(splitted_release_version) > 1:
                try:
                    share_version = float(splitted_release_version[1])
                except ValueError:
                    msg = (
                        _("Share version specified after -public in " "setup.py is not a valid number: %s")
                        % splitted_release_version[1]
                    )
                    raise invalid_versionning_scheme(msg)
                new_version = splitted_release_version[0] + "-public" + str(int(share_version + 1))
            else:
                new_version = old_version + "-public1"

        # automatically version to year.month(.subversion)
        else:
            base_version = datetime.datetime.now().strftime("%y.%m")
            if base_version in old_version:
                try:
                    # try to get a minor version, removing -public if one
                    (year, month, minor_version) = old_version.split(".")
                    minor_version = minor_version.split("-public")[0]
                    try:
                        minor_version = float(minor_version)
                    except ValueError:
                        msg = (
                            _(
                                "Minor version specified in setup.py is not a "
                                "valid number: %s. Fix this or specify a "
                                "version as release command line argument"
                            )
                            % minor_version
                        )
                        raise invalid_versionning_scheme(msg)
                    new_version = base_version + "." + str(int(minor_version + 1))

                except ValueError:
                    # no minor version, bump to first one (be careful,
                    # old_version may contain -publicX)
                    new_version = base_version + ".1"

            else:
                # new year/month
                new_version = base_version

    # write release version to setup.py and update it in aboutdialog
    quicklyutils.set_setup_value("version", new_version)
    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", "version", new_version, {})

    return new_version
Пример #5
0
    about_dialog_file_name = quicklyutils.get_about_file_name()
    if about_dialog_file_name:
        copyright_holders = ""
        authors_holders = ""
        # get copyright holders and authors
        for line in file(fauthors_name, 'r'):
            if "copyright" in line.lower() or "(c)" in line.lower(
            ) or u"©" in line.decode('UTF-8', 'ignore'):
                copyright_holders += line.decode('UTF-8')
                authors_holders += line.decode('UTF-8')
            else:
                authors_holders += line.decode('UTF-8')

        # update without last \n
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "copyright",
                                     copyright_holders[:-1],
                                     {'translatable': 'yes'})
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "authors", authors_holders[:-1],
                                     {})
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "license",
                                     license_content.decode('UTF-8'),
                                     {'translatable': 'yes'})
    copy_license_to_files(license_content)


def shell_completion(argv):
    """Propose available license as the third parameter"""

    # if then license argument given, returns available licenses
Пример #6
0
def updateversion(proposed_version=None, sharing=False):
    '''Update versioning with year.month, handling intermediate release'''

    if proposed_version:
        # check manual versioning is correct
        try:
            for number in proposed_version.split('.'):
                float(number)
        except ValueError:
            msg = _("Release version specified in command arguments is not a " \
                    "valid version scheme like 'x(.y)(.z)'.")
            raise invalid_versionning_scheme(msg)
        new_version = proposed_version
    else:
        # get previous value
        try:
            old_version = quicklyutils.get_setup_value('version')
        except quicklyutils.cant_deal_with_setup_value:
            msg = _("No previous version found in setup.py. Put one please")
            raise invalid_version_in_setup(msg)

        # sharing only add -publicX to last release, no other update, no bumping
        if sharing:
            splitted_release_version = old_version.split("-public")
            if len(splitted_release_version) > 1:
                try:
                    share_version = float(splitted_release_version[1])
                except ValueError:
                    msg = _("Share version specified after -public in "\
                            "setup.py is not a valid number: %s") \
                            % splitted_release_version[1]
                    raise invalid_versionning_scheme(msg)
                new_version = splitted_release_version[0] + '-public' + \
                              str(int(share_version + 1))
            else:
                new_version = old_version + "-public1"

        # automatically version to year.month(.subversion)
        else:
            base_version = datetime.datetime.now().strftime("%y.%m")
            if base_version in old_version:
                try:
                    # try to get a minor version, removing -public if one
                    (year, month, minor_version) = old_version.split('.')
                    minor_version = minor_version.split('-public')[0]
                    try:
                        minor_version = float(minor_version)
                    except ValueError:
                        msg = _("Minor version specified in setup.py is not a " \
                                "valid number: %s. Fix this or specify a " \
                                "version as release command line argument") \
                                % minor_version
                        raise invalid_versionning_scheme(msg)
                    new_version = base_version + '.' + str(int(minor_version + 1))

                except ValueError:
                    # no minor version, bump to first one (be careful,
                    # old_version may contain -publicX)
                    new_version = base_version + '.1'

            else:
                # new year/month
                new_version = base_version

    # write release version to setup.py and update it in aboutdialog
    quicklyutils.set_setup_value('version', new_version)
    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", "version", new_version, {})

    return new_version
Пример #7
0
    # update About dialog, if present:
    about_dialog_file_name = quicklyutils.get_about_file_name()
    if about_dialog_file_name:
        copyright_holders = ""
        authors_holders = ""
        # get copyright holders and authors
        for line in file(fauthors_name, 'r'):
            if "copyright" in line.lower() or "(c)" in line.lower() or u"©" in line.decode('UTF-8', 'ignore'):
                copyright_holders += line.decode('UTF-8')
                authors_holders += line.decode('UTF-8')
            else:
                authors_holders += line.decode('UTF-8')

        # update without last \n
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "copyright", copyright_holders[:-1],
                                     {'translatable': 'yes'})
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "authors", authors_holders[:-1],
                                     {})
        quicklyutils.change_xml_elem(about_dialog_file_name, "object/property",
                                     "name", "license", license_content.decode('UTF-8'),
                                     {'translatable': 'yes'})
    copy_license_to_files(license_content)


def shell_completion(argv):
    """Propose available license as the third parameter"""
    
    # if then license argument given, returns available licenses
    if len(argv) == 1: