From 72e8510f3bf1d8ab30442abc16aef47008bc6dab Mon Sep 17 00:00:00 2001 From: sinoroc Date: Tue, 12 Nov 2019 23:54:43 +0100 Subject: [PATCH] Fix documentation links for index options In the documentation the links for the pip commands index options are mixed up. The index options are common to multiple commands, but in the documentation they should be specific to a command for the links to point to the right chapter. GitHub: #7347 --- .../development/architecture/package-finding.rst | 15 ++++++++------- docs/html/reference/pip_download.rst | 2 +- docs/html/reference/pip_install.rst | 16 ++++++++-------- docs/html/reference/pip_list.rst | 2 +- docs/html/reference/pip_wheel.rst | 2 +- docs/html/user_guide.rst | 2 +- docs/pip_sphinxext.py | 6 +++++- news/7347.doc | 1 + 8 files changed, 26 insertions(+), 20 deletions(-) create mode 100644 news/7347.doc diff --git a/docs/html/development/architecture/package-finding.rst b/docs/html/development/architecture/package-finding.rst index 852be3b5d..77eab5847 100644 --- a/docs/html/development/architecture/package-finding.rst +++ b/docs/html/development/architecture/package-finding.rst @@ -17,10 +17,11 @@ file to download for a package, given a requirement: 1. Collect together the various network and file system locations containing project package files. These locations are derived, for example, from pip's - :ref:`--index-url <--index-url>` (with default https://pypi.org/simple/ ) - setting and any configured :ref:`--extra-index-url <--extra-index-url>` - locations. Each of the project page URL's is an HTML page of anchor links, - as defined in `PEP 503`_, the "Simple Repository API." + :ref:`--index-url ` (with default + https://pypi.org/simple/ ) setting and any configured + :ref:`--extra-index-url ` locations. Each of the + project page URL's is an HTML page of anchor links, as defined in + `PEP 503`_, the "Simple Repository API." 2. For each project page URL, fetch the HTML and parse out the anchor links, creating a ``Link`` object from each one. The :ref:`LinkCollector ` class is responsible for both the previous step @@ -128,9 +129,9 @@ responsible for collecting the raw list of "links" to package files `PEP 503`_ project page URL's that ``PackageFinder`` should access. The ``LinkCollector`` class takes into account the user's :ref:`--find-links -<--find-links>`, :ref:`--extra-index-url <--extra-index-url>`, and related -options when deciding which locations to collect links from. The class's main -method is the ``collect_links()`` method. The :ref:`PackageFinder +`, :ref:`--extra-index-url `, +and related options when deciding which locations to collect links from. The +class's main method is the ``collect_links()`` method. The :ref:`PackageFinder ` class invokes this method as the first step of its ``find_all_candidates()`` method. diff --git a/docs/html/reference/pip_download.rst b/docs/html/reference/pip_download.rst index cc02accf5..2432d8894 100644 --- a/docs/html/reference/pip_download.rst +++ b/docs/html/reference/pip_download.rst @@ -47,7 +47,7 @@ Options .. pip-command-options:: download -.. pip-index-options:: +.. pip-index-options:: download Examples diff --git a/docs/html/reference/pip_install.rst b/docs/html/reference/pip_install.rst index 5cbb13906..de1eb100c 100644 --- a/docs/html/reference/pip_install.rst +++ b/docs/html/reference/pip_install.rst @@ -153,17 +153,17 @@ To interpret the requirements file in UTF-8 format add a comment The following options are supported: - * :ref:`-i, --index-url <--index-url>` - * :ref:`--extra-index-url <--extra-index-url>` - * :ref:`--no-index <--no-index>` - * :ref:`-f, --find-links <--find-links>` + * :ref:`-i, --index-url ` + * :ref:`--extra-index-url ` + * :ref:`--no-index ` + * :ref:`-f, --find-links ` * :ref:`--no-binary ` * :ref:`--only-binary ` - * :ref:`--require-hashes <--require-hashes>` + * :ref:`--require-hashes ` * :ref:`--trusted-host <--trusted-host>` -For example, to specify :ref:`--no-index <--no-index>` and two -:ref:`--find-links <--find-links>` locations: +For example, to specify :ref:`--no-index ` and two +:ref:`--find-links ` locations: :: @@ -824,7 +824,7 @@ Options .. pip-command-options:: install -.. pip-index-options:: +.. pip-index-options:: install .. _`pip install Examples`: diff --git a/docs/html/reference/pip_list.rst b/docs/html/reference/pip_list.rst index c459b7a3b..f7f7dd052 100644 --- a/docs/html/reference/pip_list.rst +++ b/docs/html/reference/pip_list.rst @@ -20,7 +20,7 @@ Options .. pip-command-options:: list -.. pip-index-options:: +.. pip-index-options:: list Examples diff --git a/docs/html/reference/pip_wheel.rst b/docs/html/reference/pip_wheel.rst index 942bb70b8..2b8cee946 100644 --- a/docs/html/reference/pip_wheel.rst +++ b/docs/html/reference/pip_wheel.rst @@ -59,7 +59,7 @@ Options .. pip-command-options:: wheel -.. pip-index-options:: +.. pip-index-options:: wheel Examples diff --git a/docs/html/user_guide.rst b/docs/html/user_guide.rst index 21c2ca4ac..57f7d281f 100644 --- a/docs/html/user_guide.rst +++ b/docs/html/user_guide.rst @@ -515,7 +515,7 @@ $ pip wheel --wheel-dir DIR -r requirements.txt Then, to install from local only, you'll be using :ref:`--find-links -<--find-links>` and :ref:`--no-index <--no-index>` like so:: +` and :ref:`--no-index ` like so:: $ pip install --no-index --find-links=DIR -r requirements.txt diff --git a/docs/pip_sphinxext.py b/docs/pip_sphinxext.py index c34c457e3..bfc5a6b4a 100644 --- a/docs/pip_sphinxext.py +++ b/docs/pip_sphinxext.py @@ -86,9 +86,13 @@ class PipGeneralOptions(PipOptions): class PipIndexOptions(PipOptions): + required_arguments = 1 + def process_options(self): + cmd_name = self.arguments[0] self._format_options( - [o() for o in cmdoptions.index_group['options']] + [o() for o in cmdoptions.index_group['options']], + cmd_name=cmd_name, ) diff --git a/news/7347.doc b/news/7347.doc new file mode 100644 index 000000000..bc62c56cd --- /dev/null +++ b/news/7347.doc @@ -0,0 +1 @@ +Fix documentation links for index options