1 |
# Copyright (C) 2003, 2004 by Intevation GmbH |
# Copyright (C) 2003, 2004, 2005 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
4 |
# |
# |
396 |
server -- The PostgreSQLServer instance containing the |
server -- The PostgreSQLServer instance containing the |
397 |
database |
database |
398 |
|
|
399 |
postgis_sql -- Filename of the postgis.sql file with the |
postgis_sql -- Filename of the sql file with the postgis |
400 |
postgis initialization code |
initialization code |
401 |
|
|
402 |
dbname -- The name of the database |
dbname -- The name of the database |
403 |
|
|
508 |
$bindir/../share/postgresql/. |
$bindir/../share/postgresql/. |
509 |
|
|
510 |
Furthermore, different versions of postgis place the file in |
Furthermore, different versions of postgis place the file in |
511 |
slightly different locations. For instance: |
slightly different locations or may even use different names. For |
512 |
|
instance: |
513 |
|
|
514 |
postgis 0.7.5 $datadir/contrib/postgis.sql |
postgis 0.7.5 $datadir/contrib/postgis.sql |
515 |
postgis 0.8.1 $datadir/postgis.sql |
postgis 0.8.1 $datadir/postgis.sql |
516 |
|
postgis 1.0.0-rc1 $datadir/lwpostgis.sql |
517 |
|
|
518 |
To support both versions, we look in both places and return the |
To support both versions, we look in both places and return the |
519 |
first one found (looking under contrib first). If the file is not |
first one found (looking under contrib first). If the file is not |
522 |
bindir = run_config_script("pg_config --bindir").strip() |
bindir = run_config_script("pg_config --bindir").strip() |
523 |
datadir = os.path.join(bindir, "..", "share", "postgresql") |
datadir = os.path.join(bindir, "..", "share", "postgresql") |
524 |
for filename in [os.path.join(datadir, "contrib", "postgis.sql"), |
for filename in [os.path.join(datadir, "contrib", "postgis.sql"), |
525 |
os.path.join(datadir, "postgis.sql")]: |
os.path.join(datadir, "postgis.sql"), |
526 |
|
os.path.join(datadir, "lwpostgis.sql")]: |
527 |
if os.path.exists(filename): |
if os.path.exists(filename): |
528 |
return filename |
return filename |
529 |
|
|