doc: wikiparser: Fix issue with running parser outside doc/ dir

Use a path relative to the script path when checking for existence of manual
pages.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2020-10-30 10:49:58 -07:00
parent 085e3ffef3
commit 6180e3a051
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 3 additions and 2 deletions

View File

@ -21,7 +21,7 @@ run-unit-tests:
- su -c "cd ~/plinth; python3 -m flake8 --exclude actions/domainname-change,actions/dynamicdns,actions/hostname-change,actions/networks plinth actions/*" tester
- su -c "cd ~/plinth;PYTHONPATH='.' py.test-3 --cov=plinth --cov-report=html:/home/tester/plinth/htmlcov --cov-report=term" tester
- cp -r /home/tester/plinth/htmlcov test-coverage-report
- su -c "cd ~/plinth/doc;./scripts/wikiparser.py" tester
- su -c "doc/scripts/wikiparser.py" tester
coverage: '/^TOTAL\s+.*\s+(\d+\.\d+%)$/'
artifacts:

View File

@ -694,7 +694,8 @@ def resolve_url(url, context):
link_language = DEFAULT_LANGUAGE
# Check for local file and use local path
file_ = Path(f'manual/{link_language}') / (link_page + '.raw.wiki')
file_ = Path(__file__).parent.parent
file_ = file_ / f'manual/{link_language}' / (link_page + '.raw.wiki')
if file_.exists():
help_base = LOCAL_BASE.format(lang=link_language)
url = f'{help_base}{link_page}'