• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python common.get_latest_tagged_version函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tito.common.get_latest_tagged_version函数的典型用法代码示例。如果您正苦于以下问题:Python get_latest_tagged_version函数的具体用法?Python get_latest_tagged_version怎么用?Python get_latest_tagged_version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_latest_tagged_version函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_release_tagger_use_version

 def test_release_tagger_use_version(self):
     os.chdir(os.path.join(self.repo_dir, 'pkg2'))
     start_ver = get_latest_tagged_version(TEST_PKG_2)
     tito('tag --debug --accept-auto-changelog --use-version 1.3.37')
     new_ver = get_latest_tagged_version(TEST_PKG_2)
     self.assertFalse(release_bumped(start_ver, new_ver))
     self.assertEquals(new_ver, "1.3.37-1")
开发者ID:awood,项目名称:tito,代码行数:7,代码来源:multiproject_tests.py


示例2: test_release_tagger_legacy_props_file

    def test_release_tagger_legacy_props_file(self):
        # Test that build.py.props filename is still picked up:
        os.chdir(os.path.join(MULTI_GIT, TEST_PKG_2_DIR))
        start_ver = get_latest_tagged_version(TEST_PKG_2)

        run_command("git mv tito.props build.py.props")
        run_command('git commit -a -m "Rename to build.py.props"')

        run_tito('tag --debug --accept-auto-changelog')
        new_ver = get_latest_tagged_version(TEST_PKG_2)
        self.assertTrue(release_bumped(start_ver, new_ver))
开发者ID:jsabo,项目名称:tito,代码行数:11,代码来源:functional-tests.py


示例3: test_release_tagger_legacy_props_file

    def test_release_tagger_legacy_props_file(self):
        # Test that build.py.props filename is still picked up:
        os.chdir(os.path.join(self.repo_dir, 'pkg2'))
        start_ver = get_latest_tagged_version(TEST_PKG_2)
        run_command("git mv tito.props build.py.props")
        index = self.repo.index
        index.add(['pkg2/build.py.props'])
        index.commit("Rename to build.py.props.")

        tito('tag --debug --accept-auto-changelog')
        new_ver = get_latest_tagged_version(TEST_PKG_2)
        self.assertTrue(release_bumped(start_ver, new_ver))
开发者ID:amitsaha,项目名称:tito,代码行数:12,代码来源:multiproject_tests.py


示例4: _get_build_version

    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-"):]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out(["Unable to lookup latest package info.",
                            "Perhaps you need to tag first?"])
                warn_out("unable to lookup latest package "
                    "tag, building untagged test project")
                build_version = get_spec_version_and_release(self.start_dir,
                    find_spec_like_file(self.start_dir))
            self.build_tag = "%s-%s" % (self.project_name, build_version)

        self.spec_version = build_version.split('-')[-2]
        self.spec_release = build_version.split('-')[-1]
        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
开发者ID:maxamillion,项目名称:tito,代码行数:25,代码来源:main.py


示例5: main

    def main(self):
        BaseCliModule.main(self)

        build_dir = os.path.normpath(os.path.abspath(self.options.output_dir))
        package_name = get_project_name(tag=self.options.tag)

        build_tag = None
        build_version = None
        # Determine which package version we should build:
        if self.options.tag:
            build_tag = self.options.tag
            build_version = build_tag[len(package_name + "-"):]
        else:
            build_version = get_latest_tagged_version(package_name)
            if build_version == None:
                error_out(["Unable to lookup latest package info.",
                        "Perhaps you need to tag first?"])
            build_tag = "%s-%s" % (package_name, build_version)

        if not self.options.test:
            check_tag_exists(build_tag, offline=self.options.offline)

        self.pkg_config = self._read_project_config(package_name, build_dir,
                self.options.tag, self.options.no_cleanup)

        builder = self._create_builder(package_name, build_tag,
                build_version, self.options, self.pkg_config,
                build_dir)
        builder.run(self.options)
开发者ID:jsabo,项目名称:tito,代码行数:29,代码来源:cli.py


示例6: test_template_version_tagger

    def test_template_version_tagger(self):
        """
        Make sure the template is applied and results in the correct file
        being included in the tag.
        """
        pkg_dir = join(self.repo_dir, 'pkg3')
        filename = join(pkg_dir, "tito.props")
        self.write_file(filename, TEMPLATE_TAGGER_TITO_PROPS)
        run_command('mkdir -p %s' % join(self.repo_dir, '.tito/templates'))
        self.write_file(join(self.repo_dir,
            '.tito/templates/version.rb'), VERSION_TEMPLATE_FILE)

        os.chdir(self.repo_dir)
        run_command('git add pkg3/tito.props')
        run_command("git commit -m 'add tito.props for pkg3'")

        # Create another pkg3 tag and make sure we got a generated
        # template file.
        os.chdir(os.path.join(self.repo_dir, 'pkg3'))
        tito('tag --debug --accept-auto-changelog')
        new_ver = get_latest_tagged_version(TEST_PKG_3)
        self.assertEquals("0.0.2-1", new_ver)

        dest_file = os.path.join(self.repo_dir, 'pkg3', "version.txt")
        self.assertTrue(os.path.exists(dest_file))

        f = open(dest_file, 'r')
        contents = f.read()
        f.close()

        self.assertTrue("VERSION = \"0.0.2-1\"" in contents)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:31,代码来源:multiproject_tests.py


示例7: _bump_version

    def _bump_version(self, release=False, zstream=False):
        """
        Bump up the package version in the spec file.

        Set release to True to bump the package release instead.

        Checks for the keep version option and if found, won't actually
        bump the version or release.
        """
        old_version = get_latest_tagged_version(self.project_name)
        if old_version == None:
            old_version = "untagged"
        # TODO: Do this here instead of calling out to an external Perl script:
        if not self.keep_version:
            bump_type = "bump-version"
            if release:
                bump_type = "bump-release"
            elif zstream:
                bump_type = "bump-zstream"

            script_path = get_script_path("bump-version.pl")
            cmd = "%s %s --specfile %s" % \
                    (script_path, bump_type, self.spec_file)
            run_command(cmd)

        new_version = self._get_spec_version_and_release()
        if new_version.strip() == "":
            msg = "Error getting bumped package version, try: \n"
            msg = msg + "  'rpm -q --specfile %s'" % self.spec_file
            error_out(msg)
        print("Tagging new version of %s: %s -> %s" % (self.project_name,
            old_version, new_version))
        return new_version
开发者ID:shadowbrain,项目名称:tito,代码行数:33,代码来源:tagger.py


示例8: _bump_version

    def _bump_version(self, release=False, zstream=False):
        """
        Bump up the package version in the spec file.

        Set release to True to bump the package release instead.

        Checks for the keep version option and if found, won't actually
        bump the version or release.
        """
        old_version = get_latest_tagged_version(self.project_name)
        if old_version is None:
            old_version = "untagged"
        if not self.keep_version:
            version_regex = re.compile("^(version:\s*)(.+)$", re.IGNORECASE)
            release_regex = re.compile("^(release:\s*)(.+)$", re.IGNORECASE)

            in_f = open(self.spec_file, 'r')
            out_f = open(self.spec_file + ".new", 'w')

            for line in in_f.readlines():
                version_match = re.match(version_regex, line)
                release_match = re.match(release_regex, line)

                if version_match and not zstream and not release:
                    current_version = version_match.group(2)
                    if hasattr(self, '_use_version'):
                        updated_content = self._use_version
                    else:
                        updated_content = increase_version(current_version)

                    line = "".join([version_match.group(1), updated_content, "\n"])

                elif release_match:
                    current_release = release_match.group(2)
                    if hasattr(self, '_use_release'):
                        updated_content = self._use_release
                    elif release:
                        updated_content = increase_version(current_release)
                    elif zstream:
                        updated_content = increase_zstream(current_release)
                    else:
                        updated_content = reset_release(current_release)

                    line = "".join([release_match.group(1), updated_content, "\n"])

                out_f.write(line)

            in_f.close()
            out_f.close()
            shutil.move(self.spec_file + ".new", self.spec_file)

        new_version = get_spec_version_and_release(self.full_project_dir,
                self.spec_file_name)
        if new_version.strip() == "":
            msg = "Error getting bumped package version, try: \n"
            msg = msg + "  'rpm -q --specfile %s'" % self.spec_file
            error_out(msg)
        info_out("Tagging new version of %s: %s -> %s" % (self.project_name,
            old_version, new_version))
        return new_version
开发者ID:Conan-Kudo,项目名称:tito,代码行数:60,代码来源:main.py


示例9: run

 def run(self, options):
     """
     Tag using the (platform) project as master for the version.
     @param options: tagging options.
     @type options: options
     """
     tag = get_latest_tagged_version(MASTER_PACKAGE)
     options.use_version = tag.split('-', 1)[0]
     PulpTagger.run(self, options)
开发者ID:ehelms,项目名称:pulp,代码行数:9,代码来源:pulptagger.py


示例10: next

def next(project='pulp'):
    """
    Get the next (incremented) version or release.
    @param project: A pulp project name.
    @type project: str
    @return: The version-release
    @rtype: str
    """
    last_version = get_latest_tagged_version(project)
    return increment(last_version)
开发者ID:AndreaGiardini,项目名称:pulp,代码行数:10,代码来源:tools.py


示例11: _get_build_version

    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-"):]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                error_out(["Unable to lookup latest package info.",
                        "Perhaps you need to tag first?"])
            self.build_tag = "%s-%s" % (self.project_name, build_version)

        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
开发者ID:hughdbrown,项目名称:tito,代码行数:18,代码来源:main.py


示例12: _get_build_version

    def _get_build_version(self):
        """
        Figure out the git tag and version-release we're building.
        """
        # Determine which package version we should build:
        build_version = None
        if self.build_tag:
            build_version = self.build_tag[len(self.project_name + "-") :]
        else:
            build_version = get_latest_tagged_version(self.project_name)
            if build_version is None:
                if not self.test:
                    error_out(["Unable to lookup latest package info.", "Perhaps you need to tag first?"])
                sys.stderr.write("WARNING: unable to lookup latest package " "tag, building untagged test project\n")
                build_version = get_spec_version_and_release(self.start_dir, find_spec_file(in_dir=self.start_dir))
            self.build_tag = "v{0}".format(build_version)

        if not self.test:
            check_tag_exists(self.build_tag, offline=self.offline)
        return build_version
开发者ID:RomainVabre,项目名称:origin,代码行数:20,代码来源:__init__.py


示例13: _undo

    def _undo(self):
        """
        Undo the most recent tag.

        Tag commit must be the most recent commit, and the tag must not
        exist in the remote git repo, otherwise we report and error out.
        """
        tag = "v{0}".format(get_latest_tagged_version(self.project_name))
        print("Undoing tag: {0}".format(tag))
        if not tag_exists_locally(tag):
            raise TitoException(
                "Cannot undo tag that does not exist locally.")
        if not self.offline and tag_exists_remotely(tag):
            raise TitoException("Cannot undo tag that has been pushed.")

        # Tag must be the most recent commit.
        if not head_points_to_tag(tag):
            raise TitoException("Cannot undo if tag is not the most recent commit.")

        # Everything looks good:
        print
        undo_tag(tag)
开发者ID:chmouel,项目名称:origin,代码行数:22,代码来源:__init__.py


示例14: test_release_tagger_use_release

 def test_release_tagger_use_release(self):
     os.chdir(os.path.join(self.repo_dir, 'pkg2'))
     tito('tag --debug --accept-auto-changelog --use-release 42')
     new_ver = get_latest_tagged_version(TEST_PKG_2)
     self.assertEquals(new_ver.split('-')[-1], "42")
开发者ID:awood,项目名称:tito,代码行数:5,代码来源:multiproject_tests.py


示例15: test_release_tagger

 def test_release_tagger(self):
     os.chdir(os.path.join(self.repo_dir, 'pkg2'))
     start_ver = get_latest_tagged_version(TEST_PKG_2)
     tito('tag --debug --accept-auto-changelog')
     new_ver = get_latest_tagged_version(TEST_PKG_2)
     self.assertTrue(release_bumped(start_ver, new_ver))
开发者ID:Conan-Kudo,项目名称:tito,代码行数:6,代码来源:multiproject_tests.py


示例16: _make_changelog

    def _make_changelog(self):
        """
        Create a new changelog entry in the changes, with line items from git
        """
        if self._no_auto_changelog:
            debug("Skipping changelog generation.")
            return

        # Attempt to open the file if it exists, but create it if it doesn't
        try:
            in_f = open(self.changes_file, 'r')
        except FileNotFoundError:
            new_in_f = open(self.changes_file, 'w')
            new_in_f.close()
            in_f = open(self.changes_file, 'r')

        out_f = open(self.changes_file + ".new", 'w')

        old_version = get_latest_tagged_version(self.project_name)

        # don't die if this is a new package with no history
        if old_version is not None:
            last_tag = "%s-%s" % (self.project_name, old_version)
            output = self._generate_default_changelog(last_tag)
        else:
            output = self._new_changelog_msg

        fd, name = tempfile.mkstemp()
        write(fd, "# Create your changelog entry below:\n")
        header = "-------------------------------------------------------------------\n"
        if self.git_email is None or (('HIDE_EMAIL' in self.user_config) and
                (self.user_config['HIDE_EMAIL'] not in ['0', ''])):
            header = header + "%s - %s\n\n" % (self.today, self.git_user)
        else:
            header = header + "%s - %s <%s>\n\n" % (self.today, self.git_user,
                                                        self.git_email)

        write(fd, header)

        for cmd_out in output.split("\n"):
            write(fd, "- ")
            write(fd, "\n  ".join(textwrap.wrap(cmd_out, 77)))
            write(fd, "\n")

        write(fd, "\n")

        if not self._accept_auto_changelog:
            write(fd, "###################################################\n")
            write(fd, "# These are the already existing changelog entries:\n")
            write(fd, "###################################################\n")
            for line in in_f.readlines():
                write(fd, "#" + line)
            in_f.seek(0, 0)

            # Give the user a chance to edit the generated changelog:
            editor = 'vi'
            if "EDITOR" in os.environ:
                editor = os.environ["EDITOR"]
            subprocess.call([editor, name])

        os.lseek(fd, 0, 0)
        file = os.fdopen(fd)

        for line in file.readlines():
            if not line.startswith("#"):
                out_f.write(line)

        output = file.read()

        file.close()
        os.unlink(name)

        for line in in_f.readlines():
            out_f.write(line)

        in_f.close()
        out_f.close()

        shutil.move(self.changes_file + ".new", self.changes_file)
开发者ID:awood,项目名称:tito,代码行数:79,代码来源:susetagger.py


示例17: _make_changelog

    def _make_changelog(self):
        """
        Create a new changelog entry in the spec, with line items from git
        """
        if self._no_auto_changelog:
            debug("Skipping changelog generation.")

        in_f = open(self.spec_file, 'r')
        out_f = open(self.spec_file + ".new", 'w')

        found_changelog = False
        for line in in_f.readlines():
            out_f.write(line)

            if not found_changelog and line.startswith("%changelog"):
                found_changelog = True

                old_version = get_latest_tagged_version(self.project_name)

                # don't die if this is a new package with no history
                if old_version != None:
                    last_tag = "%s-%s" % (self.project_name, old_version)
                    patch_command = \
                            "git log --pretty=format:%%s\ \(%%ae\)" \
                            " --relative %s..%s -- %s" % \
                            (last_tag, "HEAD", ".")
                    output = run_command(patch_command)
                else:
                    output = self._new_changelog_msg

                fd, name = tempfile.mkstemp()
                os.write(fd, "# Create your changelog entry below:\n")
                header = "* %s %s <%s>\n" % (self.today, self.git_user,
                        self.git_email)

                os.write(fd, header)

                for cmd_out in output.split("\n"):
                    os.write(fd, "- ")
                    os.write(fd, "\n  ".join(textwrap.wrap(cmd_out, 77)))
                    os.write(fd, "\n")

                os.write(fd, "\n")

                if not self._accept_auto_changelog:
                    # Give the user a chance to edit the generated changelog:
                    editor = 'vi'
                    if "EDITOR" in os.environ:
                        editor = os.environ["EDITOR"]
                    subprocess.call([editor, name])

                os.lseek(fd, 0, 0)
                file = os.fdopen(fd)

                for line in file.readlines():
                    if not line.startswith("#"):
                        out_f.write(line)

                output = file.read()

                file.close()
                os.unlink(name)

        in_f.close()
        out_f.close()

        shutil.move(self.spec_file + ".new", self.spec_file)
开发者ID:jsabo,项目名称:tito,代码行数:67,代码来源:tagger.py


示例18: _make_changelog

    def _make_changelog(self):
        """
        Create a new changelog entry in the spec, with line items from git
        """
        if self._no_auto_changelog:
            debug("Skipping changelog generation.")
            return

        in_f = open(self.spec_file, 'r')
        out_f = open(self.spec_file + ".new", 'w')

        found_changelog = False
        for line in in_f.readlines():
            out_f.write(line)

            if not found_changelog and line.startswith("%changelog"):
                found_changelog = True

                old_version = get_latest_tagged_version(self.project_name)

                # don't die if this is a new package with no history
                if old_version != None:
                    last_tag = "%s-%s" % (self.project_name, old_version)
                    output = self._generate_default_changelog(last_tag)
                else:
                    output = self._new_changelog_msg

                fd, name = tempfile.mkstemp()
                os.write(fd, "# Create your changelog entry below:\n")
                if self.git_email is None or (('HIDE_EMAIL' in self.user_config) and \
                        (self.user_config['HIDE_EMAIL'] not in ['0', ''])):
                    header = "* %s %s\n" % (self.today, self.git_user)
                else:
                    header = "* %s %s <%s>\n" % (self.today, self.git_user,
                       self.git_email)

                os.write(fd, header)

                for cmd_out in output.split("\n"):
                    os.write(fd, "- ")
                    os.write(fd, "\n  ".join(textwrap.wrap(cmd_out, 77)))
                    os.write(fd, "\n")

                os.write(fd, "\n")

                if not self._accept_auto_changelog:
                    # Give the user a chance to edit the generated changelog:
                    editor = 'vi'
                    if "EDITOR" in os.environ:
                        editor = os.environ["EDITOR"]
                    subprocess.call(editor.split() + [name])

                os.lseek(fd, 0, 0)
                file = os.fdopen(fd)

                for line in file.readlines():
                    if not line.startswith("#"):
                        out_f.write(line)

                output = file.read()

                file.close()
                os.unlink(name)

        in_f.close()
        out_f.close()

        shutil.move(self.spec_file + ".new", self.spec_file)
开发者ID:aronparsons,项目名称:tito,代码行数:68,代码来源:tagger.py


示例19: _bump_version

    def _bump_version(self, release=False, zstream=False, force=False):
        """
        Bump up the package version in the spec file.

        Set release to True to bump the package release instead.

        Checks for the keep version option and if found, won't actually
        bump the version or release.
        """
        old_version = get_latest_tagged_version(self.project_name)
        if old_version == None:
            old_version = "untagged"
        if not self.keep_version:
            version_regex = re.compile("^(version:\s*)(.+)$", re.IGNORECASE)
            release_regex = re.compile("^(release:\s*)(.+)$", re.IGNORECASE)

            in_f = open(self.spec_file, 'r')
            out_f = open(self.spec_file + ".new", 'w')

            for line in in_f.readlines():
                if release:
                    match = re.match(release_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        increase_version(match.group(2)),
                                        "\n"
                        ))
                elif zstream:
                    match = re.match(release_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        increase_zstream(match.group(2)),
                                        "\n"
                        ))
                elif force:
                    match = re.match(version_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        self._use_version,
                                        "\n"
                        ))

                    match = re.match(release_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        reset_release(match.group(2)),
                                        "\n"
                        ))
                else:
                    match = re.match(version_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        increase_version(match.group(2)),
                                        "\n"
                        ))

                    match = re.match(release_regex, line)
                    if match:
                        line = "".join((match.group(1),
                                        reset_release(match.group(2)),
                                        "\n"
                        ))

                out_f.write(line)

            in_f.close()
            out_f.close()
            shutil.move(self.spec_file + ".new", self.spec_file)

        new_version = self._get_spec_version_and_release()
        if new_version.strip() == "":
            msg = "Error getting bumped package version, try: \n"
            msg = msg + "  'rpm -q --specfile %s'" % self.spec_file
            error_out(msg)
        print("Tagging new version of %s: %s -> %s" % (self.project_name,
            old_version, new_version))
        return new_version
开发者ID:aronparsons,项目名称:tito,代码行数:77,代码来源:tagger.py


示例20: test_release_tagger

 def test_release_tagger(self):
     os.chdir(os.path.join(MULTI_GIT, TEST_PKG_2_DIR))
     start_ver = get_latest_tagged_version(TEST_PKG_2)
     run_tito('tag --debug --accept-auto-changelog')
     new_ver = get_latest_tagged_version(TEST_PKG_2)
     self.assertTrue(release_bumped(start_ver, new_ver))
开发者ID:jsabo,项目名称:tito,代码行数:6,代码来源:functional-tests.py



注:本文中的tito.common.get_latest_tagged_version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python common.info_out函数代码示例发布时间:2022-05-27
下一篇:
Python common.find_git_root函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap