Simplify asciidoc arg
This commit is contained in:
parent
5663bd24f5
commit
28bd35ed58
|
|
@ -60,6 +60,12 @@ Changed
|
|||
generator.
|
||||
- When `tabs.favicons` is disabled but `tabs.tabs_are_windows` is set, the
|
||||
window icon is still set to the page's favicon now.
|
||||
- The `--asciidoc` argument to `src2asciidoc.py` and `build_release.py` now
|
||||
only takes the path to `asciidoc.py`, using the current Python interpreter by
|
||||
default. To configure the Python interpreter as well, use
|
||||
`--asciidoc-python path/to/python --asciidoc path/to/asciidoc.py`
|
||||
instead of the former
|
||||
`--asciidoc path/to/python path/to/asciidoc.py`.
|
||||
|
||||
Added
|
||||
~~~~~
|
||||
|
|
|
|||
|
|
@ -46,10 +46,12 @@ class AsciiDoc:
|
|||
FILES = ['faq', 'changelog', 'contributing', 'quickstart', 'userscripts']
|
||||
|
||||
def __init__(self,
|
||||
asciidoc: Optional[List[str]],
|
||||
asciidoc: Optional[str],
|
||||
asciidoc_python: Optional[str],
|
||||
website: Optional[str]) -> None:
|
||||
self._cmd = None # type: Optional[List[str]]
|
||||
self._asciidoc = asciidoc
|
||||
self._asciidoc_python = asciidoc_python
|
||||
self._website = website
|
||||
self._homedir = None # type: Optional[pathlib.Path]
|
||||
self._themedir = None # type: Optional[pathlib.Path]
|
||||
|
|
@ -218,7 +220,9 @@ class AsciiDoc:
|
|||
def _get_asciidoc_cmd(self) -> List[str]:
|
||||
"""Try to find out what commandline to use to invoke asciidoc."""
|
||||
if self._asciidoc is not None:
|
||||
return self._asciidoc
|
||||
python = (sys.executable if self._asciidoc_python is None
|
||||
else self._asciidoc_python)
|
||||
return [python, self._asciidoc]
|
||||
|
||||
for executable in ['asciidoc', 'asciidoc.py']:
|
||||
try:
|
||||
|
|
@ -270,10 +274,12 @@ def parse_args() -> argparse.Namespace:
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--website', help="Build website into a given "
|
||||
"directory.")
|
||||
parser.add_argument('--asciidoc', help="Full path to python and "
|
||||
"asciidoc.py. If not given, it's searched in PATH.",
|
||||
nargs=2, required=False,
|
||||
metavar=('PYTHON', 'ASCIIDOC'))
|
||||
parser.add_argument('--asciidoc', help="Full path to asciidoc.py. "
|
||||
"If not given, it's searched in PATH.",
|
||||
nargs='?')
|
||||
parser.add_argument('--asciidoc-python', help="Python to use for asciidoc."
|
||||
"If not given, the current Python interpreter is used.",
|
||||
nargs='?')
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
|
@ -301,7 +307,8 @@ def main(colors: bool = False) -> None:
|
|||
utils.change_cwd()
|
||||
utils.use_color = colors
|
||||
args = parse_args()
|
||||
run(asciidoc=args.asciidoc, website=args.website)
|
||||
run(asciidoc=args.asciidoc, asciidoc_python=args.asciidoc_python,
|
||||
website=args.website)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
|
|||
|
|
@ -78,10 +78,11 @@ def call_tox(toxenv, *args, python=sys.executable):
|
|||
def run_asciidoc2html(args):
|
||||
"""Common buildsteps used for all OS'."""
|
||||
utils.print_title("Running asciidoc2html.py")
|
||||
a2h_args = []
|
||||
if args.asciidoc is not None:
|
||||
a2h_args = ['--asciidoc'] + args.asciidoc
|
||||
else:
|
||||
a2h_args = []
|
||||
a2h_args += ['--asciidoc', args.asciidoc]
|
||||
if args.asciidoc_python is not None:
|
||||
a2h_args += ['--asciidoc-python', args.asciidoc_python]
|
||||
call_script('asciidoc2html.py', *a2h_args)
|
||||
|
||||
|
||||
|
|
@ -457,10 +458,12 @@ def main():
|
|||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--no-asciidoc', action='store_true',
|
||||
help="Don't generate docs")
|
||||
parser.add_argument('--asciidoc', help="Full path to python and "
|
||||
"asciidoc.py. If not given, it's searched in PATH.",
|
||||
nargs=2, required=False,
|
||||
metavar=('PYTHON', 'ASCIIDOC'))
|
||||
parser.add_argument('--asciidoc', help="Full path to asciidoc.py. "
|
||||
"If not given, it's searched in PATH.",
|
||||
nargs='?')
|
||||
parser.add_argument('--asciidoc-python', help="Python to use for asciidoc."
|
||||
"If not given, the current Python interpreter is used.",
|
||||
nargs='?')
|
||||
parser.add_argument('--upload', action='store_true', required=False,
|
||||
help="Toggle to upload the release to GitHub")
|
||||
args = parser.parse_args()
|
||||
|
|
|
|||
Loading…
Reference in New Issue