예제 #1
0
# 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:
    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)
예제 #2
0
                for line_input in fin:            
                    fields = line_input.split(' = ') # Separate variable from value
                    if fields[0] == '__license__':
                        line_input = "%s = '%s'\n" % (fields[0], license)
                    fout.write(line_input)
                fout.flush()
                fout.close()
                fin.close()
                os.rename(fout.name, fin.name)
                if license in supported_licenses_list:
                    src_license_file = "/usr/share/common-licenses/" + license
                    if os.path.isfile(src_license_file):
                        shutil.copy("/usr/share/common-licenses/" + license, flicense_name)
                break
        try:
            quicklyutils.set_setup_value('license', license)
        except quicklyutils.cant_deal_with_setup_value:
            msg = _("Can't update license in setup.py file\n")
            raise LicenceError(msg)
    except (OSError, IOError), e:
        msg = _("%s file not found.") % (config_file)
        raise LicenceError(msg)

    # 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(): 
예제 #3
0
                for line_input in fin:
                    fields = line_input.split(" = ")  # Separate variable from value
                    if fields[0] == "__license__":
                        line_input = "%s = '%s'\n" % (fields[0], license)
                    fout.write(line_input)
                fout.flush()
                fout.close()
                fin.close()
                os.rename(fout.name, fin.name)
                if license in supported_licenses_list:
                    src_license_file = "/usr/share/common-licenses/" + license
                    if os.path.isfile(src_license_file):
                        shutil.copy("/usr/share/common-licenses/" + license, flicense_name)
                break
        try:
            quicklyutils.set_setup_value("license", license)
        except quicklyutils.cant_deal_with_setup_value:
            msg = _("Can't update license in setup.py file\n")
            raise LicenceError(msg)
    except (OSError, IOError), e:
        msg = _("%s file not found.") % (config_file)
        raise LicenceError(msg)

    # 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():
예제 #4
0
# 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:
    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)
예제 #5
0
파일: packaging.py 프로젝트: GhostBSD/apace
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
예제 #6
0
''')
            fout.write(line)
        fout.flush()
        fout.close()
        fin.close()
        if not license_found_in_file or not data_file_function_found:
            os.rename(fout.name, fin.name)
        else:
            os.remove(fout.name)
    except (OSError, IOError), e:
        pass
    ## new ~public becomes -public
    try:
        version = quicklyutils.get_setup_value('version')
        if "~public" in version:
            quicklyutils.set_setup_value('version', version.replace("~public", "-public"))
    except quicklyutils.cant_deal_with_setup_value:
        pass

    # add apport hooks if launchpad application is configured
    internal.apportutils.insert_lpi_if_required(project_name)
    lp_project_name = configurationhandler.project_config.get('lp_id', None)
    if lp_project_name is not None:
        internal.apportutils.update_apport(project_name, lp_project_name, lp_project_name)

    # new dialog file needs helpers.py
    if not os.path.isfile('%s/helpers.py' % python_name) and os.path.isdir(python_name):
        source_dir = os.path.join(os.path.dirname(__file__), 'project_root',
                                  'python')
        templatetools.file_from_template(source_dir, 
                                        "helpers.py", 
예제 #7
0
                        ' = ')  # Separate variable from value
                    if fields[0] == '__license__':
                        line_input = "%s = '%s'\n" % (fields[0], license)
                    fout.write(line_input)
                fout.flush()
                fout.close()
                fin.close()
                os.rename(fout.name, fin.name)
                if license in supported_licenses_list:
                    src_license_file = "/usr/share/common-licenses/" + license
                    if os.path.isfile(src_license_file):
                        shutil.copy("/usr/share/common-licenses/" + license,
                                    flicense_name)
                break
        try:
            quicklyutils.set_setup_value('license', license)
        except quicklyutils.cant_deal_with_setup_value:
            msg = _("Can't update license in setup.py file\n")
            raise LicenceError(msg)
    except (OSError, IOError), e:
        msg = _("%s file not found.") % (config_file)
        raise LicenceError(msg)

    # 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(
예제 #8
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