Example #1
0
    def _install_setuptools_and_zc_buildout(self):
        from os.path import join, exists
        from os import environ, remove

        with utils.open_buildout_configfile() as buildout:
            cachedir = buildout.get("buildout", "download-cache")
        cache_dist = join(cachedir, "dist")

        cmd = []
        packages = []

        # in case dependencies are frozen, we need to use the frozen version of setuptools and zc.buildout
        with utils.open_buildout_configfile() as buildout:
            for package in ['setuptools', 'zc.buildout', 'pip']:
                if buildout.has_option("versions", package):
                    packages += [
                        '{}=={}'.format(package,
                                        buildout.get("versions", package))
                    ]
                else:
                    packages += [package]

        env = environ.copy()
        env['PYTHONPATH'] = ''
        utils.execute_assert_success([
            utils.get_isolated_executable('python'), 'get-pip.py',
            '--prefix=%s' % join('parts', 'python')
        ] + packages,
                                     env=env)
        remove('get-pip.py')
        utils.execute_assert_success([
            utils.get_isolated_executable('pip'), 'download', '--dest',
            cache_dist
        ] + packages,
                                     env=env)
Example #2
0
 def install_isolated_python_if_necessary(self):
     from os import environ
     if not self.arguments.get("--use-isolated-python", False):
         return
     self._remove_setuptools_egg_link()
     if not assertions.is_isolated_python_exists() or self.arguments.get("--newest", False):
         with utils.buildout_parameters_context(['buildout:develop=', 'buildout:versions=no', 'no:key=value']):
             utils.execute_with_buildout("install {}".format(self.get_isolated_python_section_name()))
     self._get_pip()
     self._install_setuptools_and_zc_buildout()
     env = environ.copy()
     env['PYTHONPATH'] = ''
     utils.execute_assert_success([utils.get_isolated_executable('buildout'), 'bootstrap'], env=env)
Example #3
0
 def install_isolated_python_if_necessary(self):
     from os import environ
     if not self.arguments.get("--use-isolated-python", False):
         return
     self._remove_setuptools_egg_link()
     if not assertions.is_isolated_python_exists() or self.arguments.get("--newest", False):
         with utils.buildout_parameters_context(['buildout:develop=', 'buildout:versions=no', 'no:key=value']):
             utils.execute_with_buildout("install {}".format(self.get_isolated_python_section_name()))
     self._get_pip()
     self._install_setuptools_and_zc_buildout()
     env = environ.copy()
     env['PYTHONPATH'] = ''
     utils.execute_assert_success([utils.get_isolated_executable('buildout'), 'bootstrap'], env=env)
Example #4
0
    def _install_setuptools_and_zc_buildout(self):
        from os.path import join, exists
        from os import environ, remove

        with utils.open_buildout_configfile() as buildout:
            cachedir = buildout.get("buildout", "download-cache")
        cache_dist = join(cachedir, "dist")

        cmd = []
        packages = []

        # in case dependencies are frozen, we need to use the frozen version of setuptools and zc.buildout
        with utils.open_buildout_configfile() as buildout:
            for package in ['setuptools', 'zc.buildout', 'pip']:
                if buildout.has_option("versions", package):
                    packages += ['{}=={}'.format(package, buildout.get("versions", package))]
                else:
                    packages += [package]

        env = environ.copy()
        env['PYTHONPATH'] = ''
        utils.execute_assert_success([utils.get_isolated_executable('python'), 'get-pip.py', '--prefix=%s' % join('parts', 'python')] + packages, env=env)
        remove('get-pip.py')
        utils.execute_assert_success([utils.get_isolated_executable('python'), '-m', 'pip', 'download', '--dest', cache_dist] + packages, env=env)