def _load_protected_extensions(buildout):
    if not buildout: return
    specs = buildout['buildout'].get('protected-extensions', '').split()
    if specs:
        path = [buildout['buildout']['develop-eggs-directory']]
        if buildout['buildout']['offline'] == 'true':
            dest = None
            path.append(buildout['buildout']['eggs-directory'])
        else:
            dest = buildout['buildout']['eggs-directory']
            if not os.path.exists(dest):
                log.info('Creating directory %r.' % dest)
                os.mkdir(dest)

        easy_install.install(
            specs, dest, path=path,
            working_set=pkg_resources.working_set,
            links = buildout['buildout'].get('find-links', '').split(),
            index = buildout['buildout'].get('index'),
            newest=buildout.newest, allow_hosts=buildout._allow_hosts,
        )

        # Clear cache because extensions might now let us read pages we
        # couldn't read before.
        easy_install.clear_index_cache()
Example #2
0
def install(modules, path='parts'):
    '''
    Install module in given path
    Module should be dictionary object, returned by xmlrpc server pypi:
    Example:
        {'_pypi_ordering': 16,
         'name': 'django-tools',
         'summary': 'miscellaneous tools for django',
         'version': '0.10.0.git-ce3ec2d',
    }
    Returns WorkingSet object, 
    see
        http://peak.telecommunity.com/DevCenter/PkgResources#workingset-objects
    terminology:
         http://mail.python.org/pipermail/distutils-sig/2005-June/004652.html
    '''

    path = os.path.abspath(path)
    if not os.path.exists(path):
        os.makedirs(path)

    # TODO: If traceback risen here, installation of the all package list fails
    return easy_install.install(['%s==%s' % (module_['name'], module_['version'])
        for module_ in modules], path,
        index=getattr(settings, 'CUSTOM_PACKAGE_INDEX', None),
        use_dependency_links=False)
Example #3
0
 def install(self, *distributions):
     buildout = self.original.buildout
     python = buildout['buildout']['python']
     executable = buildout[python]['executable']
     if 'find-links' in buildout['buildout']:
         links = buildout['buildout']['find-links'].split()
     else:
         links = ()
     index = buildout.get('index', None)
     if buildout.get('offline') != 'true':
         easy_install.install(
             distributions,
             buildout['buildout']['eggs-directory'],
             links=links,
             index=index,
             executable=executable,
             always_unzip=True,
             path=[buildout['buildout']['develop-eggs-directory']],
             newest=buildout.get('newest', 'false') == 'true',
             )
Example #4
0
def install_projects(projects, target_dir):
    links = []
    for project in projects:
        project_dir = os.path.join(projects_dir, project)
        dist_dir = os.path.join(project_dir, 'dist')
        if os.path.isdir(dist_dir):
            testing.rmdir(dist_dir)
        dummy = testing.system("%s setup %s bdist_egg" % (
                os.path.join('bin', 'buildout'), project_dir))
        links.append(dist_dir)

    new_working_set = install(projects, target_dir, links=links,
                              working_set=working_set)

    # we must perform a magical incantation on each distribution
    for dist in new_working_set:
        dist.activate()
    return new_working_set
Example #5
0
def install_projects(projects, target_dir):
    links = []
    for project in projects:
        project_dir = os.path.join(projects_dir, project)
        dist_dir = os.path.join(project_dir, 'dist')
        if os.path.isdir(dist_dir):
            testing.rmdir(dist_dir)
        dummy = testing.system("%s setup %s bdist_egg" %
                               (os.path.join('bin', 'buildout'), project_dir))
        links.append(dist_dir)

    new_working_set = install(projects,
                              target_dir,
                              links=links,
                              working_set=working_set)

    # we must perform a magical incantation on each distribution
    for dist in new_working_set:
        dist.activate()
    return new_working_set