kopia lustrzana https://github.com/OpenDroneMap/docs
update makefile and change argument file generation
rodzic
1fd18ded70
commit
372a9e51b3
47
Makefile
47
Makefile
|
@ -14,28 +14,41 @@ 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
|
||||||
|
|
||||||
pushlang:
|
# update main EN pot files that serve as the source for translation process
|
||||||
@$(SPHINXBUILD) -b gettext "$(SOURCEDIR)" "source/locale/en/pot"
|
updatepot:
|
||||||
tx push --source
|
@$(SPHINXBUILD) -b gettext "$(SOURCEDIR)" "source/locale/pot"
|
||||||
pulllang:
|
|
||||||
tx pull --language "sw,ar,es,fr,te,fil"
|
|
||||||
|
|
||||||
livehtml:
|
# update the po files for each target language from the EN pot files
|
||||||
sphinx-autobuild --open-browser --host 0.0.0.0 -b dirhtml "$(SOURCEDIR)" "$(BUILDDIR)"
|
updatelangpo:
|
||||||
|
sphinx-intl update --pot-dir "source/locale/pot" --language sw,ar,es,fr,te,fil
|
||||||
|
|
||||||
|
# push new and changed strings to Transifex
|
||||||
|
pushlang:
|
||||||
|
tx push --source
|
||||||
|
|
||||||
|
# push translated strings from Transifex
|
||||||
|
pulllang:
|
||||||
|
tx pull --language "sw,ar,es,fr,te,fil"
|
||||||
|
|
||||||
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
|
||||||
@$(SPHINXBUILD) -b dirhtml -D language='ar' "$(SOURCEDIR)" "$(BUILDDIR)/html/ar" -nW
|
@$(SPHINXBUILD) -b dirhtml -D language='ar' "$(SOURCEDIR)" "$(BUILDDIR)/html/ar" -nW
|
||||||
@$(SPHINXBUILD) -b dirhtml -D language='es' "$(SOURCEDIR)" "$(BUILDDIR)/html/es" -nW
|
@$(SPHINXBUILD) -b dirhtml -D language='es' "$(SOURCEDIR)" "$(BUILDDIR)/html/es" -nW
|
||||||
@$(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).
|
||||||
|
|
|
@ -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:
|
||||||
|
|
|
@ -4,10 +4,10 @@ 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
|
||||||
:glob:
|
:glob:
|
||||||
|
|
||||||
arguments/*
|
arguments/*
|
||||||
|
|
|
@ -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.')
|
||||||
|
@ -31,13 +32,13 @@ class ArgumentParserStub(argparse.ArgumentParser):
|
||||||
|
|
||||||
for name, value in kwargs.items():
|
for name, value in kwargs.items():
|
||||||
options[args[0]][str(name)] = str(value)
|
options[args[0]][str(name)] = str(value)
|
||||||
|
|
||||||
def add_mutually_exclusive_group(self):
|
def add_mutually_exclusive_group(self):
|
||||||
return ArgumentParserStub()
|
return ArgumentParserStub()
|
||||||
|
|
||||||
# Voodoo! :)
|
# Voodoo! :)
|
||||||
# ( parse AST, extract "def config()" function, set module to only
|
# ( parse AST, extract "def config()" function, set module to only
|
||||||
# contain that function, execute module in current scope,
|
# contain that function, execute module in current scope,
|
||||||
# run config function)
|
# run config function)
|
||||||
root = ast.parse(config_file)
|
root = ast.parse(config_file)
|
||||||
new_body = []
|
new_body = []
|
||||||
|
@ -56,7 +57,7 @@ exec(compile(root, filename="<ast>", mode="exec"))
|
||||||
|
|
||||||
# Misc variables needed to get config to run
|
# Misc variables needed to get config to run
|
||||||
__version__ = '?'
|
__version__ = '?'
|
||||||
class context:
|
class context:
|
||||||
root_path = ''
|
root_path = ''
|
||||||
num_cores = 4
|
num_cores = 4
|
||||||
class io:
|
class io:
|
||||||
|
@ -88,7 +89,7 @@ if len(options) > 0:
|
||||||
|
|
||||||
keys = list(options.keys())
|
keys = list(options.keys())
|
||||||
keys.sort(key=lambda a: a.replace("-", ""))
|
keys.sort(key=lambda a: a.replace("-", ""))
|
||||||
|
|
||||||
with open(argstmplfile) as f:
|
with open(argstmplfile) as f:
|
||||||
argstmpl = Template(f.read())
|
argstmpl = Template(f.read())
|
||||||
|
|
||||||
|
@ -99,10 +100,10 @@ if len(options) > 0:
|
||||||
# Use longest name
|
# Use longest name
|
||||||
opt_name = max(arg_map + (opt_name, ), key=len)
|
opt_name = max(arg_map + (opt_name, ), key=len)
|
||||||
return opt_name.replace("--", "")
|
return opt_name.replace("--", "")
|
||||||
|
|
||||||
def get_opt_descr(opt):
|
def get_opt_descr(opt):
|
||||||
return options[opt].get('help', '').replace("*", "\*")
|
return options[opt].get('help', '').replace("*", "\*")
|
||||||
|
|
||||||
def get_opt_choices(opt):
|
def get_opt_choices(opt):
|
||||||
return options[opt].get('choices', options[opt].get('metavar', '')).replace('[', '').replace(']', '').replace(',', ' | ').replace('\'', '')
|
return options[opt].get('choices', options[opt].get('metavar', '')).replace('[', '').replace(']', '').replace(',', ' | ').replace('\'', '')
|
||||||
|
|
||||||
|
@ -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)),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,4 +151,4 @@ if len(options) > 0:
|
||||||
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("No strings found")
|
print("No strings found")
|
||||||
|
|
Ładowanie…
Reference in New Issue