-
Notifications
You must be signed in to change notification settings - Fork 0
/
gdalconfigs
executable file
·42 lines (37 loc) · 1.19 KB
/
gdalconfigs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
## This is much like `pg_config` which shows all the options *by default* and you have to select options if you wish to see them individually.
##
## No point in implementing single option discovery. Use `gdal-config` for that!
import subprocess,sys
def main() -> int:
opts=('--libs', '--dep-libs', '--cflags', '--datadir', '--version', '--ogr-enabled', '--gnm-enabled', '--formats')
maxlen=max(len(o) for o in opts)
print(f'gdal-config can be called with: {opts}\n')
for o in opts:
res=subprocess.check_output(['gdal-config',o])
print(f'gdal-config {o:{maxlen}s} ===> {res.decode()}',end='') # res contains '\n' at the end.
return 0
if __name__ == "__main__":
ret=main()
sys.exit(ret)
## #!/usr/bin/env bash
##
## set -euo pipefail
##
## ## TRACE=1 ./script.sh to enable debug mode!
## if [[ "${TRACE-0}" == "1" ]]; then set -o xtrace; fi
##
##
## all_gdal_config() {
## local switches
## local cmd
## local s
## switches=( --libs --dep-libs --cflags --datadir --version --ogr-enabled --gnm-enabled --formats)
##
## for s in "${switches[@]}"; do
## cmd="gdal-config ${s}"
## echo "${cmd} ===> $(bash -c "${cmd}")"
## done
## }
##
## all_gdal_config