summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Kreen2007-04-09 14:45:46 +0000
committerMarko Kreen2007-04-09 14:45:46 +0000
commitc86ea29bb880dc6e40a96b49ba913e12588eacde (patch)
treed64c9e85887bb3565394894715fbd7fbf87b5d23
parent1d2342d0ec3c3e01fa6c1256fe81628592fbdf24 (diff)
remember where the installer config files were actually installed
-rw-r--r--configure.ac13
-rw-r--r--python/skytools/installer_config.py.in4
-rw-r--r--python/skytools/sqltools.py13
3 files changed, 28 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac
index f77d027f..e3b28f6c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,17 @@ AC_ARG_WITH(pgconfig, [ --with-pgconfig=PG_CONFIG path to pg_config (default
[ AC_PATH_PROGS(PG_CONFIG, pg_config) ])
test -n "$PG_CONFIG" || AC_MSG_ERROR([Cannot continue without pg_config])
+AC_MSG_CHECKING(where PostgreSQL SQL extensions are installed)
+cat > conftest.mak <<EOF
+PGXS = \$(shell $PG_CONFIG --pgxs)
+include \$(PGXS)
+finddir:
+ echo "\$(datadir)/contrib"
+EOF
+SQLDIR=`make -s -f conftest.mak finddir`
+AC_MSG_RESULT($SQLDIR)
+AC_SUBST(SQLDIR)
+
dnl Write result
-AC_OUTPUT([config.mak])
+AC_OUTPUT([config.mak python/skytools/installer_config.py])
diff --git a/python/skytools/installer_config.py.in b/python/skytools/installer_config.py.in
new file mode 100644
index 00000000..06c9b956
--- /dev/null
+++ b/python/skytools/installer_config.py.in
@@ -0,0 +1,4 @@
+
+sql_locations = [
+ "@SQLDIR@",
+]
diff --git a/python/skytools/sqltools.py b/python/skytools/sqltools.py
index 7214b3ae..b1f9b1df 100644
--- a/python/skytools/sqltools.py
+++ b/python/skytools/sqltools.py
@@ -3,7 +3,17 @@
import os
from cStringIO import StringIO
-from quoting import quote_copy, quote_literal
+from skytools.quoting import quote_copy, quote_literal
+import skytools.installer_config
+
+__all__ = [
+ "fq_name_parts", "fq_name", "get_table_oid", "get_table_pkeys",
+ "get_table_columns", "exists_schema", "exists_table", "exists_type",
+ "exists_function", "exists_language", "Snapshot", "magic_insert",
+ "db_copy_from_dict", "db_copy_from_list", "CopyPipe", "full_copy",
+ "DBObject", "DBSchema", "DBTable", "DBFunction", "DBLanguage",
+ "db_install"
+]
#
# Fully qualified table name
@@ -357,6 +367,7 @@ class DBObject(object):
if self.sql_file[0] == "/":
full_fn = self.sql_file
else:
+ dir_list = skytools.installer_config.dir_list
contrib_list = [
"/opt/pgsql/share/contrib",
"/usr/share/postgresql/8.0/contrib",