/[thuban]/branches/WIP-pyshapelib-bramz/test/postgissupport.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/test/postgissupport.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 2460 by bh, Wed Dec 15 14:01:04 2004 UTC revision 2471 by bh, Thu Dec 16 14:19:21 2004 UTC
# Line 495  def find_postgis_sql(): Line 495  def find_postgis_sql():
495      """Return the name of the postgis_sql file      """Return the name of the postgis_sql file
496    
497      A postgis installation usually has the postgis_sql file in      A postgis installation usually has the postgis_sql file in
498      PostgreSQL's datadir (i.e. the directory where PostgreSQL keeps      PostgreSQL's $datadir (i.e. the directory where PostgreSQL keeps
499      static files, not the directory containing the databases).      static files, not the directory containing the databases).
500      Unfortunately there's no way to determine the name of this directory      Unfortunately there's no way to determine the name of this directory
501      with pg_config so we assume here that it's      with pg_config so we assume here that it's
502      $bindir/../share/postgresql/.      $bindir/../share/postgresql/.
503    
504        Furthermore, different versions of postgis place the file in
505        slightly different locations.  For instance:
506    
507          postgis 0.7.5        $datadir/contrib/postgis.sql
508          postgis 0.8.1        $datadir/postgis.sql
509    
510        To support both versions, we look in both places and return the
511        first one found (looking under contrib first).  If the file is not
512        found the return value is None.
513      """      """
514      bindir = run_config_script("pg_config --bindir").strip()      bindir = run_config_script("pg_config --bindir").strip()
515      return os.path.join(bindir, "..", "share", "postgresql",      datadir = os.path.join(bindir, "..", "share", "postgresql")
516                          "contrib", "postgis.sql")      for filename in [os.path.join(datadir, "contrib", "postgis.sql"),
517                         os.path.join(datadir, "postgis.sql")]:
518            if os.path.exists(filename):
519                return filename
520    
521    
522  _postgres_server = None  _postgres_server = None
523  def get_test_server():  def get_test_server():

Legend:
Removed from v.2460  
changed lines
  Added in v.2471

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26