aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2020-02-16 10:19:40 -0500
committerJason R. Coombs <jaraco@jaraco.com>2020-02-16 11:04:57 -0500
commit7bb73a477de24069002516eb6eb1d755bed9d65b (patch)
tree5a99e69846a4d5bf771a15273714c333f6e4cb5b
parent43edec2506f901ab939390951383025682448edd (diff)
downloadexternal_python_setuptools-feature/implicit-bootstrap.tar.gz
external_python_setuptools-feature/implicit-bootstrap.tar.bz2
external_python_setuptools-feature/implicit-bootstrap.zip
Bootstrap the package unconditionally in setup.py. Fixes #2001.feature/implicit-bootstrap
-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 8fa9e4b5..43c7b2b2 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,16 +1,14 @@
"""
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.
"""
from __future__ import unicode_literals
import os
-import sys
import textwrap
-import subprocess
import io
@@ -33,27 +31,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 b92b50cc..965ee264 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 277b6640..7d6bd06b 100755
--- a/setup.py
+++ b/setup.py
@@ -7,21 +7,11 @@ import os
import sys
import setuptools
+import bootstrap
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'
@@ -151,5 +141,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 9fe4f905..3a66b05d 100644
--- a/tools/tox_pip.py
+++ b/tools/tox_pip.py
@@ -15,12 +15,6 @@ def remove_setuptools():
subprocess.check_call(cmd, cwd='.tox')
-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 .?
@@ -72,7 +66,6 @@ def run(args):
if is_install_self(args):
remove_setuptools()
- bootstrap()
sys.version_info > (3,) or disable_python_requires()
pip(*args)