Skip to content

Commit

Permalink
Fix doc build (meta module import)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeoSander committed Sep 23, 2024
1 parent eaa2e4b commit e9ae3af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 3 additions & 3 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@

# General information about the project.
company = 'GeoCat'
author = meta.getProperty('author')
author = meta.getAuthor()
project = meta.getLongAppName()
app_name = meta.getAppName()
short_name = meta.getShortAppName()
Expand Down Expand Up @@ -247,8 +247,8 @@
.. |plugin_name| replace:: {app_name} for QGIS
.. |gui_name| replace:: :guilabel:`{app_name}`
.. |publisher| replace:: {company}
.. |app_url| replace:: `{app_name} <{meta.getProperty('homepage')}>`__
.. |min_qgis_ver| replace:: {meta.getProperty('qgisMinimumVersion')}
.. |app_url| replace:: `{app_name} <{meta.getHomeUrl()}>`__
.. |min_qgis_ver| replace:: {meta.getQqisMinimumVersion()}
.. |path_to_settings| replace:: :menuselection:`[path_to_settings]`
"""

Expand Down
8 changes: 6 additions & 2 deletions geocatbridge/utils/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
from pathlib import Path
from re import compile

from qgis.core import Qgis

#: GeoCat Bridge plugin namespace
PLUGIN_NAMESPACE = "geocatbridge"

Expand Down Expand Up @@ -130,6 +128,12 @@ def getLongAppNameWithCurrentVersion() -> str:

def getCurrentQgisVersion() -> str:
""" Returns the current QGIS version string. """
try:
# Lazy import to prevent crashes when running outside QGIS environment
from qgis.core import Qgis
except (ImportError, ModuleNotFoundError):
return "QGIS version unknown"

version = Qgis().version()
revision = Qgis().QGIS_DEV_VERSION
if revision:
Expand Down

0 comments on commit e9ae3af

Please sign in to comment.