当前位置: 首页>>代码示例>>Python>>正文


Python Installer.install_recipe方法代码示例

本文整理汇总了Python中installer.Installer.install_recipe方法的典型用法代码示例。如果您正苦于以下问题:Python Installer.install_recipe方法的具体用法?Python Installer.install_recipe怎么用?Python Installer.install_recipe使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在installer.Installer的用法示例。


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

示例1: GAEBuild

# 需要导入模块: from installer import Installer [as 别名]
# 或者: from installer.Installer import install_recipe [as 别名]
class GAEBuild(object):

    def __init__(self, buildout, name, options):
        self.log = logging.getLogger(name)
        self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)

        self.buildout, self.name, self.options = buildout, name, options
        options['location'] = os.path.join(
            buildout['buildout']['parts-directory'], name)
        options['bin-directory'] = buildout['buildout']['bin-directory']

        options.setdefault('project', 'example.com')
        options.setdefault('external-apps', 'apps')
        options.setdefault('local-apps', 'company')
        options.setdefault('settings', 'development')
        options.setdefault('libs-path', 'lib')
        options.setdefault('script-dir', 'bin')
        options.setdefault('turboengine', '')
        options.setdefault('webservices', 'false')
        options.setdefault('zipped', 'false')

        # Usefull when using archived versions
        buildout['buildout'].setdefault(
            'download-cache',
            os.path.join(buildout['buildout']['directory'],
                         'downloads'))
        
        self.__installer = Installer(self.options, self.buildout, self.log, self.name)


    def install(self):
        print '\n------------------ Installing GAEBuild ------------------\n'
        location = self.options['location']
        base_dir = self.buildout['buildout']['directory']
        project_dir = os.path.join(base_dir, 'src')
        download_dir = self.buildout['buildout']['download-cache']
        
        extra_path = self.__installer.get_extra_paths()
        requirements, ws = self.egg.working_set(['gaebuild'])
        
        self.__installer.verify_or_create_download_dir(download_dir)
        
        self.__installer.install_recipe(location)
        self.__installer.install_project(project_dir, self.options['project'])
        
        script_paths = self.__installer.install_scripts(project_dir, extra_path, ws)
        
        print '\n------------------ Installing GAEBuild ------------------\n'

        return script_paths + [location]

    def update(self):
        pass
开发者ID:carlitux,项目名称:gaebuild,代码行数:55,代码来源:gaebuild.py

示例2: DjBuild

# 需要导入模块: from installer import Installer [as 别名]
# 或者: from installer.Installer import install_recipe [as 别名]
class DjBuild(object):

    def __init__(self, buildout, name, options):
        self.log = logging.getLogger(name)
        self.egg = zc.recipe.egg.Egg(buildout, options['recipe'], options)

        self.buildout, self.name, self.options = buildout, name, options
        options['location'] = os.path.join(
            buildout['buildout']['parts-directory'], name)
        options['bin-directory'] = buildout['buildout']['bin-directory']

        options.setdefault('project', 'example.com')
        options.setdefault('external-apps', 'apps')
        options.setdefault('local-apps', 'company')
        options.setdefault('settings', 'development')

        options.setdefault('urlconf', options['project'] + '.urls')
        # Set this so the rest of the recipe can expect the values to be
        # there. We need to make sure that both pythonpath and extra-paths are
        # set for BBB.
        if 'extra-paths' in options:
            options['pythonpath'] = options['extra-paths']
        else:
            options.setdefault('extra-paths', options.get('pythonpath', ''))
            
        # Usefull when using archived versions
        buildout['buildout'].setdefault(
            'download-cache',
            os.path.join(buildout['buildout']['directory'],
                         'downloads'))

        # only try to download stuff if we aren't asked to install from cache
        self.install_from_cache = self.buildout['buildout'].get(
            'install-from-cache', '').strip() == 'true'
        
        self.__installer = Installer(self.options, self.buildout, self.log, self.name)


    def install(self):
        print '\n------------------ Installing DjBuild ------------------\n'
        version = self.options['version']
        location = self.options['location']
        base_dir = self.buildout['buildout']['directory']
        project_dir = os.path.join(base_dir, 'src')
        download_dir = self.buildout['buildout']['download-cache']
        
        # updating sys.path to find django settings
        sys.path.insert(0, project_dir)
        
        extra_path = self.__installer.get_extra_paths()
        requirements, ws = self.egg.working_set(['djbuild'])
        
        self.__installer.verify_or_create_download_dir(download_dir)
        self.__installer.remove_pre_existing_installation(location)
        
        self.__installer.install_django(version, download_dir, location, self.install_from_cache)
        self.__installer.install_recipe(location)
        self.__installer.install_project(project_dir, self.options['project'])
        
        script_paths = self.__installer.install_scripts(extra_path, ws)
        
        print '\n------------------ Installing DjBuild ------------------\n'

        return script_paths + [location]

    def update(self):
        pass
开发者ID:carlitux,项目名称:djbuild,代码行数:69,代码来源:djbuild.py


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