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

Python executive.run_command函数代码示例

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

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



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

示例1: ensure_clean_working_directory

 def ensure_clean_working_directory(self, force_clean):
     if not force_clean and not self.working_directory_is_clean():
         print run_command(self.status_command(), error_handler=Executive.ignore_error)
         raise ScriptError(message="Working directory has modifications, pass --force-clean or --no-clean to continue.")
     
     log("Cleaning working directory")
     self.clean_working_directory()
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,代码来源:scm.py


示例2: apply_patch

    def apply_patch(self, patch, force=False):
        # It's possible that the patch was not made from the root directory.
        # We should detect and handle that case.
        # FIXME: scm.py should not deal with fetching Attachment data.  Attachment should just have a .data() accessor.
        curl_process = subprocess.Popen(['curl', '--location', '--silent', '--show-error', patch.url()], stdout=subprocess.PIPE)
        args = [self.script_path('svn-apply')]
        if patch.reviewer():
            args += ['--reviewer', patch.reviewer().full_name]
        if force:
            args.append('--force')

        run_command(args, input=curl_process.stdout)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:12,代码来源:scm.py


示例3: setup

    def setup(cls, test_object):
        # Create an test SVN repository
        test_object.svn_repo_path = tempfile.mkdtemp(suffix="svn_test_repo")
        test_object.svn_repo_url = "file://%s" % test_object.svn_repo_path # Not sure this will work on windows
        # git svn complains if we don't pass --pre-1.5-compatible, not sure why:
        # Expected FS format '2'; found format '3' at /usr/local/libexec/git-core//git-svn line 1477
        run_command(['svnadmin', 'create', '--pre-1.5-compatible', test_object.svn_repo_path])

        # Create a test svn checkout
        test_object.svn_checkout_path = tempfile.mkdtemp(suffix="svn_test_checkout")
        run_command(['svn', 'checkout', '--quiet', test_object.svn_repo_url, test_object.svn_checkout_path])

        cls._setup_test_commits(test_object)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:13,代码来源:scm_unittest.py


示例4: test_create_binary_patch

    def test_create_binary_patch(self):
        # Create a git binary patch and check the contents.
        scm = detect_scm_system(self.git_checkout_path)
        test_file_name = 'binary_file'
        test_file_path = os.path.join(self.git_checkout_path, test_file_name)
        file_contents = ''.join(map(chr, range(256)))
        write_into_file_at_path(test_file_path, file_contents)
        run_command(['git', 'add', test_file_name])
        patch = scm.create_patch()
        self.assertTrue(re.search(r'\nliteral 0\n', patch))
        self.assertTrue(re.search(r'\nliteral 256\n', patch))

        # Check if we can apply the created patch.
        run_command(['git', 'rm', '-f', test_file_name])
        self._setup_webkittools_scripts_symlink(scm)
        self.scm.apply_patch(self._create_patch(patch))
        self.assertEqual(file_contents, read_from_path(test_file_path))

        # Check if we can create a patch from a local commit.
        write_into_file_at_path(test_file_path, file_contents)
        run_command(['git', 'add', test_file_name])
        run_command(['git', 'commit', '-m', 'binary diff'])
        patch_from_local_commit = scm.create_patch_from_local_commit('HEAD')
        self.assertTrue(re.search(r'\nliteral 0\n', patch_from_local_commit))
        self.assertTrue(re.search(r'\nliteral 256\n', patch_from_local_commit))
        patch_since_local_commit = scm.create_patch_since_local_commit('HEAD^1')
        self.assertTrue(re.search(r'\nliteral 0\n', patch_since_local_commit))
        self.assertTrue(re.search(r'\nliteral 256\n', patch_since_local_commit))
        self.assertEqual(patch_from_local_commit, patch_since_local_commit)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:29,代码来源:scm_unittest.py


示例5: apply_reverse_diff

    def apply_reverse_diff(self, revision):
        # Assume the revision is an svn revision.
        git_commit = self.git_commit_from_svn_revision(revision)
        if not git_commit:
            raise ScriptError(message='Failed to find git commit for revision %s, git svn log output: "%s"' % (revision, git_commit))

        # I think this will always fail due to ChangeLogs.
        # FIXME: We need to detec specific failure conditions and handle them.
        run_command(['git', 'revert', '--no-commit', git_commit], error_handler=Executive.ignore_error)

        # Fix any ChangeLogs if necessary.
        changelog_paths = self.modified_changelogs()
        if len(changelog_paths):
            run_command([self.script_path('resolve-ChangeLogs')] + changelog_paths)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:14,代码来源:scm.py


示例6: commit_ids_from_commitish_arguments

    def commit_ids_from_commitish_arguments(self, args):
        if not len(args):
            # FIXME: trunk is not always the remote branch name, need a way to detect the name.
            args.append('trunk..HEAD')

        commit_ids = []
        for commitish in args:
            if '...' in commitish:
                raise ScriptError(message="'...' is not supported (found in '%s'). Did you mean '..'?" % commitish)
            elif '..' in commitish:
                commit_ids += reversed(run_command(['git', 'rev-list', commitish]).splitlines())
            else:
                # Turn single commits or branch or tag names into commit ids.
                commit_ids += run_command(['git', 'rev-parse', '--revs-only', commitish]).splitlines()
        return commit_ids
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:15,代码来源:scm.py


示例7: test_run_command_with_pipe

    def test_run_command_with_pipe(self):
        input_process = subprocess.Popen(['echo', 'foo\nbar'], stdout=subprocess.PIPE, stderr=self.dev_null)
        self.assertEqual(run_command(['grep', 'bar'], input=input_process.stdout), "bar\n")

        # Test the non-pipe case too:
        self.assertEqual(run_command(['grep', 'bar'], input="foo\nbar"), "bar\n")

        command_returns_non_zero = ['/bin/sh', '--invalid-option']
        # Test when the input pipe process fails.
        input_process = subprocess.Popen(command_returns_non_zero, stdout=subprocess.PIPE, stderr=self.dev_null)
        self.assertTrue(input_process.poll() != 0)
        self.assertRaises(ScriptError, run_command, ['grep', 'bar'], input=input_process.stdout)

        # Test when the run_command process fails.
        input_process = subprocess.Popen(['echo', 'foo\nbar'], stdout=subprocess.PIPE, stderr=self.dev_null) # grep shows usage and calls exit(2) when called w/o arguments.
        self.assertRaises(ScriptError, run_command, command_returns_non_zero, input=input_process.stdout)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:16,代码来源:scm_unittest.py


示例8: find_checkout_root

 def find_checkout_root(cls, path):
     # "git rev-parse --show-cdup" would be another way to get to the root
     (checkout_root, dot_git) = os.path.split(run_command(['git', 'rev-parse', '--git-dir'], cwd=path))
     # If we were using 2.6 # checkout_root = os.path.relpath(checkout_root, path)
     if not os.path.isabs(checkout_root): # Sometimes git returns relative paths
         checkout_root = os.path.join(path, checkout_root)
     return checkout_root
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,代码来源:scm.py


示例9: value_from_svn_info

 def value_from_svn_info(cls, path, field_name):
     svn_info_args = ['svn', 'info', path]
     info_output = run_command(svn_info_args).rstrip()
     match = re.search("^%s: (?P<value>.+)$" % field_name, info_output, re.MULTILINE)
     if not match:
         raise ScriptError(script_args=svn_info_args, message='svn info did not contain a %s.' % field_name)
     return match.group('value')
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:7,代码来源:scm.py


示例10: commit_message_for_local_commit

    def commit_message_for_local_commit(self, commit_id):
        commit_lines = run_command(['git', 'cat-file', 'commit', commit_id]).splitlines()

        # Skip the git headers.
        first_line_after_headers = 0
        for line in commit_lines:
            first_line_after_headers += 1
            if line == "":
                break
        return CommitMessage(commit_lines[first_line_after_headers:])
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:10,代码来源:scm.py


示例11: test_commitish_order

    def test_commitish_order(self):
        scm = detect_scm_system(self.git_checkout_path)

        commit_range = 'HEAD~3..HEAD'

        actual_commits = scm.commit_ids_from_commitish_arguments([commit_range])
        expected_commits = []
        expected_commits += reversed(run_command(['git', 'rev-list', commit_range]).splitlines())

        self.assertEqual(actual_commits, expected_commits)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:10,代码来源:scm_unittest.py


示例12: run_status_and_extract_filenames

 def run_status_and_extract_filenames(self, status_command, status_regexp):
     filenames = []
     for line in run_command(status_command).splitlines():
         match = re.search(status_regexp, line)
         if not match:
             continue
         # status = match.group('status')
         filename = match.group('filename')
         filenames.append(filename)
     return filenames
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:10,代码来源:scm.py


示例13: test_create_patch_is_full_patch

    def test_create_patch_is_full_patch(self):
        test_dir_path = os.path.join(self.svn_checkout_path, 'test_dir')
        os.mkdir(test_dir_path)
        test_file_path = os.path.join(test_dir_path, 'test_file2')
        write_into_file_at_path(test_file_path, 'test content')
        run_command(['svn', 'add', 'test_dir'])

        # create_patch depends on 'svn-create-patch', so make a dummy version.
        scripts_path = os.path.join(self.svn_checkout_path, 'WebKitTools', 'Scripts')
        os.makedirs(scripts_path)
        create_patch_path = os.path.join(scripts_path, 'svn-create-patch')
        write_into_file_at_path(create_patch_path, '#!/bin/sh\necho $PWD') # We could pass -n to prevent the \n, but not all echo accept -n.
        os.chmod(create_patch_path, stat.S_IXUSR | stat.S_IRUSR)

        # Change into our test directory and run the create_patch command.
        os.chdir(test_dir_path)
        scm = detect_scm_system(test_dir_path)
        self.assertEqual(scm.checkout_root, self.svn_checkout_path) # Sanity check that detection worked right.
        patch_contents = scm.create_patch()
        # Our fake 'svn-create-patch' returns $PWD instead of a patch, check that it was executed from the root of the repo.
        self.assertEqual("%s\n" % os.path.realpath(scm.checkout_root), patch_contents) # Add a \n because echo adds a \n.
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:21,代码来源:scm_unittest.py


示例14: test_rebase_in_progress

    def test_rebase_in_progress(self):
        svn_test_file = os.path.join(self.svn_checkout_path, 'test_file')
        write_into_file_at_path(svn_test_file, "svn_checkout")
        run_command(['svn', 'commit', '--message', 'commit to conflict with git commit'], cwd=self.svn_checkout_path)

        git_test_file = os.path.join(self.git_checkout_path, 'test_file')
        write_into_file_at_path(git_test_file, "git_checkout")
        run_command(['git', 'commit', '-a', '-m', 'commit to be thrown away by rebase abort'])

        # --quiet doesn't make git svn silent, so use run_silent to redirect output
        self.assertRaises(ScriptError, run_silent, ['git', 'svn', '--quiet', 'rebase']) # Will fail due to a conflict leaving us mid-rebase.

        scm = detect_scm_system(self.git_checkout_path)
        self.assertTrue(scm.rebase_in_progress())

        # Make sure our cleanup works.
        scm.clean_working_directory()
        self.assertFalse(scm.rebase_in_progress())

        # Make sure cleanup doesn't throw when no rebase is in progress.
        scm.clean_working_directory()
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:21,代码来源:scm_unittest.py


示例15: test_error_handlers

    def test_error_handlers(self):
        git_failure_message="Merge conflict during commit: Your file or directory 'WebCore/ChangeLog' is probably out-of-date: resource out of date; try updating at /usr/local/libexec/git-core//git-svn line 469"
        svn_failure_message="""svn: Commit failed (details follow):
svn: File or directory 'ChangeLog' is out of date; try updating
svn: resource out of date; try updating
"""
        command_does_not_exist = ['does_not_exist', 'invalid_option']
        self.assertRaises(OSError, run_command, command_does_not_exist)
        self.assertRaises(OSError, run_command, command_does_not_exist, error_handler=Executive.ignore_error)

        command_returns_non_zero = ['/bin/sh', '--invalid-option']
        self.assertRaises(ScriptError, run_command, command_returns_non_zero)
        # Check if returns error text:
        self.assertTrue(run_command(command_returns_non_zero, error_handler=Executive.ignore_error))

        self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=git_failure_message))
        self.assertRaises(CheckoutNeedsUpdate, commit_error_handler, ScriptError(output=svn_failure_message))
        self.assertRaises(ScriptError, commit_error_handler, ScriptError(output='blah blah blah'))
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:18,代码来源:scm_unittest.py


示例16: _build_path

 def _build_path(self, *comps):
     if not self._cached_build_root:
         self._cached_build_root = executive.run_command(["webkit-build-directory", "--base"]).rstrip()
     return os.path.join(self._cached_build_root, self._options.target, *comps)
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:4,代码来源:mac.py


示例17: tear_down

 def tear_down(cls, test_object):
     run_command(['rm', '-rf', test_object.svn_repo_path])
     run_command(['rm', '-rf', test_object.svn_checkout_path])
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:3,代码来源:scm_unittest.py


示例18: last_svn_commit_log

 def last_svn_commit_log(self):
     return run_command(['git', 'svn', 'log', '--limit=1'])
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:2,代码来源:scm.py


示例19: create_patch_since_local_commit

 def create_patch_since_local_commit(self, commit_id):
     return run_command(['git', 'diff', '--binary', commit_id])
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:2,代码来源:scm.py


示例20: create_patch_from_local_commit

 def create_patch_from_local_commit(self, commit_id):
     return run_command(['git', 'diff', '--binary', commit_id + "^.." + commit_id])
开发者ID:flwh,项目名称:Alcatel_OT_985_kernel,代码行数:2,代码来源:scm.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python layout_test_finder.LayoutTestFinder类代码示例发布时间:2022-05-26
下一篇:
Python webkit_finder.WebKitFinder类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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