update makefile and change argument file generation

pull/121/head
Dan Joseph 2021-11-12 16:26:15 -05:00
rodzic 1fd18ded70
commit 372a9e51b3
4 zmienionych plików z 44 dodań i 28 usunięć

Wyświetl plik

@ -14,19 +14,33 @@ help:
.PHONY: help Makefile .PHONY: help Makefile
# this is for testing, it will only build the EN version of the docs
livehtml:
sphinx-autobuild --open-browser --host 0.0.0.0 -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)/html"
# this will update `arguments.rst` to match arguments in the ODM code # this will update `arguments.rst` to match arguments in the ODM code
# add any individual file for an arguement missing from `source/arguments_edit/`
# update the files in `source/arguments/` including adding in
# all user contributed content from files in `source/arguments_edit/`
autogenerate: autogenerate:
python scripts/extract_odm_strings.py https://raw.githubusercontent.com/OpenDroneMap/ODM/master/opendm/config.py python scripts/extract_odm_strings.py https://raw.githubusercontent.com/OpenDroneMap/ODM/master/opendm/config.py
# update main EN pot files that serve as the source for translation process
updatepot:
@$(SPHINXBUILD) -b gettext "$(SOURCEDIR)" "source/locale/pot"
# update the po files for each target language from the EN pot files
updatelangpo:
sphinx-intl update --pot-dir "source/locale/pot" --language sw,ar,es,fr,te,fil
# push new and changed strings to Transifex
pushlang: pushlang:
@$(SPHINXBUILD) -b gettext "$(SOURCEDIR)" "source/locale/en/pot"
tx push --source tx push --source
# push translated strings from Transifex
pulllang: pulllang:
tx pull --language "sw,ar,es,fr,te,fil" tx pull --language "sw,ar,es,fr,te,fil"
livehtml:
sphinx-autobuild --open-browser --host 0.0.0.0 -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)"
build: build:
@$(SPHINXBUILD) -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)/html" -nW @$(SPHINXBUILD) -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)/html" -nW
@$(SPHINXBUILD) -b dirhtml -D language='sw' "$(SOURCEDIR)" "$(BUILDDIR)/html/sw" -nW @$(SPHINXBUILD) -b dirhtml -D language='sw' "$(SOURCEDIR)" "$(BUILDDIR)/html/sw" -nW
@ -35,7 +49,6 @@ build:
@$(SPHINXBUILD) -b dirhtml -D language='fr' "$(SOURCEDIR)" "$(BUILDDIR)/html/fr" -nW @$(SPHINXBUILD) -b dirhtml -D language='fr' "$(SOURCEDIR)" "$(BUILDDIR)/html/fr" -nW
@$(SPHINXBUILD) -b dirhtml -D language='te' "$(SOURCEDIR)" "$(BUILDDIR)/html/te" -nW @$(SPHINXBUILD) -b dirhtml -D language='te' "$(SOURCEDIR)" "$(BUILDDIR)/html/te" -nW
@$(SPHINXBUILD) -b dirhtml -D language='fil' "$(SOURCEDIR)" "$(BUILDDIR)/html/fil" -nW @$(SPHINXBUILD) -b dirhtml -D language='fil' "$(SOURCEDIR)" "$(BUILDDIR)/html/fil" -nW
echo "docs.opendronemap.org" > ./_build/html/CNAME
# -n Run in nit-picky mode. Currently, this generates warnings for all missing references. # -n Run in nit-picky mode. Currently, this generates warnings for all missing references.
# -W Turn warnings into errors that stop the build. # -W Turn warnings into errors that stop the build.
# for more details about the options see https://www.sphinx-doc.org/en/1.8/man/sphinx-build.html#options # for more details about the options see https://www.sphinx-doc.org/en/1.8/man/sphinx-build.html#options
@ -43,13 +56,13 @@ build:
# `allerr` runs without nit-picky mode, so that an error doesn't halt the build # `allerr` runs without nit-picky mode, so that an error doesn't halt the build
# it will log all errors that need to be fixed in the translations (generally syntax errors) # it will log all errors that need to be fixed in the translations (generally syntax errors)
allerr: allerr:
@$(SPHINXBUILD) -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)/html" @$(SPHINXBUILD) -v -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)/html"
@$(SPHINXBUILD) -b dirhtml -D language='sw' "$(SOURCEDIR)" "$(BUILDDIR)/html/sw" @$(SPHINXBUILD) -v -b dirhtml -D language='sw' "$(SOURCEDIR)" "$(BUILDDIR)/html/sw"
@$(SPHINXBUILD) -b dirhtml -D language='ar' "$(SOURCEDIR)" "$(BUILDDIR)/html/ar" @$(SPHINXBUILD) -v -b dirhtml -D language='ar' "$(SOURCEDIR)" "$(BUILDDIR)/html/ar"
@$(SPHINXBUILD) -b dirhtml -D language='es' "$(SOURCEDIR)" "$(BUILDDIR)/html/es" @$(SPHINXBUILD) -v -b dirhtml -D language='es' "$(SOURCEDIR)" "$(BUILDDIR)/html/es"
@$(SPHINXBUILD) -b dirhtml -D language='fr' "$(SOURCEDIR)" "$(BUILDDIR)/html/fr" @$(SPHINXBUILD) -v -b dirhtml -D language='fr' "$(SOURCEDIR)" "$(BUILDDIR)/html/fr"
@$(SPHINXBUILD) -b dirhtml -D language='te' "$(SOURCEDIR)" "$(BUILDDIR)/html/te" @$(SPHINXBUILD) -v -b dirhtml -D language='te' "$(SOURCEDIR)" "$(BUILDDIR)/html/te"
@$(SPHINXBUILD) -b dirhtml -D language='fil' "$(SOURCEDIR)" "$(BUILDDIR)/html/fil" @$(SPHINXBUILD) -v -b dirhtml -D language='fil' "$(SOURCEDIR)" "$(BUILDDIR)/html/fil"
# Catch-all target: route all unknown targets to Sphinx using the new # Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).

Wyświetl plik

@ -1,6 +1,6 @@
.. ..
AUTO-GENERATED by extract_odm_strings.py! DO NOT EDIT! AUTO-GENERATED by extract_odm_strings.py! DO NOT EDIT!
If you want to add more details to a command, create a If you want to add more details to a command, edit a
.rst file in arguments_edit/<argument>.rst .rst file in arguments_edit/<argument>.rst
.. _$opt: .. _$opt:

Wyświetl plik

@ -4,7 +4,7 @@ Options and Flags
$arguments $arguments
`Learn to edit <https://github.com/opendronemap/docs#how-to-make-your-first-contribution>`_ and help improve `this page <https://github.com/OpenDroneMap/docs/blob/publish/source/arguments.rst>`_! If you want to add more details to a command, `learn to edit <https://github.com/opendronemap/docs#how-to-make-your-first-contribution>`_ and help improve the matching file in the ``arguments_edit`` `project folder <https://github.com/OpenDroneMap/docs/tree/publish/source/arguments_edit>`_!
.. toctree:: .. toctree::
:maxdepth: 1 :maxdepth: 1

Wyświetl plik

@ -2,6 +2,7 @@
import argparse, os, urllib.request, ast, sys import argparse, os, urllib.request, ast, sys
from io import StringIO from io import StringIO
from pathlib import Path
from string import Template from string import Template
parser = argparse.ArgumentParser(description='Extract ODM strings.') parser = argparse.ArgumentParser(description='Extract ODM strings.')
@ -115,12 +116,14 @@ if len(options) > 0:
f.write("\n") f.write("\n")
print("Wrote %s" % include_file) print("Wrote %s" % include_file)
argument_edit = Path(include_file).read_text()
kwargs = { kwargs = {
'opt': opt_name, 'opt': opt_name,
'ticks': '`' * len(opt_name), 'ticks': '`' * len(opt_name),
'descr': get_opt_descr(opt), 'descr': get_opt_descr(opt),
'parameter': "**Options:** *%s*" % get_opt_choices(opt) if get_opt_choices(opt) else "", 'parameter': "**Options:** *%s*" % get_opt_choices(opt) if get_opt_choices(opt) else "",
'include': ".. include:: ../arguments_edit/%s" % os.path.basename(include_file), 'include': argument_edit,
'editfile': os.path.join("arguments_edit", os.path.basename(include_file)), 'editfile': os.path.join("arguments_edit", os.path.basename(include_file)),
} }