예제 #1
0
    def _prepare_bootstrap(self):
        from . import vendor

        vendor.vendor_runtime(
            chroot=self._chroot,
            dest_basedir=BOOTSTRAP_DIR,
            label="bootstrap",
            # NB: We use pip here in the builder, but that's only at buildtime and
            # although we don't use pyparsing directly, packaging.markers, which we
            # do use at runtime, does.
            root_module_names=["packaging", "pkg_resources", "pyparsing"],
        )

        source_name = "pex"
        provider = get_provider(source_name)
        if not isinstance(provider, DefaultProvider):
            mod = __import__(source_name, fromlist=["ignore"])
            provider = ZipProvider(mod)

        bootstrap_packages = ["", "third_party"]
        if self._include_tools:
            bootstrap_packages.extend(["tools", "tools/commands"])
        for package in bootstrap_packages:
            for fn in provider.resource_listdir(package):
                if not (provider.resource_isdir(os.path.join(package, fn))
                        or fn.endswith(".pyc")):
                    rel_path = os.path.join(package, fn)
                    self._chroot.write(
                        provider.get_resource_string(source_name, rel_path),
                        os.path.join(BOOTSTRAP_DIR, source_name, rel_path),
                        "bootstrap",
                    )
예제 #2
0
파일: pex_builder.py 프로젝트: smezouar/pex
  def _prepare_bootstrap(self):
    from . import vendor
    vendor.vendor_runtime(chroot=self._chroot,
                          dest_basedir=BOOTSTRAP_DIR,
                          label='bootstrap',
                          # NB: We use pip here in the builder, but that's only at buildtime and
                          # although we don't use pyparsing directly, packaging.markers, which we
                          # do use at runtime, does.
                          root_module_names=['packaging', 'pkg_resources', 'pyparsing'])

    source_name = 'pex'
    provider = get_provider(source_name)
    if not isinstance(provider, DefaultProvider):
      mod = __import__(source_name, fromlist=['ignore'])
      provider = ZipProvider(mod)
    for package in ('', 'third_party'):
      for fn in provider.resource_listdir(package):
        if fn.endswith('.py'):
          rel_path = os.path.join(package, fn)
          self._chroot.write(provider.get_resource_string(source_name, rel_path),
                             os.path.join(BOOTSTRAP_DIR, source_name, rel_path), 'bootstrap')

    # Setup a re-director package to support the legacy pex runtime `_pex` APIs through a
    # VendorImporter.
    self._chroot.touch(os.path.join(BOOTSTRAP_DIR, LEGACY_BOOSTRAP_PKG, '__init__.py'), 'bootstrap')
예제 #3
0
파일: pex_builder.py 프로젝트: jjhelmus/pex
    def _prepare_bootstrap(self):
        from . import vendor

        vendor.vendor_runtime(
            chroot=self._chroot,
            dest_basedir=self._pex_info.bootstrap,
            label="bootstrap",
            # NB: We use pip here in the builder, but that's only at buildtime and
            # although we don't use pyparsing directly, packaging.markers, which we
            # do use at runtime, does.
            root_module_names=[
                "attr", "packaging", "pkg_resources", "pyparsing"
            ],
        )
        if self._include_tools:
            # The `repository extract` tool needs setuptools and wheel to build sdists and wheels
            # and distutils needs .dist-info to discover setuptools (and wheel).
            vendor.vendor_runtime(
                chroot=self._chroot,
                dest_basedir=self._pex_info.bootstrap,
                label="bootstrap",
                root_module_names=["setuptools", "wheel"],
                include_dist_info=True,
            )

        source_name = "pex"
        provider = get_provider(source_name)
        if not isinstance(provider, DefaultProvider):
            mod = __import__(source_name, fromlist=["ignore"])
            provider = ZipProvider(mod)

        bootstrap_packages = ["", "third_party"]
        if self._include_tools:
            bootstrap_packages.extend(["tools", "tools/commands"])
        for package in bootstrap_packages:
            for fn in provider.resource_listdir(package):
                if not (provider.resource_isdir(os.path.join(package, fn))
                        or fn.endswith(".pyc")):
                    rel_path = os.path.join(package, fn)
                    self._chroot.write(
                        provider.get_resource_string(source_name, rel_path),
                        os.path.join(self._pex_info.bootstrap, source_name,
                                     rel_path),
                        "bootstrap",
                    )
예제 #4
0
파일: pex_builder.py 프로젝트: jsirois/pex
  def _prepare_bootstrap(self):
    from . import vendor
    vendor.vendor_runtime(chroot=self._chroot,
                          dest_basedir=BOOTSTRAP_DIR,
                          label='bootstrap',
                          # NB: We use wheel here in the builder, but that's only at build-time.
                          root_module_names=['pkg_resources'])

    source_name = 'pex'
    provider = get_provider(source_name)
    if not isinstance(provider, DefaultProvider):
      mod = __import__(source_name, fromlist=['ignore'])
      provider = ZipProvider(mod)
    for package in ('', 'third_party'):
      for fn in provider.resource_listdir(package):
        if fn.endswith('.py'):
          rel_path = os.path.join(package, fn)
          self._chroot.write(provider.get_resource_string(source_name, rel_path),
                             os.path.join(BOOTSTRAP_DIR, source_name, rel_path), 'bootstrap')

    # Setup a re-director package to support the legacy pex runtime `_pex` APIs through a
    # VendorImporter.
    self._chroot.touch(os.path.join(BOOTSTRAP_DIR, LEGACY_BOOSTRAP_PKG, '__init__.py'), 'bootstrap')