summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bootstrap.py20
-rw-r--r--docs/conf.py12
-rwxr-xr-xsetup.py14
-rw-r--r--tools/tox_pip.py7
4 files changed, 6 insertions, 47 deletions
diff --git a/bootstrap.py b/bootstrap.py
index 118671f6..25783e69 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,14 +1,12 @@
"""
If setuptools is not already installed in the environment, it's not possible
to invoke setuptools' own commands. This routine will bootstrap this local
-environment by creating a minimal egg-info directory and then invoking the
-egg-info command to flesh out the egg-info directory.
+environment by creating a minimal egg-info directory sufficient for
+setuptools to build its own egg-info.
"""
import os
-import sys
import textwrap
-import subprocess
import io
@@ -31,27 +29,17 @@ minimal_egg_info = textwrap.dedent("""
def ensure_egg_info():
- if os.path.exists('setuptools.egg-info'):
- return
- print("adding minimal entry_points")
- add_minimal_info()
- run_egg_info()
+ os.path.exists('setuptools.egg-info') or add_minimal_info()
def add_minimal_info():
"""
Build a minimal egg-info, enough to invoke egg_info
"""
-
+ print("Adding minimal entry_points.")
os.mkdir('setuptools.egg-info')
with io.open('setuptools.egg-info/entry_points.txt', 'w') as ep:
ep.write(minimal_egg_info)
-def run_egg_info():
- cmd = [sys.executable, 'setup.py', 'egg_info']
- print("Regenerating egg_info")
- subprocess.check_call(cmd)
-
-
__name__ == '__main__' and ensure_egg_info()
diff --git a/docs/conf.py b/docs/conf.py
index 12520586..64d0c61e 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,15 +1,3 @@
-import subprocess
-import sys
-import os
-
-
-# hack to run the bootstrap script so that jaraco.packaging.sphinx
-# can invoke setup.py
-'READTHEDOCS' in os.environ and subprocess.check_call(
- [sys.executable, '-m', 'bootstrap'],
- cwd=os.path.join(os.path.dirname(__file__), os.path.pardir),
-)
-
# -- General configuration --
extensions = ['jaraco.packaging.sphinx', 'rst.linker']
diff --git a/setup.py b/setup.py
index 2bd48daa..0dab158d 100755
--- a/setup.py
+++ b/setup.py
@@ -7,23 +7,13 @@ import os
import sys
import textwrap
+import bootstrap
import setuptools
from setuptools.command.install import install
here = os.path.dirname(__file__)
-def require_metadata():
- "Prevent improper installs without necessary metadata. See #659"
- egg_info_dir = os.path.join(here, 'setuptools.egg-info')
- if not os.path.exists(egg_info_dir):
- msg = (
- "Cannot build setuptools without metadata. "
- "Run `bootstrap.py`."
- )
- raise RuntimeError(msg)
-
-
def read_commands():
command_ns = {}
cmd_module_path = 'setuptools/command/__init__.py'
@@ -192,5 +182,5 @@ setup_params = dict(
if __name__ == '__main__':
# allow setup.py to run from another directory
here and os.chdir(here)
- require_metadata()
+ bootstrap.ensure_egg_info()
dist = setuptools.setup(**setup_params)
diff --git a/tools/tox_pip.py b/tools/tox_pip.py
index be2ff1d0..9abba603 100644
--- a/tools/tox_pip.py
+++ b/tools/tox_pip.py
@@ -15,12 +15,6 @@ def remove_setuptools():
subprocess.check_call(cmd, cwd=os.environ['TOX_WORK_DIR'])
-def bootstrap():
- print("Running bootstrap")
- cmd = [sys.executable, '-m', 'bootstrap']
- subprocess.check_call(cmd)
-
-
def is_install_self(args):
"""
Do the args represent an install of .?
@@ -61,7 +55,6 @@ def run(args):
if is_install_self(args):
remove_setuptools()
- bootstrap()
pip(*args)