summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason R. Coombs <jaraco@jaraco.com>2021-02-20 12:41:04 -0500
committerGitHub <noreply@github.com>2021-02-20 12:41:04 -0500
commit9aee3bf752e0b052b6a6fbc01d56c3a49ccf0938 (patch)
tree4f23278b9f1f47eecd042da35fca840d7f76d61d
parent23cae26198fdda29e75cd0c1076ad601b0532d6b (diff)
parentd31f7f0c3d72482db7c2aebbfdb2e56ab81b817b (diff)
downloadpython-setuptools-git-9aee3bf752e0b052b6a6fbc01d56c3a49ccf0938.tar.gz
Merge branch 'main' into jaraco-path-build
-rw-r--r--.bumpversion.cfg2
-rw-r--r--CHANGES.rst9
-rw-r--r--bootstrap.py56
-rw-r--r--changelog.d/2573.change.rst2
-rw-r--r--docs/conf.py16
-rw-r--r--pyproject.toml1
-rw-r--r--setup.cfg3
-rwxr-xr-xsetup.py12
-rw-r--r--setuptools/command/upload_docs.py8
-rw-r--r--setuptools/tests/requirements.txt1
-rw-r--r--setuptools/tests/test_sphinx_upload_docs.py41
-rw-r--r--tools/tox_pip.py70
-rw-r--r--tox.ini6
13 files changed, 63 insertions, 164 deletions
diff --git a/.bumpversion.cfg b/.bumpversion.cfg
index c3bdafab..d1195259 100644
--- a/.bumpversion.cfg
+++ b/.bumpversion.cfg
@@ -1,5 +1,5 @@
[bumpversion]
-current_version = 52.0.0
+current_version = 53.0.0
commit = True
tag = True
diff --git a/CHANGES.rst b/CHANGES.rst
index 79941d8e..93eae687 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -1,3 +1,12 @@
+v53.0.0
+-------
+
+
+Breaking Changes
+^^^^^^^^^^^^^^^^
+* #1527: Removed bootstrap script. Now Setuptools requires pip or another pep517-compliant builder such as 'build' to build. Now Setuptools can be installed from Github main branch.
+
+
v52.0.0
-------
diff --git a/bootstrap.py b/bootstrap.py
index 118671f6..229b9965 100644
--- a/bootstrap.py
+++ b/bootstrap.py
@@ -1,57 +1,7 @@
-"""
-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.
-"""
+import warnings
-import os
-import sys
-import textwrap
-import subprocess
-import io
+msg = "bootstrap.py is no longer needed. Use a PEP-517-compatible builder instead."
-minimal_egg_info = textwrap.dedent("""
- [distutils.commands]
- egg_info = setuptools.command.egg_info:egg_info
- [distutils.setup_keywords]
- include_package_data = setuptools.dist:assert_bool
- install_requires = setuptools.dist:check_requirements
- extras_require = setuptools.dist:check_extras
- entry_points = setuptools.dist:check_entry_points
-
- [egg_info.writers]
- PKG-INFO = setuptools.command.egg_info:write_pkg_info
- dependency_links.txt = setuptools.command.egg_info:overwrite_arg
- entry_points.txt = setuptools.command.egg_info:write_entries
- requires.txt = setuptools.command.egg_info:write_requirements
- """)
-
-
-def ensure_egg_info():
- if os.path.exists('setuptools.egg-info'):
- return
- print("adding minimal entry_points")
- add_minimal_info()
- run_egg_info()
-
-
-def add_minimal_info():
- """
- Build a minimal egg-info, enough to invoke egg_info
- """
-
- 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()
+__name__ == '__main__' and warnings.warn(msg)
diff --git a/changelog.d/2573.change.rst b/changelog.d/2573.change.rst
new file mode 100644
index 00000000..b06bd8c9
--- /dev/null
+++ b/changelog.d/2573.change.rst
@@ -0,0 +1,2 @@
+Fixed error in uploading a Sphinx doc with the :code:`upload_docs` command. An html builder will be used.
+Note: :code:`upload_docs` is deprecated for PyPi, but is supported for other sites -- by :user:`melissa-kun-li` \ No newline at end of file
diff --git a/docs/conf.py b/docs/conf.py
index 8cb959df..18cd7bdc 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -1,11 +1,3 @@
-#!/usr/bin/env python3
-# -*- coding: utf-8 -*-
-
-import subprocess
-import sys
-import os
-
-
extensions = ['sphinx.ext.autodoc', 'jaraco.packaging.sphinx', 'rst.linker']
master_doc = "index"
@@ -82,14 +74,6 @@ link_files = {
}
-# 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),
-)
-
-
# Add support for linking usernames
github_url = 'https://github.com'
github_sponsors_url = f'{github_url}/sponsors'
diff --git a/pyproject.toml b/pyproject.toml
index 4e80bdc1..414ffed5 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -1,6 +1,5 @@
[build-system]
requires = [
- # avoid self install on Python 2; ref #1996
"setuptools >= 40.8; python_version > '3'",
"wheel",
]
diff --git a/setup.cfg b/setup.cfg
index a3b9ca1b..0cdbb1ea 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -2,7 +2,7 @@
license_files =
LICENSE
name = setuptools
-version = 52.0.0
+version = 53.0.0
author = Python Packaging Authority
author_email = distutils-sig@python.org
description = Easily download, build, install, upgrade, and uninstall Python packages
@@ -58,6 +58,7 @@ testing =
pip>=19.1 # For proper file:// URLs support.
jaraco.envs
pytest-xdist
+ sphinx
jaraco.path>=3.2.0
docs =
diff --git a/setup.py b/setup.py
index 31eda0fb..f5cbff31 100755
--- a/setup.py
+++ b/setup.py
@@ -10,17 +10,6 @@ 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'
@@ -170,5 +159,4 @@ setup_params = dict(
if __name__ == '__main__':
# allow setup.py to run from another directory
here and os.chdir(here)
- require_metadata()
dist = setuptools.setup(**setup_params)
diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py
index 2559458a..845bff44 100644
--- a/setuptools/command/upload_docs.py
+++ b/setuptools/command/upload_docs.py
@@ -2,7 +2,7 @@
"""upload_docs
Implements a Distutils 'upload_docs' subcommand (upload documentation to
-PyPI's pythonhosted.org).
+sites other than PyPi such as devpi).
"""
from base64 import standard_b64encode
@@ -31,7 +31,7 @@ class upload_docs(upload):
# supported by Warehouse (and won't be).
DEFAULT_REPOSITORY = 'https://pypi.python.org/pypi/'
- description = 'Upload documentation to PyPI'
+ description = 'Upload documentation to sites other than PyPi such as devpi'
user_options = [
('repository=', 'r',
@@ -59,7 +59,7 @@ class upload_docs(upload):
if self.upload_dir is None:
if self.has_sphinx():
build_sphinx = self.get_finalized_command('build_sphinx')
- self.target_dir = build_sphinx.builder_target_dir
+ self.target_dir = dict(build_sphinx.builder_target_dirs)['html']
else:
build = self.get_finalized_command('build')
self.target_dir = os.path.join(build.build_base, 'docs')
@@ -67,7 +67,7 @@ class upload_docs(upload):
self.ensure_dirname('upload_dir')
self.target_dir = self.upload_dir
if 'pypi.python.org' in self.repository:
- log.warn("Upload_docs command is deprecated. Use RTD instead.")
+ log.warn("Upload_docs command is deprecated for PyPi. Use RTD instead.")
self.announce('Using upload directory %s' % self.target_dir)
def create_zipfile(self, filename):
diff --git a/setuptools/tests/requirements.txt b/setuptools/tests/requirements.txt
index d0d07f70..b2d84a94 100644
--- a/setuptools/tests/requirements.txt
+++ b/setuptools/tests/requirements.txt
@@ -11,3 +11,4 @@ paver; python_version>="3.6"
futures; python_version=="2.7"
pip>=19.1 # For proper file:// URLs support.
jaraco.envs
+sphinx
diff --git a/setuptools/tests/test_sphinx_upload_docs.py b/setuptools/tests/test_sphinx_upload_docs.py
new file mode 100644
index 00000000..a48ba7f8
--- /dev/null
+++ b/setuptools/tests/test_sphinx_upload_docs.py
@@ -0,0 +1,41 @@
+import pytest
+import os
+
+from setuptools.command.upload_docs import upload_docs
+from setuptools.dist import Distribution
+
+
+@pytest.fixture
+def sphinx_doc_sample_project(tmpdir_cwd):
+ # setup.py
+ with open('setup.py', 'wt') as f:
+ f.write('from setuptools import setup; setup()\n')
+
+ os.makedirs('build/docs')
+
+ # A test conf.py for Sphinx
+ with open('build/docs/conf.py', 'w') as f:
+ f.write("project = 'test'")
+
+ # A test index.rst for Sphinx
+ with open('build/docs/index.rst', 'w') as f:
+ f.write(".. toctree::\
+ :maxdepth: 2\
+ :caption: Contents:")
+
+
+@pytest.mark.usefixtures('sphinx_doc_sample_project')
+class TestSphinxUploadDocs:
+ def test_sphinx_doc(self):
+ params = dict(
+ name='foo',
+ packages=['test'],
+ )
+ dist = Distribution(params)
+
+ cmd = upload_docs(dist)
+
+ cmd.initialize_options()
+ assert cmd.upload_dir is None
+ assert cmd.has_sphinx() is True
+ cmd.finalize_options()
diff --git a/tools/tox_pip.py b/tools/tox_pip.py
deleted file mode 100644
index be2ff1d0..00000000
--- a/tools/tox_pip.py
+++ /dev/null
@@ -1,70 +0,0 @@
-import os
-import subprocess
-import sys
-import re
-
-
-def remove_setuptools():
- """
- Remove setuptools from the current environment.
- """
- print("Removing setuptools")
- cmd = [sys.executable, '-m', 'pip', 'uninstall', '-y', 'setuptools']
- # set cwd to something other than '.' to avoid detecting
- # '.' as the installed package.
- 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 .?
- """
- def strip_extras(arg):
- match = re.match(r'(.*)?\[.*\]$', arg)
- return match.group(1) if match else arg
-
- return (
- 'install' in args
- and any(
- arg in ['.', os.getcwd()]
- for arg in map(strip_extras, args)
- )
- )
-
-
-def pip(*args):
- cmd = [sys.executable, '-m', 'pip'] + list(args)
- return subprocess.check_call(cmd)
-
-
-def test_dependencies():
- from ConfigParser import ConfigParser
-
- def clean(dep):
- spec, _, _ = dep.partition('#')
- return spec.strip()
-
- parser = ConfigParser()
- parser.read('setup.cfg')
- raw = parser.get('options.extras_require', 'tests').split('\n')
- return filter(None, map(clean, raw))
-
-
-def run(args):
- os.environ['PIP_USE_PEP517'] = 'true'
-
- if is_install_self(args):
- remove_setuptools()
- bootstrap()
-
- pip(*args)
-
-
-if __name__ == '__main__':
- run(sys.argv[1:])
diff --git a/tox.ini b/tox.ini
index 8083d8c2..8ab2b8cf 100644
--- a/tox.ini
+++ b/tox.ini
@@ -11,8 +11,6 @@ commands =
pytest {posargs}
usedevelop = True
extras = testing
-install_command = {[helpers]pip} install {opts} {packages}
-list_dependencies_command = {[helpers]pip} freeze --all
setenv =
COVERAGE_FILE={toxworkdir}/.coverage.{envname}
passenv =
@@ -74,7 +72,3 @@ commands =
python -m twine upload dist/*
python -m jaraco.develop.create-github-release
python -m jaraco.tidelift.publish-release-notes
-
-[helpers]
-# Custom pip behavior
-pip = python {toxinidir}/tools/tox_pip.py