File: next_sphinx.py

package info (click to toggle)
python-azure 20251104%2Bgit-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 770,224 kB
  • sloc: python: 6,357,217; ansic: 804; javascript: 287; makefile: 198; sh: 193; xml: 109
file content (27 lines) | stat: -rw-r--r-- 930 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import argparse

from typing import Optional, List

from .sphinx import sphinx


class next_sphinx(sphinx):
    def __init__(self):
        super().__init__()

    def register(
        self, subparsers: "argparse._SubParsersAction", parent_parsers: Optional[List[argparse.ArgumentParser]] = None
    ) -> None:
        """Register the next-sphinx check. The next-sphinx check installs the next version of sphinx and runs sphinx against the target package."""
        parents = parent_parsers or []
        p = subparsers.add_parser(
            "next-sphinx", parents=parents, help="Run the sphinx check with the next version of sphinx"
        )
        p.set_defaults(func=self.run)

        p.add_argument("--inci", dest="in_ci", action="store_true", default=False)

    def run(self, args: argparse.Namespace) -> int:
        """Run the next-sphinx check command."""
        args.next = True
        return super().run(args)