当前位置: 首页>>代码示例>>Python>>正文


Python common.warn_out函数代码示例

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


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

示例1: load_config

    def load_config(self, package_name, build_dir, tag):
        self.config = ConfigLoader(package_name, build_dir, tag).load()

        if self.config.has_option(BUILDCONFIG_SECTION,
                "offline"):
            self.options.offline = True

        # TODO: Not ideal:
        if self.options.debug:
            os.environ['DEBUG'] = "true"

        # Check if config defines a custom lib dir, if so we add it
        # to the python path allowing users to specify custom builders/taggers
        # in their config:
        if self.config.has_option(BUILDCONFIG_SECTION,
                "lib_dir"):
            lib_dir = self.config.get(BUILDCONFIG_SECTION,
                    "lib_dir")
            if lib_dir[0] != '/':
                # Looks like a relative path, assume from the git root:
                lib_dir = os.path.join(find_git_root(), lib_dir)

            if os.path.exists(lib_dir):
                sys.path.append(lib_dir)
                debug("Added lib dir to PYTHONPATH: %s" % lib_dir)
            else:
                warn_out("lib_dir specified but does not exist: %s" % lib_dir)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:27,代码来源:cli.py

示例2: _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

示例3: run

    def run(self, options):
        """
        Perform the actions requested of the tagger.

        NOTE: this method may do nothing if the user requested no build actions
        be performed. (i.e. only release tagging, etc)
        """
        if options.tag_release:
            warn_out("--tag-release option no longer necessary,"
                " 'tito tag' will accomplish the same thing.")
        if options.no_auto_changelog:
            self._no_auto_changelog = True
        if options.accept_auto_changelog:
            self._accept_auto_changelog = True
        if options.auto_changelog_msg:
            self._new_changelog_msg = options.auto_changelog_msg
        if options.use_version:
            self._use_version = options.use_version
        if options.changelog:
            self._changelog = options.changelog

        self.check_tag_precondition()

        # Only two paths through the tagger module right now:
        if options.undo:
            self._undo()
        else:
            self._tag_release()
开发者ID:FrostyX,项目名称:tito,代码行数:28,代码来源:main.py

示例4: _clear_package_metadata

    def _clear_package_metadata(self):
        """
        Remove all .tito/packages/ files that have a relative path
        matching the package we're tagging a new version of. Normally
        this just removes the previous package file but if we were
        renaming oldpackage to newpackage, this would git rm
        .tito/packages/oldpackage and add
        .tito/packages/spacewalk-newpackage.
        """
        metadata_dir = os.path.join(self.rel_eng_dir, "packages")
        for filename in os.listdir(metadata_dir):
            metadata_file = os.path.join(metadata_dir, filename)  # full path

            if os.path.isdir(metadata_file) or filename.startswith("."):
                continue

            temp_file = open(metadata_file, 'r')
            (version, relative_dir) = temp_file.readline().split(" ")
            relative_dir = relative_dir.strip()  # sometimes has a newline

            if relative_dir == self.relative_project_dir:
                debug("Found metadata for our prefix: %s" %
                        metadata_file)
                debug("   version: %s" % version)
                debug("   dir: %s" % relative_dir)
                if filename == self.project_name:
                    debug("Updating %s with new version." %
                            metadata_file)
                else:
                    warn_out("%s also references %s" % (filename, self.relative_project_dir))
                    print("Assuming package has been renamed and removing it.")
                    run_command("git rm %s" % metadata_file)
开发者ID:FrostyX,项目名称:tito,代码行数:32,代码来源:main.py

示例5: _build

    def _build(self, branch):
        """ Submit a Fedora build from current directory. """
        target_param = ""
        scratch_param = ""
        build_target = self._get_build_target_for_branch(branch)
        if build_target:
            target_param = "--target %s" % build_target
        if self.scratch:
            scratch_param = "--scratch"

        build_cmd = "%s build --nowait %s %s" % (self.cli_tool, scratch_param, target_param)

        if self.dry_run:
            self.print_dry_run_warning(build_cmd)
            return

        info_out("Submitting build: %s" % build_cmd)
        (status, output) = getstatusoutput(build_cmd)
        if status > 0:
            if "already been built" in output:
                warn_out("Build has been submitted previously, continuing...")
            else:
                error_out([
                    "Unable to submit build."
                    "  Status code: %s\n" % status,
                    "  Output: %s\n" % output,
                ])

        # Print the task ID and URL:
        for line in extract_task_info(output):
            print(line)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:31,代码来源:distgit.py

示例6: cleanup

    def cleanup(self):
        if not self.no_cleanup:
            debug("Cleaning up [%s]" % self.working_dir)
            run_command("rm -rf %s" % self.working_dir)

            if self.builder:
                self.builder.cleanup()
        else:
            warn_out("leaving %s (--no-cleanup)" % self.working_dir)
开发者ID:awood,项目名称:tito,代码行数:9,代码来源:main.py

示例7: cleanup

 def cleanup(self):
     """
     Remove all temporary files and directories.
     """
     if not self.no_cleanup:
         debug("Cleaning up %s" % self.rpmbuild_dir)
         shutil.rmtree(self.rpmbuild_dir)
     else:
         warn_out("Leaving rpmbuild files in: %s" % self.rpmbuild_dir)
开发者ID:maxamillion,项目名称:tito,代码行数:9,代码来源:main.py

示例8: _get_git_user_info

 def _get_git_user_info(self):
     """ Return the user.name and user.email git config values. """
     try:
         name = run_command('git config --get user.name')
     except:
         warn_out('user.name in ~/.gitconfig not set.\n')
         name = 'Unknown name'
     try:
         email = run_command('git config --get user.email')
     except:
         warn_out('user.email in ~/.gitconfig not set.\n')
         email = None
     return (name, email)
开发者ID:FrostyX,项目名称:tito,代码行数:13,代码来源:main.py

示例9: _legacy_builder_hack

 def _legacy_builder_hack(self, releaser_config):
     """
     Support the old style koji builds when config is still in global
     tito.props, as opposed to the new releasers.conf.
     """
     # Handle koji:
     if self.config.has_section("koji") and not \
             releaser_config.has_section("koji"):
         warn_out("legacy 'koji' section in tito.props, please "
                 "consider creating a target in releasers.conf.")
         print("Simulating 'koji' release target for now.")
         releaser_config.add_section('koji')
         releaser_config.set('koji', 'releaser', 'tito.release.KojiReleaser')
         releaser_config.set('koji', 'autobuild_tags',
                 self.config.get('koji', 'autobuild_tags'))
开发者ID:Conan-Kudo,项目名称:tito,代码行数:15,代码来源:cli.py

示例10: __init__

    def __init__(self, name=None, tag=None, build_dir=None,
            config=None, user_config=None,
            target=None, releaser_config=None, no_cleanup=False,
            test=False, auto_accept=False,
            prefix="temp_dir=", **kwargs):
        Releaser.__init__(self, name, tag, build_dir, config,
                user_config, target, releaser_config, no_cleanup, test,
                auto_accept, **kwargs)

        self.build_dir = build_dir
        self.prefix = prefix

        if self.releaser_config.has_option(self.target, "scl"):
            warn_out("please rename 'scl' to 'builder.scl' in releasers.conf")
            self.builder.scl = self.releaser_config.get(self.target, "scl")
开发者ID:awood,项目名称:tito,代码行数:15,代码来源:main.py

示例11: rsync_to_remote

 def rsync_to_remote(self, rsync_args, temp_dir, rsync_location):
     print("rsync %s --delete %s/ %s" % (rsync_args, temp_dir, rsync_location))
     os.chdir(temp_dir)
     # TODO: configurable rsync options?
     cmd = "rsync %s --delete %s/ %s" % (rsync_args, temp_dir, rsync_location)
     if self.dry_run:
         self.print_dry_run_warning(cmd)
     else:
         output = run_command(cmd)
         debug(output)
     if not self.no_cleanup:
         debug("Cleaning up [%s]" % temp_dir)
         os.chdir("/")
         shutil.rmtree(temp_dir)
     else:
         warn_out("leaving %s (--no-cleanup)" % temp_dir)
开发者ID:awood,项目名称:tito,代码行数:16,代码来源:main.py

示例12: _merge

 def _merge(self, main_branch):
     try:
         run_command("git merge %s" % main_branch)
     except:
         print
         warn_out("Conflicts occurred during merge.")
         print
         print("You are being dropped to a shell in the working directory.")
         print
         print("Please resolve this by doing the following:")
         print
         print("  1. List the conflicting files: git ls-files --unmerged")
         print("  2. Edit each resolving the conflict and then: git add FILENAME")
         print("  4. Commit the result when you are done: git commit")
         print("  4. Return to the tito release: exit")
         print
         # TODO: maybe prompt y/n here
         os.system(os.environ['SHELL'])
开发者ID:Conan-Kudo,项目名称:tito,代码行数:18,代码来源:distgit.py

示例13: __init__

    def __init__(self, name=None, tag=None, build_dir=None,
        config=None, user_config=None,
        target=None, releaser_config=None, no_cleanup=False,
        test=False, auto_accept=False,
        prefix="temp_dir=", **kwargs):

        if 'builder_args' in kwargs:
            kwargs['builder_args']['local'] = False

        DistGitReleaser.__init__(self, name, tag, build_dir, config,
                user_config, target, releaser_config, no_cleanup, test,
                auto_accept, **kwargs)

        self.mead_scm = self.releaser_config.get(self.target, "mead_scm")

        if self.releaser_config.has_option(self.target, "mead_push_url"):
            self.push_url = self.releaser_config.get(self.target, "mead_push_url")
        else:
            self.push_url = self.mead_scm

        # rhpkg maven-build takes an optional override --target:
        self.brew_target = None
        if self.releaser_config.has_option(self.target, "target"):
            self.brew_target = self.releaser_config.get(self.target, "target")

        # If the push URL contains MEAD_SCM_URL, we require the user to set this
        # in ~/.titorc before they can run this releaser. This allows us to
        # use push URLs that require username auth, but still check a generic
        # URL into source control:
        if MEAD_SCM_USERNAME in self.push_url:
            debug("Push URL contains %s, checking for value in ~/.titorc" %
                MEAD_SCM_USERNAME)
            if MEAD_SCM_USERNAME in user_config:
                user = user_config[MEAD_SCM_USERNAME]
            else:
                user = getpass.getuser()
                warn_out("You should specify MEAD_SCM_USERNAME in '~/.titorc'.  Using %s for now" % user)

            self.push_url = self.push_url.replace(MEAD_SCM_USERNAME, user)
开发者ID:Conan-Kudo,项目名称:tito,代码行数:39,代码来源:distgit.py

示例14: _check_legacy_globalconfig

 def _check_legacy_globalconfig(self, config):
     # globalconfig renamed to buildconfig for better overriding in per-package
     # tito.props. If we see globalconfig, automatically rename it after
     # loading and warn the user.
     if config.has_section('globalconfig'):
         if not config.has_section('buildconfig'):
             config.add_section('buildconfig')
         warn_out("Please rename [globalconfig] to [buildconfig] in "
             "tito.props")
         for k, v in config.items('globalconfig'):
             if k == 'default_builder':
                 warn_out("please rename 'default_builder' to "
                     "'builder' in tito.props")
                 config.set('buildconfig', 'builder', v)
             elif k == 'default_tagger':
                 warn_out("please rename 'default_tagger' to "
                     "'tagger' in tito.props")
                 config.set('buildconfig', 'tagger', v)
             else:
                 config.set('buildconfig', k, v)
         config.remove_section('globalconfig')
开发者ID:Conan-Kudo,项目名称:tito,代码行数:21,代码来源:cli.py

示例15: _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)

                fd, name = tempfile.mkstemp()
                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)

                write(fd, header)

                # don't die if this is a new package with no history
                if self._changelog is not None:
                    for entry in self._changelog:
                        if not entry.startswith('-'):
                            entry = '- ' + entry
                        write(fd, entry)
                        write(fd, "\n")
                else:
                    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

                    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:
                    # 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)
                f = os.fdopen(fd)

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

                output = f.read()

                f.close()
                os.unlink(name)

        if not found_changelog:
            warn_out("no %changelog section find in spec file. Changelog entry was not appended.")

        in_f.close()
        out_f.close()

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


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