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

Python common.extract_dirs函数代码示例

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

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



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

示例1: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     
     if not options.outputdir:
         print >>sys.stderr, "Error: please give the output directory with '-d outputdir' argument"
         sys.exit(0)
     else:
         outputdir = options.outputdir
 
     if not args:
         apps = self.get_apps(global_options)
     else:
         apps = args
     if not os.path.exists(outputdir):
         os.makedirs(outputdir)
     for app in apps:
         dirs = app.split('.')
         mod = []
         dest = outputdir
         for m in dirs:
             mod.append(m)
             dest = os.path.join(dest, m)
             module = '.'.join(mod)
             if global_options.verbose:
                 print 'Export %s to %s ...' % (module, dest)
             if module == app:
                 recursion = True
             else:
                 recursion = False
             extract_dirs(module, '', dest, verbose=global_options.verbose, recursion=recursion)
开发者ID:chifeng,项目名称:uliweb,代码行数:30,代码来源:manage.py


示例2: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     from uliweb.core.template import template_file
     
     if not args:
         project_name = ''
         while not project_name:
             project_name = raw_input('Please enter project name:')
     else:
         project_name = args[0]
     
     ans = '-1'
     if os.path.exists(project_name):
         if options.force:
             ans = 'y'
         while ans not in ('y', 'n'):
             ans = raw_input('The project directory has been existed, do you want to overwrite it?(y/n)[n]')
             if not ans:
                 ans = 'n'
     else:
         ans = 'y'
     if ans == 'y':
         extract_dirs('uliweb', 'template_files/project', project_name, verbose=global_options.verbose)
         #template setup.py
         setup_file = os.path.join(project_name, 'setup.py')
         text = template_file(setup_file, {'project_name':project_name})
         with open(setup_file, 'w') as f:
             f.write(text)
         #rename .gitignore.template to .gitignore
         os.rename(os.path.join(project_name, '.gitignore.template'), os.path.join(project_name, '.gitignore'))
开发者ID:dtld,项目名称:uliweb,代码行数:30,代码来源:manage.py


示例3: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     from uliweb.core.template import template_file
     from uliweb.manage import make_simple_application
     from uliweb import settings
     from sqlalchemy import create_engine, MetaData, Table
     from shutil import rmtree
     from uliweb.orm import get_connection, engine_manager
     
     alembic_path = os.path.join(global_options.project, 'alembic', options.engine).replace('\\', '/')
     #delete alembic path
     if os.path.exists(alembic_path):
         rmtree(alembic_path, True)
     extract_dirs('uliweb.contrib.orm', 'templates/alembic', alembic_path, 
         verbose=global_options.verbose, replace=True)
     make_simple_application(project_dir=global_options.project,
         settings_file=global_options.settings,
         local_settings_file=global_options.local_settings)
     ini_file = os.path.join(alembic_path, 'alembic.ini')
     text = template_file(ini_file, 
         {'connection':engine_manager[options.engine].options.connection_string, 
         'engine_name':options.engine,
         'script_location':alembic_path})
     
     with open(ini_file, 'w') as f:
         f.write(text)
         
     #drop old alembic_version table
     db = get_connection(engine_name=options.engine)
     metadata = MetaData(db)
     if db.dialect.has_table(db.connect(), 'alembic_version'):
         version = Table('alembic_version', metadata, autoload=True) 
         version.drop()
开发者ID:chifeng,项目名称:uliweb,代码行数:33,代码来源:subcommands.py


示例4: handle

    def handle(self, options, global_options, *args):
        if not args:
            appname = ""
            while not appname:
                appname = raw_input("Please enter app name:")
        else:
            appname = args[0]

        ans = "-1"
        app_path = appname.replace(".", "//")
        if os.path.exists("apps"):
            path = os.path.join("apps", app_path)
        else:
            path = app_path

        if os.path.exists(path):
            while ans not in ("y", "n"):
                ans = raw_input("The app directory has been existed, do you want to overwrite it?(y/n)[n]")
                if not ans:
                    ans = "n"
        else:
            ans = "y"
        if ans == "y":
            from uliweb.utils.common import extract_dirs

            extract_dirs("uliweb", "template_files/app", path, verbose=global_options.verbose)
开发者ID:victorlv,项目名称:uliweb,代码行数:26,代码来源:manage.py


示例5: handle

    def handle(self, options, global_options, *args):
        from uliweb.utils.common import extract_dirs
        from uliweb.core.template import template_file

        if not args:
            project_name = ""
            while not project_name:
                project_name = raw_input("Please enter project name:")
        else:
            project_name = args[0]

        ans = "-1"
        if os.path.exists(project_name):
            if options.force:
                ans = "y"
            while ans not in ("y", "n"):
                ans = raw_input("The project directory has been existed, do you want to overwrite it?(y/n)[n]")
                if not ans:
                    ans = "n"
        else:
            ans = "y"
        if ans == "y":
            extract_dirs("uliweb", "template_files/project", project_name, verbose=global_options.verbose)
            # template setup.py
            setup_file = os.path.join(project_name, "setup.py")
            text = template_file(setup_file, {"project_name": project_name})
            with open(setup_file, "w") as f:
                f.write(text)
            # rename .gitignore.template to .gitignore
            os.rename(os.path.join(project_name, ".gitignore.template"), os.path.join(project_name, ".gitignore"))
开发者ID:08haozi,项目名称:uliweb,代码行数:30,代码来源:manage.py


示例6: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs, pkg
     from uliweb.core.template import template_file
     
     extract_dirs('uliweb.contrib.orm', 'templates/alembic', '.', verbose=global_options.verbose, replace=False)
     engine_string = get_engine(options, global_options)
     ini_file = os.path.join(pkg.resource_filename('uliweb.contrib.orm', 'templates/alembic/alembic.ini'))
     text = template_file(ini_file, {'CONNECTION':engine_string})
     with open(os.path.join(global_options.project, 'alembic.ini'), 'w') as f:
         f.write(text)
开发者ID:bobgao,项目名称:uliweb,代码行数:10,代码来源:commands.py


示例7: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     
     _types = ['gae', 'dotcloud', 'sae', 'bae', 'fcgi', 'heroku', 'tornado', 'gevent', 'gevent-socketio']
     support_type = args[0] if args else ''
     while not support_type in _types and support_type != 'quit':
         print 'Supported types:\n'
         print '    ' + '\n    '.join(_types)
         print
         support_type = raw_input('Please enter support type[quit to exit]:')
     
     if support_type != 'quit':
         extract_dirs('uliweb', 'template_files/support/%s' % support_type, '.', verbose=global_options.verbose)
开发者ID:ArikaChen,项目名称:uliweb,代码行数:13,代码来源:manage.py


示例8: handle

 def handle(self, options, global_options, *args):
     from uliweb.utils.common import extract_dirs
     
     if not args:
         project_name = ''
         while not project_name:
             project_name = raw_input('Please enter project name:')
     else:
         project_name = args[0]
     
     ans = '-1'
     if os.path.exists(project_name):
         while ans not in ('y', 'n'):
             ans = raw_input('The project directory has been existed, do you want to overwrite it?(y/n)[n]')
             if not ans:
                 ans = 'n'
     else:
         ans = 'y'
     if ans == 'y':
         extract_dirs('uliweb', 'template_files/project', project_name, verbose=global_options.verbose)
开发者ID:jamiesun,项目名称:uliweb,代码行数:20,代码来源:manage.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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