File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -96,6 +96,18 @@ def _check_ghostscript_version(gs_version: str) -> str | None:
9696 return None
9797
9898
99+ def _get_gdal_version ():
100+ """
101+ Get GDAL version.
102+ """
103+ try :
104+ from osgeo import gdal
105+
106+ return gdal .__version__
107+ except ImportError :
108+ return None
109+
110+
99111def show_versions (file = sys .stdout ):
100112 """
101113 Print various dependency versions which are useful when submitting bug reports.
@@ -120,6 +132,7 @@ def show_versions(file=sys.stdout):
120132 }
121133 deps = [Requirement (v ).name for v in importlib .metadata .requires ("pygmt" )]
122134 gs_version = _get_ghostscript_version ()
135+ gdal_version = _get_gdal_version ()
123136
124137 lines = []
125138 lines .append ("PyGMT information:" )
@@ -128,6 +141,7 @@ def show_versions(file=sys.stdout):
128141 lines .extend ([f" { key } : { val } " for key , val in sys_info .items ()])
129142 lines .append ("Dependency information:" )
130143 lines .extend ([f" { modname } : { _get_module_version (modname )} " for modname in deps ])
144+ lines .append (f" gdal: { gdal_version } " )
131145 lines .append (f" ghostscript: { gs_version } " )
132146 lines .append ("GMT library information:" )
133147 lines .extend ([f" { key } : { val } " for key , val in _get_clib_info ().items ()])
You can’t perform that action at this time.
0 commit comments