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

Python tools.mkdir函数代码示例

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

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



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

示例1: initPHPUnit

    def initPHPUnit(self, force=False):
        """Initialise the PHPUnit environment"""

        if self.branch_compare(23, '<'):
            raise Exception('PHPUnit is only available from Moodle 2.3')

        # Set PHPUnit data root
        phpunit_dataroot = self.get('dataroot') + '_phpu'
        self.updateConfig('phpunit_dataroot', phpunit_dataroot)
        if not os.path.isdir(phpunit_dataroot):
            mkdir(phpunit_dataroot, 0777)

        # Set PHPUnit prefix
        phpunit_prefix = 'phpu_'
        self.updateConfig('phpunit_prefix', phpunit_prefix)

        result = (None, None, None)
        exception = None
        try:
            if force:
                result = self.cli('/admin/tool/phpunit/cli/util.php', args='--drop', stdout=None, stderr=None)
            result = self.cli('/admin/tool/phpunit/cli/init.php', stdout=None, stderr=None)
        except Exception as exception:
            pass

        if exception != None or result[0] > 0:
            if result[0] == 129:
                raise Exception('PHPUnit is not installed on your system')
            elif result[0] > 0:
                raise Exception('Something wrong with PHPUnit configuration')
            else:
                raise exception
开发者ID:rajeshtaneja,项目名称:mdk,代码行数:32,代码来源:moodle.py


示例2: run

def run(RUN_TRAIN, RUN_TEST, RUN_TRAIN2, RUN_TEST2, RUN_SAVE):
    tools.mkdir()
    if RUN_TRAIN : trainer()
    if RUN_TEST : tester()
    if RUN_TRAIN2 : trainer(type_=2)
    if RUN_TEST2 : tester(type_=2)
    if RUN_SAVE: tools.saver() 
开发者ID:THURachel,项目名称:CCVL,代码行数:7,代码来源:run_pascal.py


示例3: link_swig

def link_swig(source):
    target = os.path.join("swig")
    tools.mkdir(target)
    for module, g in tools.get_modules(source):
        # they all go in the same dir, so don't remove old links
        tools.link_dir(
            os.path.join(g,
                         "pyext"),
            target,
            match=["*.i"],
            clean=False)
        if os.path.exists(os.path.join(g, "pyext", "include")):
            tools.link_dir(
                os.path.join(g,
                             "pyext",
                             "include"),
                target,
                match=["*.i"],
                clean=False)
        tools.link(
            os.path.join(
                g,
                "pyext",
                "swig.i-in"),
            os.path.join(
                target,
                "IMP_%s.impl.i" %
                module))
开发者ID:newtonjoo,项目名称:imp,代码行数:28,代码来源:setup.py


示例4: main

def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    mkdir(settings['static_files'])
    # Create Ziggurat tables
    alembic_ini_file = 'alembic.ini'
    if not os.path.exists(alembic_ini_file):
        alembic_ini = ALEMBIC_CONF.replace('{{db_url}}',
                                           settings['sqlalchemy.url'])
        f = open(alembic_ini_file, 'w')
        f.write(alembic_ini)
        f.close()
    bin_path = os.path.split(sys.executable)[0]
    alembic_bin = os.path.join(bin_path, 'alembic')
    command = '%s upgrade head' % alembic_bin
    os.system(command)
    os.remove(alembic_ini_file)
    # Insert data
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    init_model()
    create_schemas(engine)
    Base.metadata.create_all(engine)
    initial_data.insert()
    transaction.commit()
开发者ID:aagusti,项目名称:opensipkd-inventory,代码行数:28,代码来源:initializedb.py


示例5: generate_all_cpp

def generate_all_cpp(source):
    target=os.path.join("src")
    tools.mkdir(target)
    for module, g in tools.get_modules(source):
        sources= tools.get_glob([os.path.join(g, "src", "*.cpp")])\
            +tools.get_glob([os.path.join(g, "src", "internal", "*.cpp")])
        targetf=os.path.join(target, module+"_all.cpp")
        sources.sort()
        tools.rewrite(targetf, "\n".join(["#include <%s>"%os.path.abspath(s) for s in sources]) + '\n')
开发者ID:apolitis,项目名称:imp,代码行数:9,代码来源:setup_all.py


示例6: run

def run(RUN_TRAIN, RUN_TEST, RUN_TRAIN2, RUN_TEST2, RUN_SAVE):
    tools.mkdir()
    if RUN_TRAIN : trainer()
    if RUN_TEST : tester()
    if RUN_TRAIN2 : trainer(type_=2)
    if RUN_TEST2 : tester(type_=2)
    if RUN_SAVE: tools.saver()
    if RUN_DENSECRF : crf_runner(LOAD_MAT_FILE, RUN_TRAIN2)
    if GRID_SEARCH : grid_search(LOAD_MAT_FILE, RUN_TRAIN2) 
开发者ID:573671712,项目名称:DeepLab-Context,代码行数:9,代码来源:run.py


示例7: main

def main():
    (options, args) = parser.parse_args()
    outputdir= os.path.abspath(os.path.join("src", "%s_swig"%options.module))
    tools.mkdir(outputdir, clean=False)
    run_swig(outputdir, options)
    patch_file(os.path.join(outputdir, "wrap.cpp-in"),
               os.path.join(outputdir, "wrap.cpp"), options)
    patch_file(os.path.join(outputdir, "wrap.h-in"),
               os.path.join(outputdir, "wrap.h"), options)
开发者ID:apolitis,项目名称:imp,代码行数:9,代码来源:make_swig_wrapper.py


示例8: test_mkdir

 def test_mkdir(self):
     self.assertFalse(tools.mkdir('/'))
     with TemporaryDirectory() as d:
         path = os.path.join(d, 'foo')
         self.assertTrue(tools.mkdir(path))
         for mode in (0o700, 0o644, 0o777):
             msg = 'new path should have octal permissions {0:#o}'.format(mode)
             path = os.path.join(d, '{0:#o}'.format(mode))
             self.assertTrue(tools.mkdir(path, mode), msg)
             self.assertEqual('{0:o}'.format(os.stat(path).st_mode & 0o777), '{0:o}'.format(mode), msg)
开发者ID:heysion,项目名称:backintime,代码行数:10,代码来源:test_tools.py


示例9: link_dox

def link_dox(source):
    for subdir in ("ref", "manual"):
        target = os.path.join("doxygen", subdir)
        tools.mkdir(target)
    tools.link_dir(os.path.join(source, "doc", "ref"),
                   os.path.join("doc", "ref"),
                   match=["*.png", "*.pdf", "*.gif"], clean=False)
    tools.link_dir(os.path.join(source, "doc", "manual", "images"),
                   os.path.join("doc", "manual"),
                   match=["*.png", "*.pdf", "*.gif"], clean=False)
开发者ID:AljGaber,项目名称:imp,代码行数:10,代码来源:setup_doxygen.py


示例10: link_dox

def link_dox(source):
    target = os.path.join("doxygen")
    tools.mkdir(target)
    for module, g in tools.get_modules(source):
        tools.link_dir(os.path.join(g, "doc"),
                       os.path.join("doc", "html", module),
                       match=["*.png", "*.pdf", "*.gif"], clean=False)
    tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"),
                   match=["*.png", "*.pdf", "*.gif"], clean=False)
    tools.link_dir(os.path.join(source, "doc", "tutorial"),
                   os.path.join("doc", "tutorial"),
                   match=["*.png", "*.pdf", "*.gif"], clean=False)
开发者ID:newtonjoo,项目名称:imp,代码行数:12,代码来源:setup_doxygen.py


示例11: link_python

def link_python(source):
    target=os.path.join("lib")
    tools.mkdir(target, clean=False)
    for module, g in tools.get_modules(source):
        path= os.path.join(target, "IMP", module)
        tools.mkdir(path, clean=False)
        for old in tools.get_glob([os.path.join(path, "*.py")]):
            # don't unlink the generated file
            if os.path.split(old)[1] != "__init__.py" and os.path.split(old)[1] != "_version_check.py":
                os.unlink(old)
                #print "linking", path
        tools.link_dir(os.path.join(g, "pyext", "src"), path, clean=False)
开发者ID:drussel,项目名称:imp,代码行数:12,代码来源:setup.py


示例12: link_headers

def link_headers(source):
    target=os.path.join("include")
    tools.mkdir(target)
    root=os.path.join(target, "IMP")
    tools.mkdir(root)
    for (module, g) in tools.get_modules(source):
        #print g, module
        if module== "SConscript":
            continue
        tools.link_dir(os.path.join(g, "include"), os.path.join(root, module), match=["*.h"])
        tools.link_dir(os.path.join(g, "include", "internal"), os.path.join(root, module, "internal"),
                        match=["*.h"])
开发者ID:drussel,项目名称:imp,代码行数:12,代码来源:setup.py


示例13: link_benchmark

def link_benchmark(options):
    path = os.path.join("benchmark", options.name)
    tools.mkdir(path, clean=False)
    for old in tools.get_glob([os.path.join(path, "*.py")]):
        os.unlink(old)
    tools.link_dir(
        os.path.join(options.source,
                     "modules",
                     options.name,
                     "benchmark"),
        path,
        clean=False,
        match=["*.py"])
开发者ID:newtonjoo,项目名称:imp,代码行数:13,代码来源:setup_module.py


示例14: make_version_check

def make_version_check(options):
    dir= os.path.join("lib", "IMP", options.name)
    tools.mkdir(dir, clean=False)
    outf= os.path.join(dir, "_version_check.py")
    template="""def check_version(myversion):
  def _check_one(name, expected, found):
    if expected != found:
      raise RuntimeError('Expected version '+expected+' but got '+ found \
           +' when loading module '+name\
            +'. Please make sure IMP is properly built and installed and that matching python and C++ libraries are used.')
  _check_one('%s', '%s', myversion)
  """
    tools.rewrite(outf, template%(options.name, get_version(options)))
开发者ID:drussel,项目名称:imp,代码行数:13,代码来源:setup_module.py


示例15: make_version_check

def make_version_check(options):
    dir= os.path.join("lib", "IMP", options.name)
    tools.mkdir(dir, clean=False)
    version = tools.get_module_version(options.name, options.source)
    outf= os.path.join(dir, "_version_check.py")
    template="""def check_version(myversion):
  def _check_one(name, expected, found):
    if expected != found:
      message = "Expected version " + expected + " but got " + found + " when loading module " + name + ". Please make sure IMP is properly built and installed and that matching python and C++ libraries are used."
      raise RuntimeError(message)
  version = '%s'
  _check_one('%s', version, myversion)
  """
    tools.rewrite(outf, template%(version, version))
开发者ID:apolitis,项目名称:imp,代码行数:14,代码来源:make_module_version.py


示例16: writeKnownHostsFile

def writeKnownHostsFile(key):
    """
    Write host key ``key`` into `~/.ssh/known_hosts`.

    Args:
        key (str):  host key
    """
    sshDir = os.path.expanduser("~/.ssh")
    knownHostFile = os.path.join(sshDir, "known_hosts")
    if not os.path.isdir(sshDir):
        tools.mkdir(sshDir, 0o700)
    with open(knownHostFile, "at") as f:
        logger.info("Write host key to {}".format(knownHostFile))
        f.write(key + "\n")
开发者ID:bit-team,项目名称:backintime,代码行数:14,代码来源:sshtools.py


示例17: link_dox

def link_dox(source):
    target=os.path.join("doxygen")
    tools.mkdir(target)
    for module, g in tools.get_modules(source):
        tools.link_dir(os.path.join(g, "doc"), os.path.join(target, module))
        tools.link_dir(os.path.join(g, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf"],
                 clean=False)
        doxygenize_readme(os.path.join(g, "README.md"), "doxygen", module)
    for app, g in tools.get_applications(source):
        tools.link_dir(g, os.path.join(target, app))
        tools.link_dir(g, os.path.join("doc", "html"), match=["*.png", "*.pdf"], clean=False)
        doxygenize_readme(os.path.join(g, "README.md"), "doxygen", app)
    tools.link_dir(os.path.join(source, "doc"), os.path.join(target, "IMP"))
    tools.link_dir(os.path.join(source, "doc"), os.path.join("doc", "html"), match=["*.png", "*.pdf"],
             clean=False)
开发者ID:drussel,项目名称:imp,代码行数:15,代码来源:setup.py


示例18: download

    def download(self, fileCache=None, cacheDir=C.get('dirs.mdk')):
        """Download a plugin"""

        if fileCache == None:
            fileCache = C.get('plugins.fileCache')

        dest = os.path.abspath(os.path.expanduser(os.path.join(cacheDir, 'plugins')))
        if not fileCache:
            dest = gettempdir()

        if not 'downloadurl' in self.keys():
            raise ValueError('Expecting the key downloadurl')
        elif not 'component' in self.keys():
            raise ValueError('Expecting the key component')
        elif not 'branch' in self.keys():
            raise ValueError('Expecting the key branch')

        dl = self.get('downloadurl')
        plugin = self.get('component')
        branch = self.get('branch')
        target = os.path.join(dest, '%s-%d.zip' % (plugin, branch))
        md5sum = self.get('downloadmd5')
        release = self.get('release', 'Unknown')

        if fileCache:
            if not os.path.isdir(dest):
                logging.debug('Creating directory %s' % (dest))
                tools.mkdir(dest, 0777)

            if os.path.isfile(target) and (md5sum == None or tools.md5file(target) == md5sum):
                logging.info('Found cached plugin file: %s' % (os.path.basename(target)))
                return target

        logging.info('Downloading %s (%s)' % (plugin, release))
        if logging.getLogger().level <= logging.INFO:
            urlretrieve(dl, target, tools.downloadProcessHook)
            # Force a new line after the hook display
            logging.info('')
        else:
            urlretrieve(dl, target)

        # Highly memory inefficient MD5 check
        if md5sum and tools.md5file(target) != md5sum:
            os.remove(target)
            logging.warning('Bad MD5 sum on downloaded file')
            return False

        return target
开发者ID:andrewnicols,项目名称:mdk,代码行数:48,代码来源:plugins.py


示例19: main

def main():
    (options, args) = parser.parse_args()
    if not os.path.exists(os.path.join(options.source, "modules", options.module)):
        print("Skipping alias as original module not found")
        return
    print("Setting up alias for module", options.module, "as", options.alias)
    tools.mkdir("include/IMP/%s" % options.alias)
    tools.mkdir("include/IMP/%s/internal" % options.alias)
    var = {"module": options.module}
    if options.deprecate != "":
        var["deprecate"] = "IMP%s_DEPRECATED_HEADER(%s, \"%s\")" % (options.module.upper(),
                                                                    options.deprecate,
                                                                    "Use the one in IMP/%s instead." % options.module)
    else:
        var["deprecate"] = ""
    if options.alias == "":
        var["namespacebegin"] = "namespace IMP {"
        var["namespaceend"] = "}"
        var["slashalias"] = ""
    else:
        var["namespacebegin"] = "namespace IMP { namespace %s {" % options.alias
        var["namespaceend"] = "} }"
        var["slashalias"] = "/" + options.alias
    for h in tools.get_glob([os.path.join("include", "IMP", options.module, "*.h")]):
        if h.endswith("_config.h"):
            continue
        filename = os.path.split(h)[1]
        var["file"] = filename
        header = header_template % var
        tools.rewrite(
            "include/IMP%s/%s" %
            (var["slashalias"], filename), header)
    # Remove aliased header if the source header is gone
    for h in glob.glob("include/IMP%s/*.h" % var["slashalias"]):
        filename = os.path.split(h)[1]
        orig_filename = os.path.join("include", "IMP", options.module, filename)
        if not os.path.exists(orig_filename) \
           and not os.path.exists(h[:-2]): # Exclude all-module headers
            os.unlink(h)
    for h in tools.get_glob([os.path.join("include", "IMP", options.module, "internal", "*.h")]):
        filename = os.path.split(h)[1]
        var["file"] = filename
        header = internal_header_template % var
        tools.rewrite(
            "include/IMP/%s/internal/%s" %
            (options.alias, filename), header)
    allh = allh_template % var
    tools.rewrite("include/IMP%s.h" % var["slashalias"], allh)
开发者ID:newtonjoo,项目名称:imp,代码行数:48,代码来源:setup_module_alias.py


示例20: main

def main(argv=sys.argv):
    if len(argv) != 2:
        usage(argv)
    config_uri = argv[1]
    setup_logging(config_uri)
    settings = get_appsettings(config_uri)
    ziggurat_init(settings)    
    mkdir(settings['static_files'])
    # Insert data
    engine = engine_from_config(settings, 'sqlalchemy.')
    DBSession.configure(bind=engine)
    init_model()
    create_schemas(engine)
    Base.metadata.create_all(engine)
    initial_data.insert()
    transaction.commit()
开发者ID:aagusti,项目名称:opensipkd-reklame,代码行数:16,代码来源:initializedb.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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