[Thuban-commits] r2714 - in trunk/thuban: . test
scm-commit@wald.intevation.org
scm-commit at wald.intevation.org
Mon Nov 6 11:09:15 CET 2006
Author: bernhard
Date: 2006-11-06 11:09:14 +0100 (Mon, 06 Nov 2006)
New Revision: 2714
Modified:
trunk/thuban/ChangeLog
trunk/thuban/test/postgissupport.py
Log:
Fixing the possibility to run postgis tests on Debian Etch (80%).
* test/postgissupport.py: Taking pg_ctl and initdb commands
from internal variables now. Adding deactivated example values
for Debian Etch.
find_postgis_sql(): Added special line for Debian Etch postgresql-8.1.
Added copyright year 2006.
Modified: trunk/thuban/ChangeLog
===================================================================
--- trunk/thuban/ChangeLog 2006-10-26 16:37:42 UTC (rev 2713)
+++ trunk/thuban/ChangeLog 2006-11-06 10:09:14 UTC (rev 2714)
@@ -1,3 +1,13 @@
+2006-11-06 Bernhard Reiter <bernhard at intevation.de>
+
+ Fixing the possibility to run postgis tests on Debian Etch (80%).
+
+ * test/postgissupport.py: Taking pg_ctl and initdb commands
+ from internal variables now. Adding deactivated example values
+ for Debian Etch.
+ find_postgis_sql(): Added special line for Debian Etch postgresql-8.1.
+ Added copyright year 2006.
+
2006-10-25 Bernhard Reiter <bernhard at intevation.de>
Moved ogr Extension to Extension menu.
Modified: trunk/thuban/test/postgissupport.py
===================================================================
--- trunk/thuban/test/postgissupport.py 2006-10-26 16:37:42 UTC (rev 2713)
+++ trunk/thuban/test/postgissupport.py 2006-11-06 10:09:14 UTC (rev 2714)
@@ -1,4 +1,4 @@
-# Copyright (C) 2003, 2004, 2005 by Intevation GmbH
+# Copyright (C) 2003, 2004, 2005, 2006 by Intevation GmbH
# Authors:
# Bernhard Herzog <bh at intevation.de>
#
@@ -85,6 +85,13 @@
# PostgreSQL and database
#
+_pg_ctl_command = "pg_ctl"
+_initdb_command = "initdb"
+# Example Values for Debian (upcomind Etch) postgresql-8.1
+# TODO: detect which values to use here.
+#_pg_ctl_command = "/usr/lib/postgresql/8.1/bin/pg_ctl"
+#_initdb_command = "/usr/lib/postgresql/8.1/bin/initdb"
+
class PostgreSQLServer:
"""A PostgreSQL server
@@ -142,13 +149,13 @@
shutil.rmtree(self.dbdir)
os.mkdir(self.dbdir)
- run_command(["initdb", "-D", self.dbdir, "-U", self.admin_name],
+ run_command([_initdb_command, "-D", self.dbdir, "-U", self.admin_name],
os.path.join(self.dbdir, "initdb.log"))
extra_opts = "-p %d" % self.port
if self.socket_dir is not None:
extra_opts += " -k %s" % self.socket_dir
- run_command(["pg_ctl", "-D", self.dbdir,
+ run_command([_pg_ctl_command, "-D", self.dbdir,
"-l", os.path.join(self.dbdir, "logfile"),
"-o", extra_opts, "start"],
os.path.join(self.dbdir, "pg_ctl-start.log"))
@@ -196,11 +203,11 @@
instance, if the server has been started manually for debugging
purposes after a test suite run.
"""
- return run_boolean_command(["pg_ctl", "-D", self.dbdir, "status"])
+ return run_boolean_command([_pg_ctl_command, "-D", self.dbdir, "status"])
def shutdown(self):
"""Stop the postmaster running for self.dbdir"""
- run_command(["pg_ctl", "-m", "fast", "-D", self.dbdir, "stop"],
+ run_command([_pg_ctl_command, "-m", "fast", "-D", self.dbdir, "stop"],
os.path.join(self.dbdir, "pg_ctl-stop.log"))
def new_postgis_db(self, dbname, tables = None, reference_systems = None,
@@ -368,7 +375,7 @@
f = open(os.path.join(self.dbdir, "pg_hba.conf"), "w")
f.write(contents)
f.close()
- run_command(["pg_ctl", "-D", self.dbdir, "reload"],
+ run_command([_pg_ctl_command, "-D", self.dbdir, "reload"],
os.path.join(self.dbdir, "pg_ctl-reload.log"))
@@ -517,15 +524,24 @@
postgis 1.0.0-rc4 $datadir/contrib/lwpostgis.sql
To support both versions, we look in both places and return the
- first one found (looking under contrib first). If the file is not
- found the return value is None.
+ first one found (looking under contrib first).
+
+ Debian (umcoming Etch) can do several version of postgresql
+ and thus has changed the paths. We try one location
+ in datadir2 only for Debian Etch postgresql-8.1.
+
+ If the file is not found the return value is None.
"""
bindir = run_config_script("pg_config --bindir").strip()
datadir = os.path.join(bindir, "..", "share", "postgresql")
+ datadir2 = os.path.join("/", "usr", "share", "postgresql-8.1-postgis")
+
for filename in [os.path.join(datadir, "contrib", "postgis.sql"),
os.path.join(datadir, "postgis.sql"),
os.path.join(datadir, "lwpostgis.sql"),
- os.path.join(datadir, "contrib", "lwpostgis.sql")]:
+ os.path.join(datadir, "contrib", "lwpostgis.sql"),
+ os.path.join(datadir2, "lwpostgis.sql") \
+ ]:
if os.path.exists(filename):
return filename
@@ -578,7 +594,7 @@
return "Can't run PostGIS test because popen2.Popen4 does not exist"
try:
- run_command(["pg_ctl", "--help"], None)
+ run_command([_pg_ctl_command, "--help"], None)
except RuntimeError:
return "Can't run PostGIS tests because pg_ctl fails"
More information about the Thuban-commits
mailing list