def _import_pkg_resources(): try: import pkg_resources # vendor:skip return pkg_resources, False except ImportError: from pex import third_party third_party.install(expose=['setuptools']) import pkg_resources # vendor:skip return pkg_resources, True
def bootstrap_script(self): return """ import sys sys.path.insert(0, {root!r}) # Expose vendored mixin path_items (setuptools, wheel, etc.) directly to the package's setup.py. from pex import third_party third_party.install(root={root!r}, expose={mixins!r}) # Now execute the package's setup.py such that it sees itself as a setup.py executed via # `python setup.py ...` __file__ = 'setup.py' sys.argv[0] = __file__ with open(__file__, 'rb') as fp: exec(fp.read()) """.format(root=third_party.isolated(), mixins=self.mixins)
# `setup.py` dir is on the path and we're working from here so that dist/ and build/ dirs get # created here and all files indicated by MANIFEST.in are found. __HERE = os.path.realpath(os.path.dirname(__file__)) os.chdir(__HERE) with open(os.path.join(__HERE, 'README.rst')) as fp: LONG_DESCRIPTION = fp.read() + '\n' with open(os.path.join(__HERE, 'CHANGES.rst')) as fp: LONG_DESCRIPTION += fp.read() from pex import third_party third_party.install(expose=['setuptools', 'wheel']) from pex.third_party.setuptools import find_packages, setup from pex.commands.bdist_pex import bdist_pex from pex.version import __version__ setup( name='pex', version=__version__, description="The PEX packaging toolchain.", long_description=LONG_DESCRIPTION, long_description_content_type="text/x-rst", url='https://github.com/pantsbuild/pex', license='Apache License, Version 2.0',