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

Python util.sibpath函数代码示例

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

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



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

示例1: upgradeMaster

def upgradeMaster(config):
    basedir = os.path.expanduser(config['basedir'])
    m = Maker(config)
    # TODO: check Makefile
    # TODO: check TAC file
    # check web files: index.html, default.css, robots.txt
    m.upgrade_public_html({
          'bg_gradient.jpg' : util.sibpath(__file__, "../status/web/files/bg_gradient.jpg"),
          'default.css' : util.sibpath(__file__, "../status/web/files/default.css"),
          'robots.txt' : util.sibpath(__file__, "../status/web/files/robots.txt"),
          'favicon.ico' : util.sibpath(__file__, "../status/web/files/favicon.ico"),
      })
    m.populate_if_missing(os.path.join(basedir, "master.cfg.sample"),
                          util.sibpath(__file__, "sample.cfg"),
                          overwrite=True)
    # if index.html exists, use it to override the root page tempalte
    m.move_if_present(os.path.join(basedir, "public_html/index.html"),
                      os.path.join(basedir, "templates/root.html"))

    from buildbot.db import connector, dbspec
    spec = dbspec.DBSpec.from_url(config["db"], basedir)
    # TODO: check that TAC file specifies the right spec

    # upgrade the db
    from buildbot.db.schema import manager
    sm = manager.DBSchemaManager(spec, basedir)
    sm.upgrade()

    # check the configuration
    rc = m.check_master_cfg()
    if rc:
        return rc
    if not config['quiet']: print "upgrade complete"
    return 0
开发者ID:Almad,项目名称:buildbot,代码行数:34,代码来源:runner.py


示例2: __init__

    def __init__(self, highscore, config):
        service.MultiService.__init__(self)
        self.setName('highscore.www')
        self.highscore = highscore
        self.config = config

        self.port = config.www.get('port', 8080)
        self.port_service = None
        self.site = None
        self.site_public_html = None

        self.root = root = static.Data('placeholder', 'text/plain')
        resource
        #root.putChild('', resource.HighscoresResource(self.highscore))

        print(util.sibpath(__file__, 'content'))
        self.root = root  = static.File(util.sibpath(__file__, 'content'))
        root.putChild('api', resource.ApiResource(self.highscore))
        root.putChild('plugins', resource.PluginsResource(self.highscore))

        self.site = server.Site(root)

        port = "tcp:%d" % self.port if type(self.port) == int else self.port
        self.port_service = strports.service(port, self.site)
        self.port_service.setServiceParent(self)
开发者ID:tomprince,项目名称:highscore,代码行数:25,代码来源:service.py


示例3: getToplevel

def getToplevel(session):
	root = File(util.sibpath(__file__, "web-data/tpl/default"))
	
	root.putChild("web", ScreenPage(session, util.sibpath(__file__, "web"), True) ) # "/web/*"
	root.putChild("web-data", File(util.sibpath(__file__, "web-data")))
	root.putChild("file", FileStreamer())
	root.putChild("grab", GrabResource())
	res = IPKGResource()
	root.putChild("opkg", res)
	root.putChild("ipkg", res)
	root.putChild("play", ServiceplayerResource(session))
	root.putChild("wap", RedirectorResource("/mobile/"))
	root.putChild("mobile", ScreenPage(session, util.sibpath(__file__, "mobile"), True) )
	root.putChild("upload", UploadResource())
	root.putChild("servicelist", ServiceList(session))
	root.putChild("streamcurrent", RedirecToCurrentStreamResource(session))
		
	if config.plugins.Webinterface.includemedia.value is True:
		root.putChild("media", File("/media"))
		root.putChild("hdd", File("/media/hdd"))
		
	
	importExternalModules()

	for child in externalChildren:
		if len(child) > 1:
			root.putChild(child[0], child[1])
	
	return root
开发者ID:BAZANT,项目名称:enigma2-plugins-sh4,代码行数:29,代码来源:Toplevel.py


示例4: __init__

    def __init__(self, deviceService):
        """
        :type deviceService: txopenbci.control.DeviceService
        """
        Resource.__init__(self)

        self.putChild("control", CommandResource(deviceService))
        self.putChild("stream", SampleStreamer(deviceService))
        self.putChild("static", File(sibpath(__file__, "webpages")))
        self.putChild("", File(os.path.join(sibpath(__file__, "webpages"), 'index.html')))
开发者ID:RachelLader,项目名称:txOpenBCI,代码行数:10,代码来源:web.py


示例5: ensureTwistedPair

 def ensureTwistedPair(self):
     try:
         import twisted.pair
     except ImportError:
         import new
         m = new.module("twisted.pair")
         sys.modules["twisted.pair"] = m
         global twisted
         twisted.pair = m
         m.__file__ = os.path.join(sibpath(__file__, "twisted_pair"), "__init__.pyc")
         m.__path__ = [sibpath(__file__, "twisted_pair")]
开发者ID:alessandrod,项目名称:cattivo,代码行数:11,代码来源:launcher.py


示例6: setUp

 def setUp(self):
     self.basedir = "test_slavecommand"
     if not os.path.isdir(self.basedir):
         os.mkdir(self.basedir)
     self.subdir = os.path.join(self.basedir, "subdir")
     if not os.path.isdir(self.subdir):
         os.mkdir(self.subdir)
     self.builder = FakeSlaveBuilder(self.usePTY, self.basedir)
     self.emitcmd = util.sibpath(__file__, "emit.py")
     self.subemitcmd = os.path.join(util.sibpath(__file__, "subdir"),
                                    "emit.py")
     self.sleepcmd = util.sibpath(__file__, "sleep.py")
开发者ID:MahatmaManic,项目名称:buildbot,代码行数:12,代码来源:test_slavecommand.py


示例7: autostart

def autostart(reason, **kwargs):
    if reason == 0 and "session" in kwargs:
        session = kwargs["session"]
        root = File(eEnv.resolve("${libdir}/enigma2/python/Plugins/Extensions/WebAdmin/web-data"))
        root.putChild("web", ScreenPage(session, util.sibpath(__file__, "web"), True))
        root.putChild("mobile", ScreenPage(session, util.sibpath(__file__, "mobile"), True))
        root.putChild("tmp", File("/tmp"))
        root.putChild("uploadtext", UploadTextResource())
        root.putChild("uploadpkg", UploadPkgResource())
        root.putChild("pkg", PKGResource())
        root.putChild("script", Script())
        addExternalChild(("webadmin", root, "WebAdmin", 1, True, "_self"))
开发者ID:hd75hd,项目名称:enigma2-plugins,代码行数:12,代码来源:plugin.py


示例8: setUpFakeHome

 def setUpFakeHome(self):
     user_home = os.path.abspath(tempfile.mkdtemp())
     os.makedirs(os.path.join(user_home, '.ssh'))
     shutil.copyfile(
         sibpath(__file__, 'id_dsa'),
         os.path.join(user_home, '.ssh', 'id_dsa'))
     shutil.copyfile(
         sibpath(__file__, 'id_dsa.pub'),
         os.path.join(user_home, '.ssh', 'id_dsa.pub'))
     os.chmod(os.path.join(user_home, '.ssh', 'id_dsa'), 0600)
     real_home, os.environ['HOME'] = os.environ['HOME'], user_home
     return real_home, user_home
开发者ID:pombreda,项目名称:UnnaturalCodeFork,代码行数:12,代码来源:servers.py


示例9: task_installPrivateData

    def task_installPrivateData(self, private=sibpath(__file__, 'private.py')):
        """
        Install private config.
        """
        with settings(user=self.serviceUser):
            put(sibpath(__file__, 'config.py'),
                os.path.join(self.configDir, "config.py"))

            if FilePath(private).exists():
                put(sibpath(__file__, 'private.py'),
                    os.path.join(self.configDir, "private.py"), mode=0600)
            else:
                abort('Missing private config.')
开发者ID:mithrandi,项目名称:braid,代码行数:13,代码来源:fabfile.py


示例10: task_installTestData

    def task_installTestData(self, force=None):
        """
        Do test environment setup (with fake passwords, etc).
        """
        if env.get('environment') == 'production':
           abort("Don't use testInit in production.")

        with settings(user=self.serviceUser), cd(self.configDir):
            if force or not files.exists('private.py'):
                puts('Using sample private.py and config.py')
                put(sibpath(__file__, 'private.py.sample'),
                    os.path.join(self.configDir, "private.py"), mode=0600)
                put(sibpath(__file__, 'config.py.sample'),
                    os.path.join(self.configDir, "config.py"))
开发者ID:mithrandi,项目名称:braid,代码行数:14,代码来源:fabfile.py


示例11: createMaster

def createMaster(config):
    m = Maker(config)
    m.mkdir()
    m.chdir()
    contents = masterTAC % config
    m.makeTAC(contents)
    m.sampleconfig(util.sibpath(__file__, "sample.cfg"))
    m.public_html(util.sibpath(__file__, "../status/web/index.html"),
                  util.sibpath(__file__, "../status/web/classic.css"),
                  util.sibpath(__file__, "../status/web/robots.txt"),
                  )
    m.makefile()

    if not m.quiet: print "buildmaster configured in %s" % m.basedir
开发者ID:adamac,项目名称:buildbot,代码行数:14,代码来源:runner.py


示例12: createMaster

def createMaster(config):
    m = Maker(config)
    m.mkdir()
    m.chdir()
    contents = masterTAC % config
    m.makeTAC(contents)
    m.sampleconfig(util.sibpath(__file__, "sample.cfg"))
    m.public_html({
          'bg_gradient.jpg' : util.sibpath(__file__, "../status/web/bg_gradient.jpg"),
          'default.css' : util.sibpath(__file__, "../status/web/default.css"),
          'robots.txt' : util.sibpath(__file__, "../status/web/robots.txt"),
      })
    m.makefile()

    if not m.quiet: print "buildmaster configured in %s" % m.basedir
开发者ID:mue,项目名称:buildbot,代码行数:15,代码来源:runner.py


示例13: getExamples

def getExamples():
    liveChildren = {}
    for mod in os.listdir(util.sibpath(__file__, ".")):
        if mod.startswith("_") or not mod.endswith(".py"):
            continue
        moduleId = mod[:-3]
        print "Found example 'examples.%s.example'" % (moduleId,)
        example = reflect.namedAny("examples.%s.Example" % (moduleId,))

        class Viewer(ExampleViewer):
            pass

        example.moduleId = moduleId
        doc = unicode(example.__doc__)
        title = getattr(example, "title", None)
        if not title:
            if doc:
                # Take the first line of the docstring.
                title = u"".join(doc.split(u"\n")[:1])
            else:
                title = splitNerdyCaps(moduleId)
        example.title = title
        Viewer.example = example
        Viewer.liveChildren = {"example": example}
        liveChildren[moduleId] = Viewer
    return liveChildren
开发者ID:BackupTheBerlios,项目名称:nufox-svn,代码行数:26,代码来源:_base.py


示例14: _testLogFiles

    def _testLogFiles(self, mode):
        basedir = "test_shell.testLogFiles"
        self.setUpBuilder(basedir)
        # emitlogs.py writes two lines to stdout and two logfiles, one second
        # apart. Then it waits for us to write something to stdin, then it
        # writes one more line.

        if mode != 3:
            # we write something to the log file first, to exercise the logic
            # that distinguishes between the old file and the one as modified
            # by the ShellCommand. We set the timestamp back 5 seconds so
            # that timestamps can be used to distinguish old from new.
            log2file = os.path.join(basedir, "log2.out")
            f = open(log2file, "w")
            f.write("dummy text\n")
            f.close()
            earlier = time.time() - 5
            os.utime(log2file, (earlier, earlier))

        if mode == 3:
            # mode=3 doesn't create the old logfiles in the first place, but
            # then behaves like mode=1 (where the command pauses before
            # creating them).
            mode = 1

        # mode=1 will cause emitlogs.py to delete the old logfiles first, and
        # then wait two seconds before creating the new files. mode=0 does
        # not do this.
        args = {
            "command": [sys.executable, util.sibpath(__file__, "emitlogs.py"), "%s" % mode],
            "workdir": ".",
            "logfiles": {"log2": "log2.out", "log3": "log3.out"},
            "keep_stdin_open": True,
        }
        finishd = self.startCommand(SlaveShellCommand, args)
        # The first batch of lines is written immediately. The second is
        # written after a pause of one second. We poll once per second until
        # we see both batches.

        self._check_timeout = 10
        d = self._check_and_wait()

        def _wait_for_finish(res, finishd):
            return finishd

        d.addCallback(_wait_for_finish, finishd)
        d.addCallback(self.collectUpdates)

        def _check(logs):
            self.failUnlessEqual(logs["stdout"], self._generateText("stdout"))
            if mode == 2:
                self.failIf(("log", "log2") in logs)
                self.failIf(("log", "log3") in logs)
            else:
                self.failUnlessEqual(logs[("log", "log2")], self._generateText("log2"))
                self.failUnlessEqual(logs[("log", "log3")], self._generateText("log3"))

        d.addCallback(_check)
        d.addBoth(self._maybePrintError)
        return d
开发者ID:rhencke,项目名称:mozilla-cvs-history,代码行数:60,代码来源:test_shell.py


示例15: testManyProcesses

    def testManyProcesses(self):

        def _check(results, protocols):
            for p in protocols:
                self.assertEquals(p.stages, [1, 2, 3, 4, 5], "[%d] stages = %s" % (id(p.transport), str(p.stages)))
                # test status code
                f = p.reason
                f.trap(error.ProcessTerminated)
                self.assertEquals(f.value.exitCode, 23)

        exe = sys.executable
        scriptPath = util.sibpath(__file__, "process_tester.py")
        args = [exe, "-u", scriptPath]
        protocols = []
        deferreds = []

        for i in xrange(50):
            p = TestManyProcessProtocol()
            protocols.append(p)
            reactor.spawnProcess(p, exe, args, env=None)
            deferreds.append(p.deferred)

        deferredList = defer.DeferredList(deferreds, consumeErrors=True)
        deferredList.addCallback(_check, protocols)
        return deferredList
开发者ID:andrewbird,项目名称:vodafone-mobile-connect,代码行数:25,代码来源:test_process.py


示例16: testFullAppend

    def testFullAppend(self):
        """
        Test appending a full message to the mailbox
        """
        infile = util.sibpath(__file__, 'rfc822.message')
        message = open(infile)
        acc = self.server.theAccount
        mailbox_name = "appendmbox/subthing"

        def add_mailbox():
            return acc.addMailbox(mailbox_name)

        def login():
            return self.client.login(TEST_USER, TEST_PASSWD)

        def append():
            return self.client.append(
                mailbox_name, message,
                ('\\SEEN', '\\DELETED'),
                'Tue, 17 Jun 2003 11:22:16 -0600 (MDT)',
            )

        d1 = self.connected.addCallback(strip(add_mailbox))
        d1.addCallback(strip(login))
        d1.addCallbacks(strip(append), self._ebGeneral)
        d1.addCallbacks(self._cbStopClient, self._ebGeneral)
        d2 = self.loopback()
        d = defer.gatherResults([d1, d2])

        d.addCallback(lambda _: acc.getMailbox(mailbox_name))
        d.addCallback(lambda mb: mb.fetch(imap4.MessageSet(start=1), True))
        return d.addCallback(self._cbTestFullAppend, infile)
开发者ID:leapcode,项目名称:leap_mail,代码行数:32,代码来源:test_imap.py


示例17: testLingeringClose

 def testLingeringClose(self):
     args = ('-u', util.sibpath(__file__, "simple_client.py"),
             "lingeringClose", str(self.port), self.type)
     d = waitForDeferred(utils.getProcessOutputAndValue(sys.executable, args=args))
     yield d; out,err,code = d.getResult()
     self.assertEquals(code, 0, "Error output:\n%s" % (err,))
     self.assertEquals(out, "HTTP/1.1 402 Payment Required\r\nContent-Length: 0\r\nConnection: close\r\n\r\n")
开发者ID:svn2github,项目名称:calendarserver-raw,代码行数:7,代码来源:test_http.py


示例18: childFactory

 def childFactory(self, ctx, name):
     ch = super(WidgetPage, self).childFactory(ctx, name)
     if ch is None:
         p = util.sibpath(__file__, name)
         if os.path.exists(p):
             ch = static.File(file(p))
     return ch
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:widgets.py


示例19: macro_content

 def macro_content(self, ctx):
     return t.invisible[
                t.p["This macro has been called ",
                    next(counter2)+1,
                    " time(s)"],
                loaders.xmlfile(util.sibpath(__file__,'child_macro.html'), ignoreDocType=True).load()
         ]
开发者ID:perkinslr,项目名称:nevow-py3,代码行数:7,代码来源:macros.py


示例20: testLoadWikipediaTitlesIgnoresIgnorablePages

 def testLoadWikipediaTitlesIgnoresIgnorablePages(self):
     """
     L{loadWikipediaTitles} ignores category, file, portal, etc. pages.
     """
     path = sibpath(__file__, 'ignored.xml')
     loadWikipediaTitles(path, self.pageHandler)
     self.assertEqual([], self.pageHandler.pages)
开发者ID:fluidinfo,项目名称:wikipedia-import,代码行数:7,代码来源:test_url.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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