From 170e2ea160f550312628cff8f783316b2cc3414c Mon Sep 17 00:00:00 2001 From: Doug Ransom Date: Sat, 31 Aug 2024 05:50:31 -0700 Subject: [PATCH] attempted merge of conflicts in PR. # Conflicts: # documentation/conf.py # documentation/documentation.rst # documentation/errors Quintijn.txt # documentation/modules.rst --- .gitignore | 2 + documentation/conf.py | 1 + documentation/documentation.rst | 1 - documentation/errors Quintijn.txt | 394 ------------------------------ src/natlinkcore/config.py | 29 ++- 5 files changed, 17 insertions(+), 410 deletions(-) delete mode 100644 documentation/errors Quintijn.txt diff --git a/.gitignore b/.gitignore index ad335dc..4d99966 100644 --- a/.gitignore +++ b/.gitignore @@ -95,6 +95,8 @@ MacroSystem/*_vcl.py src/dist/ dist +# git extensions +*.orig #tests diff --git a/documentation/conf.py b/documentation/conf.py index 62c4e47..b41de6a 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -69,6 +69,7 @@ def __getattr__(cls, name): 'vocoladirectory', 'unimacrodirectory', 'unimacrogrammarsdirectory', + 'unimacro.spokenforms', } for module_name in mock_modules: sys.modules[module_name] = Mock() diff --git a/documentation/documentation.rst b/documentation/documentation.rst index 2eee71d..d91eed2 100644 --- a/documentation/documentation.rst +++ b/documentation/documentation.rst @@ -27,7 +27,6 @@ Then run the following command on Windows to build the documentation: $ ./make html - If there were no errors during the build process, open the *_build/html/index.html* file in a web browser. Make changes, rebuild the documentation and reload the doc page(s) in your browser as you go. diff --git a/documentation/errors Quintijn.txt b/documentation/errors Quintijn.txt deleted file mode 100644 index dee991e..0000000 --- a/documentation/errors Quintijn.txt +++ /dev/null @@ -1,394 +0,0 @@ -Microsoft Windows [Version 10.0.19045.4780] -(c) Microsoft Corporation. Alle rechten voorbehouden. - -C:\Users\Gebruiker>cd \dt\natlinkcore\documentation - -C:\DT\natlinkcore\documentation>cd \dt\natlinkcoredoug - -C:\DT\natlinkcoreDoug>cd documentations -Het systeem kan het opgegeven pad niet vinden. - -C:\DT\natlinkcoreDoug>cd documentation - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 2 source files that are out of date -updating environment: 0 added, 2 changed, 0 removed -from_config_parser: skip "vocola2" ("vocoladirectory"): is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "unimacro\unimacrogrammars" is not a valid directory - -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - config - loader - natlinkstatus - natlinkutils -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] natlinkstatus -generating indices... genindex py-modindex done -highlighting module code... [100%] natlinkcore.natlinkstatus -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 4 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>cd build -Het systeem kan het opgegeven pad niet vinden. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 1 source files that are out of date -updating environment: 0 added, 1 changed, 0 removed -reading sources... [100%] modules -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - natlinkutils - config - loader - natlinkstatus -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] modules -generating indices... genindex py-modindex done -from_config_parser: skip "vocola2" ("vocoladirectory"): is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "unimacro\unimacrogrammars" is not a valid directory - -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 4 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 0 source files that are out of date -updating environment: 1 added, 0 changed, 0 removed -reading sources... [100%] natlinkutils -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:128: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:130: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:131: WARNING: Block quote ends without a blank line; unexpected unindent. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.SelectGramBase:14: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.SelectGramBase:80: WARNING: Definition list ends without a blank line; unexpected unindent. -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkutils.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] natlinkutils -generating indices... genindex py-modindex done -from_config_parser: skip "vocola2" ("vocoladirectory"):tatus - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "MagicMock\mock.__getitem__()\2546067778640\unimacrogrammars" is not a valid directory -highlighting module code... [100%] natlinkcore.natlinkutils -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 9 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 1 source files that are out of date -updating environment: 0 added, 1 changed, 0 removed -reading sources... [100%] modules -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - natlinkutils.rst - config.rst - loader.rst - natlinkstatus.rst -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkutils.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] modules -generating indices... genindex py-modindex done -from_config_parser: skip "vocola2" ("vocoladirectory"):tatus - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "MagicMock\mock.__getitem__()\2389399509136\unimacrogrammars" is not a valid directory -highlighting module code... [100%] natlinkcore.natlinkutils -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 5 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 1 source files that are out of date -updating environment: 0 added, 1 changed, 0 removed -reading sources... [100%] modules -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - natlinkutils - config - loader - natlinkstatus -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkutils.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] modules -generating indices... genindex py-modindex done -from_config_parser: skip "vocola2" ("vocoladirectory"):tatus - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "MagicMock\mock.__getitem__()\2383906996304\unimacrogrammars" is not a valid directory -highlighting module code... [100%] natlinkcore.natlinkutils -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 5 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 0 source files that are out of date -updating environment: 0 added, 0 changed, 0 removed -reading sources... -looking for now-outdated files... none found -no targets are out of date. -build succeeded. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 1 source files that are out of date -updating environment: 0 added, 1 changed, 0 removed -reading sources... [100%] modules -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - natlinkutils - config - loader - natlinkstatus - natlinktimer - readwritefile -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkutils.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] modules -generating indices... genindex py-modindex done -from_config_parser: skip "vocola2" ("vocoladirectory"):tatus - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "MagicMock\mock.__getitem__()\2731595383760\unimacrogrammars" is not a valid directory -highlighting module code... [100%] natlinkcore.natlinkutils -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 5 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 0 source files that are out of date -updating environment: 0 added, 0 changed, 0 removed -reading sources... -looking for now-outdated files... none found -no targets are out of date. -build succeeded. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation>make html -Running Sphinx v7.4.7 -==================== -natlinkcore, version: "5.3", release: "5.3.13" -loading translations [en]... done -Converting `source_suffix = '.rst'` to `source_suffix = {'.rst': 'restructuredtext'}`. -loading pickled environment... done -building [mo]: targets for 0 po files that are out of date -writing output... -building [html]: targets for 8 source files that are out of date -updating environment: 0 added, 8 changed, 0 removed -from_config_parser: skip "vocola2" ("vocoladirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro" ("unimacrodirectory"): - expanded to directory "" is not a valid directory -from_config_parser: skip "unimacro/unimacrogrammars" ("unimacrogrammarsdirectory"): - expanded to directory "MagicMock\mock.__getitem__()\2039310573712\unimacrogrammars" is not a valid directory -reading sources... [100%] project -C:\DT\natlinkcoreDoug\documentation\modules.rst:7: ERROR: Error in "toctree" directive: -invalid option block. - -.. toctree:: - :maxdepth: 2 - natlinkutils - config - loader - natlinkstatus - natlinktimer - readwritefile -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:128: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:130: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.GrammarBase:131: WARNING: Block quote ends without a blank line; unexpected unindent. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.SelectGramBase:14: ERROR: Unexpected indentation. -C:\DT\natlinkcoreDoug\src\natlinkcore\natlinkutils.py:docstring of natlinkcore.natlinkutils.SelectGramBase:80: WARNING: Definition list ends without a blank line; unexpected unindent. -looking for now-outdated files... none found -pickling environment... done -checking consistency... C:\DT\natlinkcoreDoug\documentation\config.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\loader.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkstatus.rst: WARNING: document isn't included in any toctree -C:\DT\natlinkcoreDoug\documentation\natlinkutils.rst: WARNING: document isn't included in any toctree -done -preparing documents... done -copying assets... -copying static files... done -copying extra files... done -copying assets: done -writing output... [100%] project -generating indices... genindex py-modindex done -highlighting module code... [100%] natlinkcore.natlinkutils -writing additional pages... search done -dumping search index in English (code: en)... done -dumping object inventory... done -build succeeded, 10 warnings. - -The HTML pages are in _build\html. - -C:\DT\natlinkcoreDoug\documentation> \ No newline at end of file diff --git a/src/natlinkcore/config.py b/src/natlinkcore/config.py index 062a91d..fcc35c7 100644 --- a/src/natlinkcore/config.py +++ b/src/natlinkcore/config.py @@ -144,20 +144,19 @@ def from_first_found_file(cls, files: Iterable[str]) -> 'NatlinkConfig': raise NoGoodConfigFoundException('No natlink config file found, please run configure natlink program\n\t(***configurenatlink***)') def expand_path(input_path: str) -> str: - r"""expand path if it starts with "~" or has environment variables (%XXXX%) + r"""expand path if it starts with "~" or starts with an environment variable or name of python package - Paths can be: - - - the name of a python package, or a sub directory of a python package - - Obsolete: natlink_userdir/...: the directory where natlink.ini is is searched for, either %(NATLINK_USERDIR) or ~/.natlink - - ~/...: the home directory - - Now: natlink_settingsdir/...: the directory where natlink.ini is is searched for, either %(NATLINK_SETTINGSDIR) or ~/.natlink - - ~/...: the home directory - - some environment variable: this environment variable is expanded. - - The Documents directory can be found by "~\Documents"... - - When nothing to expand, return input +Paths can be: + +- the name of a python package, or a sub directory of a python package +- natlink_settingsdir/...: the directory where natlink.ini is is searched for, either`%(NATLINK_SETTINGSDIR)` or `~/.natlink` +- `~/...`: the home directory +- Obsolete: natlink_userdir/...: instead natlink_settingsdir will be searched for, and a message is thrown. In the config program things are checked more thoroughly. +- some other environment variable: this environment variable is expanded + +The Documents directory can be found by "~\Documents"... + +When there is nothing to expand, just return the input """ expanduser, expandvars, normpath, isdir = os.path.expanduser, os.path.expandvars, os.path.normpath, os.path.isdir @@ -228,10 +227,10 @@ def expand_path(input_path: str) -> str: return normpath(env_expanded) def expand_natlink_settingsdir(): - """not with envvariables, but special: + """Return the location of the natlink config files if NATLINK_SETTINGSDIR is set: return this, but... it should end with ".natlink" - if NATLINK_SETTINGSDIR is NOT set: return Path.home()/'.natlink' + if NATLINK_SETTINGSDIR is NOT set: return `Path.home()/'.natlink'` """ normpath = os.path.normpath nsd = os.getenv('natlink_settingsdir')