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

Python util.system函数代码示例

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

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



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

示例1: setup_files

 def setup_files(self):
   system("cp -r %s %s" % (MODEL, self.home))
   system("rm -rf %s/nxserver/lib" % self.home)
   system("rm -rf %s/nxserver/bundles" % self.home)
   system("ln -sf %s/nxserver/lib %s/nxserver/lib" % (MODEL, self.home))
   system("ln -sf %s/nxserver/bundles %s/nxserver/bundles"
       % (MODEL, self.home))
开发者ID:compatible,项目名称:nuxeo-cloud-controller,代码行数:7,代码来源:model.py


示例2: make_corrects_Python3

def make_corrects_Python3 ():
    for f in glob.glob("*.cor"):
        util.del_file(f)
    inps = sorted(glob.glob("*.inp"))
    for inp in inps:
        tst = os.path.splitext(inp)[0]
        util.system("python3 solution.py <%s.inp >%s.cor" % (tst, tst))
开发者ID:jutge-org,项目名称:toolkit,代码行数:7,代码来源:problems.py


示例3: edit

    def edit(self, text, user, extra={}):
        (fd, name) = tempfile.mkstemp(prefix="hg-editor-", suffix=".txt",
                                      text=True)
        try:
            f = os.fdopen(fd, "w")
            f.write(text)
            f.close()

            environ = {'HGUSER': user}
            if 'transplant_source' in extra:
                environ.update({'HGREVISION': hex(extra['transplant_source'])})
            for label in ('source', 'rebase_source'):
                if label in extra:
                    environ.update({'HGREVISION': extra[label]})
                    break

            editor = self.geteditor()

            util.system("%s \"%s\"" % (editor, name),
                        environ=environ,
                        onerr=util.Abort, errprefix=_("edit failed"),
                        out=self.fout)

            f = open(name)
            t = f.read()
            f.close()
        finally:
            os.unlink(name)

        return t
开发者ID:roopakparikh,项目名称:crane-node-hello,代码行数:30,代码来源:ui.py


示例4: make_executable_Java

def make_executable_Java ():
    if not util.file_exists("solution.java"):
        raise Exception("solution.java does not exist")
    util.del_file("Main.java")
    util.system("javac solution.java")
    if not util.file_exists("Main.class"):
        raise Exception("error in Java compilation")
开发者ID:jutge-org,项目名称:toolkit,代码行数:7,代码来源:problems.py


示例5: _exthook

def _exthook(ui, repo, name, cmd, args, throw):
    ui.note(_("running hook %s: %s\n") % (name, cmd))

    env = {}
    for k, v in args.iteritems():
        if util.safehasattr(v, '__call__'):
            v = v()
        if isinstance(v, dict):
            # make the dictionary element order stable across Python
            # implementations
            v = ('{' +
                 ', '.join('%r: %r' % i for i in sorted(v.iteritems())) +
                 '}')
        env['HG_' + k.upper()] = v

    if repo:
        cwd = repo.root
    else:
        cwd = os.getcwd()
    if 'HG_URL' in env and env['HG_URL'].startswith('remote:http'):
        r = util.system(cmd, environ=env, cwd=cwd, out=ui)
    else:
        r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout)
    if r:
        desc, r = util.explainexit(r)
        if throw:
            raise util.Abort(_('%s hook %s') % (name, desc))
        ui.warn(_('warning: %s hook %s\n') % (name, desc))
    return r
开发者ID:mortonfox,项目名称:cr48,代码行数:29,代码来源:hook.py


示例6: make_corrects_Java

def make_corrects_Java ():
    for f in glob.glob("*.cor"):
        util.del_file(f)
    inps = sorted(glob.glob("*.inp"))
    for inp in inps:
        tst = os.path.splitext(inp)[0]
        util.system("java Main <%s.inp >%s.cor" % (tst, tst))
开发者ID:jutge-org,项目名称:toolkit,代码行数:7,代码来源:problems.py


示例7: _exthook

def _exthook(ui, repo, name, cmd, args, throw):
    ui.note(_("running hook %s: %s\n") % (name, cmd))

    starttime = time.time()
    env = {}
    for k, v in args.iteritems():
        if callable(v):
            v = v()
        if isinstance(v, dict):
            # make the dictionary element order stable across Python
            # implementations
            v = ('{' +
                 ', '.join('%r: %r' % i for i in sorted(v.iteritems())) +
                 '}')
        env['HG_' + k.upper()] = v

    if repo:
        cwd = repo.root
    else:
        cwd = os.getcwd()
    if 'HG_URL' in env and env['HG_URL'].startswith('remote:http'):
        r = util.system(cmd, environ=env, cwd=cwd, out=ui)
    else:
        r = util.system(cmd, environ=env, cwd=cwd, out=ui.fout)

    duration = time.time() - starttime
    ui.log('exthook', 'exthook-%s: %s finished in %0.2f seconds\n',
           name, cmd, duration)
    if r:
        desc, r = util.explainexit(r)
        if throw:
            raise error.HookAbort(_('%s hook %s') % (name, desc))
        ui.warn(_('warning: %s hook %s\n') % (name, desc))
    return r
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:34,代码来源:hook.py


示例8: info

 def info(self, generator):
     generator.add_include_dir('include/')
     if system() == 'Windows':
         generator.add_source_files(*glob('src/*'))
     elif system() == 'Linux':
         generator.add_source_files('src/nfd_common.c', 'src/nfd_gtk.c')
     else:
         generator.add_source_files('src/nfd_common.c', 'src/nfd_cocoa.m')
开发者ID:trevex,项目名称:coal-nativefiledialog,代码行数:8,代码来源:coalfile.py


示例9: make_corrects_RunPython

def make_corrects_RunPython ():
    for f in glob.glob("*.cor"):
        util.del_file(f)
    inps = sorted(glob.glob("*.inp"))
    for inp in inps:
        tst = os.path.splitext(inp)[0]
        os.system("cat solution.py %s.inp > work.py" % tst)
        util.system("python3 work.py >%s.cor" % (tst, ))

        # additionally, create doctest-like session
        if tst == 'sample':
            python_doctest(tst)
开发者ID:jutge-org,项目名称:toolkit,代码行数:12,代码来源:problems.py


示例10: cmd_clean

def cmd_clean():
  """Drop database and remove all instances (useful for debugging).
  """
  for instance in all_instances():
    if instance.state == RUNNING:
      instance.stop()
    instance.purge()
    session.delete(instance)
    session.commit()

  #os.unlink(DB)
  system("rm -rf %s/nginx" % HOME)
开发者ID:compatible,项目名称:nuxeo-cloud-controller,代码行数:12,代码来源:commands.py


示例11: make_executable_C

def make_executable_C ():

    handler = util.read_yml("handler.yml")

    if handler["handler"] != "std":
        raise Exception("unknown handler")

    if not util.file_exists("solution.c"):
        raise Exception("solution.c does not exist")

    util.del_file("solution.exe")
    util.system("%s %s solution.c -o solution.exe" % (cc, ccflags))
    if not util.file_exists("solution.exe"):
        raise Exception("error in C compilation")
开发者ID:jutge-org,项目名称:toolkit,代码行数:14,代码来源:problems.py


示例12: make_executable_GHC

def make_executable_GHC ():

    handler = util.read_yml("handler.yml")

    if handler["handler"] != "std":
        raise Exception("unknown handler")

    if not util.file_exists("solution.hs"):
        raise Exception("solution.hs does not exist")

    util.del_file("solution.exe")
    util.system("ghc solution.hs -o solution.exe")
    if not util.file_exists("solution.exe"):
        raise Exception("error in GHC compilation")
开发者ID:jutge-org,项目名称:toolkit,代码行数:14,代码来源:problems.py


示例13: info

 def info(self, generator):
     libs = "-lluasocket"
     if system() == 'Windows':
         libs += " -lws2_32"
     generator.add_library(libs)
     generator.add_link_dir('libs/')
     generator.add_include_dir('include/')
开发者ID:trevex,项目名称:coal-luasocket,代码行数:7,代码来源:coalfile.py


示例14: __init__

    def __init__(self, ui, path, create=False):
        self._url = path
        self.ui = ui

        u = util.url(path, parsequery=False, parsefragment=False)
        if u.scheme != "ssh" or not u.host or u.path is None:
            self._abort(error.RepoError(_("couldn't parse location %s") % path))

        self.user = u.user
        if u.passwd is not None:
            self._abort(error.RepoError(_("password in URL not supported")))
        self.host = u.host
        self.port = u.port
        self.path = u.path or "."

        sshcmd = self.ui.config("ui", "ssh", "ssh")
        remotecmd = self.ui.config("ui", "remotecmd", "hg")

        args = util.sshargs(sshcmd, self.host, self.user, self.port)

        if create:
            cmd = '%s %s "%s init %s"'
            cmd = cmd % (sshcmd, args, remotecmd, self.path)

            ui.note(_("running %s\n") % cmd)
            res = util.system(cmd)
            if res != 0:
                self._abort(error.RepoError(_("could not create remote repo")))

        self.validate_repo(ui, sshcmd, args, remotecmd)
开发者ID:rybesh,项目名称:mysite-lib,代码行数:30,代码来源:sshrepo.py


示例15: __init__

    def __init__(self, ui, path, create=0):
        self._url = path
        self.ui = ui

        m = re.match(r'^ssh://(([^@]+)@)?([^:/]+)(:(\d+))?(/(.*))?$', path)
        if not m:
            self.abort(error.RepoError(_("couldn't parse location %s") % path))

        self.user = m.group(2)
        self.host = m.group(3)
        self.port = m.group(5)
        self.path = m.group(7) or "."

        sshcmd = self.ui.config("ui", "ssh", "ssh")
        remotecmd = self.ui.config("ui", "remotecmd", "hg")

        args = util.sshargs(sshcmd, self.host, self.user, self.port)

        if create:
            cmd = '%s %s "%s init %s"'
            cmd = cmd % (sshcmd, args, remotecmd, self.path)

            ui.note(_('running %s\n') % cmd)
            res = util.system(cmd)
            if res != 0:
                self.abort(error.RepoError(_("could not create remote repo")))

        self.validate_repo(ui, sshcmd, args, remotecmd)
开发者ID:pombredanne,项目名称:SmartNotes,代码行数:28,代码来源:sshrepo.py


示例16: _xmerge

def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files, labels=None):
    r = _premerge(repo, toolconf, files, labels=labels)
    if r:
        tool, toolpath, binary, symlink = toolconf
        a, b, c, back = files
        out = ""
        env = {'HG_FILE': fcd.path(),
               'HG_MY_NODE': short(mynode),
               'HG_OTHER_NODE': str(fco.changectx()),
               'HG_BASE_NODE': str(fca.changectx()),
               'HG_MY_ISLINK': 'l' in fcd.flags(),
               'HG_OTHER_ISLINK': 'l' in fco.flags(),
               'HG_BASE_ISLINK': 'l' in fca.flags(),
               }

        ui = repo.ui

        args = _toolstr(ui, tool, "args", '$local $base $other')
        if "$output" in args:
            out, a = a, back # read input from backup, write to original
        replace = {'local': a, 'base': b, 'other': c, 'output': out}
        args = util.interpolate(r'\$', replace, args,
                                lambda s: util.shellquote(util.localpath(s)))
        r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
                        out=ui.fout)
        return True, r
    return False, 0
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:27,代码来源:filemerge.py


示例17: __init__

    def __init__(self, ui, path, create=False):
        self._url = path
        self.ui = ui
        self.pipeo = self.pipei = self.pipee = None

        u = util.url(path, parsequery=False, parsefragment=False)
        if u.scheme != 'ssh' or not u.host or u.path is None:
            self._abort(error.RepoError(_("couldn't parse location %s") % path))

        self.user = u.user
        if u.passwd is not None:
            self._abort(error.RepoError(_("password in URL not supported")))
        self.host = u.host
        self.port = u.port
        self.path = u.path or "."

        sshcmd = self.ui.config("ui", "ssh", "ssh")
        remotecmd = self.ui.config("ui", "remotecmd", "hg")

        args = util.sshargs(sshcmd, self.host, self.user, self.port)

        if create:
            cmd = '%s %s %s' % (sshcmd, args,
                util.shellquote("%s init %s" %
                    (_serverquote(remotecmd), _serverquote(self.path))))
            ui.debug('running %s\n' % cmd)
            res = util.system(cmd, out=ui.fout)
            if res != 0:
                self._abort(error.RepoError(_("could not create remote repo")))

        self._validaterepo(sshcmd, args, remotecmd)
开发者ID:ZanderZhang,项目名称:Andriod-Learning,代码行数:31,代码来源:sshpeer.py


示例18: _xmerge

def _xmerge(repo, mynode, orig, fcd, fco, fca, toolconf, files):
    r = _premerge(repo, toolconf, files)
    if r:
        tool, toolpath, binary, symlink = toolconf
        a, b, c, back = files
        out = ""
        env = dict(HG_FILE=fcd.path(),
                   HG_MY_NODE=short(mynode),
                   HG_OTHER_NODE=str(fco.changectx()),
                   HG_BASE_NODE=str(fca.changectx()),
                   HG_MY_ISLINK='l' in fcd.flags(),
                   HG_OTHER_ISLINK='l' in fco.flags(),
                   HG_BASE_ISLINK='l' in fca.flags())

        ui = repo.ui

        args = _toolstr(ui, tool, "args", '$local $base $other')
        if "$output" in args:
            out, a = a, back # read input from backup, write to original
        replace = dict(local=a, base=b, other=c, output=out)
        args = util.interpolate(r'\$', replace, args,
                                lambda s: '"%s"' % util.localpath(s))
        r = util.system(toolpath + ' ' + args, cwd=repo.root, environ=env,
                        out=ui.fout)
        return True, r
    return False, 0
开发者ID:Pelonza,项目名称:Learn2Mine-Main,代码行数:26,代码来源:filemerge.py


示例19: info

 def info(self, generator):
     if system() == 'Windows':
         generator.add_library('-llua51')
     else:
         generator.add_library('-lluajit')
     generator.add_link_dir('libs/')
     generator.add_include_dir('include/')
开发者ID:trevex,项目名称:coal-luajit2,代码行数:7,代码来源:coalfile.py


示例20: publish_results

def publish_results(exp_name, results_dir):
    import logging
    log = logging.getLogger("sts.exp_lifecycle")
    res_git_dir = find_git_dir(results_dir)
    rel_results_dir = os.path.relpath(results_dir, res_git_dir)
    log.info("Publishing results to git dir "+res_git_dir)
    system("git add %s" % rel_results_dir, cwd=res_git_dir)
    system("git commit -m '%s'" % exp_name, cwd=res_git_dir)
    system("git pull --rebase", cwd=res_git_dir)
    system("git push", cwd=res_git_dir)
开发者ID:NetSys,项目名称:demi-applications,代码行数:10,代码来源:lifecycle.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python util.testpath函数代码示例发布时间:2022-05-26
下一篇:
Python util.svdata函数代码示例发布时间: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