DOC: Skip creating redirects if docs build fails
State: closed

When the doc build fails, we still try to create the redirected pages, which fails, and adds to the log a misleading error (it looks in the logs like the problem is not the original error but that something is failing in the redirects).

See for example https://travis-ci.org/pandas-dev/pandas/jobs/542714631:
```
Recursion error:
maximum recursion depth exceeded while calling a Python object
This can happen with very large or deeply nested source files.  You can carefully increase the default Python recursion limit of 1000 in conf.py with e.g.:
    import sys; sys.setrecursionlimit(1500)
Traceback (most recent call last):
  File "./make.py", line 341, in <module>
    sys.exit(main())
  File "./make.py", line 337, in main
    return getattr(builder, args.command)()
  File "./make.py", line 226, in html
    self._add_redirects()
  File "./make.py", line 209, in _add_redirects
    with open(path, 'w') as moved_page_fd:
FileNotFoundError: [Errno 2] No such file or directory: '/home/travis/build/pandas-dev/pandas/doc/build/html/generated/pandas.api.extensions.ExtensionArray.argsort.html'
```

Here I make the redirects be created only if the doc build succeeded. Also opening the browser if we're building a single page.

Labels:
name: Docs
name: CI
description: Continuous Integration

Comments:
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=h1) Report
> Merging [#26752](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c7748ca057cad4a80a6c4cbf8b49c5d9f3e7ea1c?src=pr&el=desc) will **decrease** coverage by `1.41%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26752/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26752      +/-   ##
==========================================
- Coverage    91.7%   90.29%   -1.42%     
==========================================
  Files         179      179              
  Lines       50767    50767              
==========================================
- Hits        46555    45839     -716     
- Misses       4212     4928     +716
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.29% <ø> (ø)` | :arrow_up: |
| #single | `?` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `62.5% <0%> (-27.75%)` | :arrow_down: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `63.82% <0%> (-26.48%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `84.21% <0%> (-5.27%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `94.5% <0%> (-3.03%)` | :arrow_down: |
| [pandas/io/clipboard/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9jbGlwYm9hcmRzLnB5) | `31.88% <0%> (-2.9%)` | :arrow_down: |
| [pandas/io/formats/printing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvcHJpbnRpbmcucHk=) | `84.49% <0%> (-1.07%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.21% <0%> (-0.17%)` | :arrow_down: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.8% <0%> (-0.13%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.88% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=footer). Last update [c7748ca...ab4af39](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=h1) Report
> Merging [#26752](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/c7748ca057cad4a80a6c4cbf8b49c5d9f3e7ea1c?src=pr&el=desc) will **decrease** coverage by `1.41%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/26752/graphs/tree.svg?width=650&token=eZ4WkYLtcO&height=150&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #26752      +/-   ##
==========================================
- Coverage    91.7%   90.29%   -1.42%     
==========================================
  Files         179      179              
  Lines       50767    50767              
==========================================
- Hits        46555    45839     -716     
- Misses       4212     4928     +716
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `90.29% <ø> (ø)` | :arrow_up: |
| #single | `?` | |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/core/computation/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vcHl0YWJsZXMucHk=) | `62.5% <0%> (-27.75%)` | :arrow_down: |
| [pandas/io/pytables.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL3B5dGFibGVzLnB5) | `63.82% <0%> (-26.48%)` | :arrow_down: |
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `78.94% <0%> (-10.53%)` | :arrow_down: |
| [pandas/core/computation/common.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vY29tbW9uLnB5) | `84.21% <0%> (-5.27%)` | :arrow_down: |
| [pandas/core/computation/expr.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvY29tcHV0YXRpb24vZXhwci5weQ==) | `94.5% <0%> (-3.03%)` | :arrow_down: |
| [pandas/io/clipboard/clipboards.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2NsaXBib2FyZC9jbGlwYm9hcmRzLnB5) | `31.88% <0%> (-2.9%)` | :arrow_down: |
| [pandas/io/formats/printing.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2lvL2Zvcm1hdHMvcHJpbnRpbmcucHk=) | `84.49% <0%> (-1.07%)` | :arrow_down: |
| [pandas/core/indexes/datetimes.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9kYXRldGltZXMucHk=) | `96.21% <0%> (-0.17%)` | :arrow_down: |
| [pandas/core/arrays/categorical.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvYXJyYXlzL2NhdGVnb3JpY2FsLnB5) | `95.8% <0%> (-0.13%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/26752/diff?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `96.88% <0%> (-0.12%)` | :arrow_down: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=footer). Last update [c7748ca...ab4af39](https://codecov.io/gh/pandas-dev/pandas/pull/26752?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

Did this error just pop up with a new version of sphinx?
Yep, the error was fixed in #26727. This PR is just for future failures of the doc build, to not include the misleading redirects error.
thanks @datapythonista