當前位置: 首頁>>代碼示例>>Python>>正文


Python Installer.verify_or_create_download_dir方法代碼示例

本文整理匯總了Python中installer.Installer.verify_or_create_download_dir方法的典型用法代碼示例。如果您正苦於以下問題:Python Installer.verify_or_create_download_dir方法的具體用法?Python Installer.verify_or_create_download_dir怎麽用?Python Installer.verify_or_create_download_dir使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在installer.Installer的用法示例。


在下文中一共展示了Installer.verify_or_create_download_dir方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: GAEBuild

# 需要導入模塊: from installer import Installer [as 別名]
# 或者: from installer.Installer import verify_or_create_download_dir [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 verify_or_create_download_dir [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.verify_or_create_download_dir方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。