def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ setuptools = dist_from_egg( self._interpreter.get_location('setuptools')) for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn == 'pkg_resources.py': self._chroot.write( content_stream.read(), os.path.join(self.BOOTSTRAP_DIR, 'pkg_resources.py'), 'resource') libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write( provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')
def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ wrote_setuptools = False setuptools = DistributionHelper.distribution_from_path( self._interpreter.get_location('setuptools')) for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn == 'pkg_resources.py' or fn.startswith('_markerlib'): self._chroot.write(content_stream.read(), os.path.join(self.BOOTSTRAP_DIR, fn), 'resource') wrote_setuptools = True if not wrote_setuptools: raise RuntimeError( 'Failed to extract pkg_resources from setuptools. Perhaps pants was linked with an ' 'incompatible setuptools.') libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write(provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')
def _prepare_bootstrap(self): # Writes enough of setuptools into the .pex .bootstrap directory so that we can be fully # self-contained. wrote_setuptools = False setuptools = DistributionHelper.distribution_from_path( self._interpreter.get_location('setuptools'), name='setuptools') if setuptools is None: raise RuntimeError('Failed to find setuptools while building pex!') for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn.startswith('pkg_resources') or fn.startswith('_markerlib'): self._chroot.write(content_stream.read(), os.path.join(self.BOOTSTRAP_DIR, fn), 'resource') wrote_setuptools = True if not wrote_setuptools: raise RuntimeError( 'Failed to extract pkg_resources from setuptools. Perhaps pants was linked with an ' 'incompatible setuptools.') libraries = { 'pex': '_pex', } for source_name, target_location in libraries.items(): provider = get_provider(source_name) if not isinstance(provider, DefaultProvider): mod = __import__(source_name, fromlist=['ignore']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write(provider.get_resource_string(source_name, fn), os.path.join(self.BOOTSTRAP_DIR, target_location, fn), 'resource')
def _prepare_bootstrap(self): # Writes enough of setuptools into the .pex .bootstrap directory so that we can be fully # self-contained. libraries = { 'pex': '_pex', } for source_name, target_location in libraries.items(): provider = get_provider(source_name) if not isinstance(provider, DefaultProvider): mod = __import__(source_name, fromlist=['ignore']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write(provider.get_resource_string(source_name, fn), os.path.join(self.BOOTSTRAP_DIR, target_location, fn), 'bootstrap')
def _prepare_bootstrap(self): # Writes enough of setuptools into the .pex .bootstrap directory so that we can be fully # self-contained. wrote_setuptools = False setuptools_location = self._interpreter.get_location('setuptools') if setuptools_location is None: raise RuntimeError( 'Failed to find setuptools via %s while building pex!' % self._interpreter.binary) setuptools = DistributionHelper.distribution_from_path( setuptools_location, name='setuptools') if setuptools is None: raise RuntimeError( 'Failed to find setuptools via %s while building pex!' % self._interpreter.binary) for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn.startswith('pkg_resources') or fn.startswith('_markerlib'): if not fn.endswith( '.pyc'): # We'll compile our own .pyc's later. dst = os.path.join(self.BOOTSTRAP_DIR, fn) self._chroot.write(content_stream.read(), dst, 'bootstrap') wrote_setuptools = True if not wrote_setuptools: raise RuntimeError( 'Failed to extract pkg_resources from setuptools. Perhaps pants was linked with an ' 'incompatible setuptools.') libraries = { 'pex': '_pex', } for source_name, target_location in libraries.items(): provider = get_provider(source_name) if not isinstance(provider, DefaultProvider): mod = __import__(source_name, fromlist=['ignore']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write( provider.get_resource_string(source_name, fn), os.path.join(self.BOOTSTRAP_DIR, target_location, fn), 'bootstrap')
def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ wrote_setuptools = False setuptools = DistributionHelper.distribution_from_path( self._interpreter.get_location('setuptools'), name='setuptools') if setuptools is None: raise RuntimeError('Failed to find setuptools while building pex!') for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn == 'pkg_resources.py' or fn.startswith('_markerlib'): self._chroot.write(content_stream.read(), os.path.join(self.BOOTSTRAP_DIR, fn), 'resource') wrote_setuptools = True if not wrote_setuptools: raise RuntimeError( 'Failed to extract pkg_resources from setuptools. Perhaps pants was linked with an ' 'incompatible setuptools.') libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write( provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')
def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write(provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')
def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write( provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')
def _prepare_bootstrap(self): """ Write enough of distribute into the .pex .bootstrap directory so that we can be fully self-contained. """ setuptools = dist_from_egg(self._interpreter.get_location('setuptools')) for fn, content_stream in DistributionHelper.walk_data(setuptools): if fn == 'pkg_resources.py': self._chroot.write(content_stream.read(), os.path.join(self.BOOTSTRAP_DIR, 'pkg_resources.py'), 'resource') libraries = ( 'twitter.common.python', 'twitter.common.python.http', ) for name in libraries: dirname = name.replace('twitter.common.python', '_twitter_common_python').replace('.', '/') provider = get_provider(name) if not isinstance(provider, DefaultProvider): mod = __import__(name, fromlist=['wutttt']) provider = ZipProvider(mod) for fn in provider.resource_listdir(''): if fn.endswith('.py'): self._chroot.write(provider.get_resource_string(name, fn), os.path.join(self.BOOTSTRAP_DIR, dirname, fn), 'resource')