bh: thuban/libraries/pyshapelib setup.py,1.2,1.3

cvs@intevation.de cvs at intevation.de
Fri May 28 19:29:00 CEST 2004


Author: bh

Update of /thubanrepository/thuban/libraries/pyshapelib
In directory doto:/tmp/cvs-serv10938/libraries/pyshapelib

Modified Files:
	setup.py 
Log Message:
* setup.py: Determine shp_dir correctly when run with bdist_rpm
(dbf_macros): Remove a debug print


Index: setup.py
===================================================================
RCS file: /thubanrepository/thuban/libraries/pyshapelib/setup.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- setup.py	17 May 2004 15:47:57 -0000	1.2
+++ setup.py	28 May 2004 17:28:57 -0000	1.3
@@ -1,5 +1,6 @@
 
 import os
+import sys
 from distutils.core import setup, Extension
 from distutils.util import convert_path
 
@@ -11,16 +12,23 @@
 # 2. Built in the Thuban source tree where ../shapelib/ relative to the
 #    directory containing this setup.py contains (the relevant parts of)
 #    shapelib
+#
+# 3. Binary build with e.g. bdist_rpm.  This takes place deep in the
+#    build directory.
 
 # os.path expects filenames in OS-specific form so we have to construct
 # the files with os.path functions. distutils, OTOH, uses posix-style
 # filenames exclusively, so we use posix conventions when making
 # filenames for distutils.
-for shp_dir in ["..", "../shapelib"]:
-    if os.path.exists(os.path.join(convert_path(shp_dir), "shpopen.c")):
+for shp_dir in ["..", "../shapelib", "../../../../../../shapelib"]:
+    if (os.path.isdir(convert_path(shp_dir))
+        and os.path.exists(os.path.join(convert_path(shp_dir), "shpopen.c"))):
         # shp_dir contains shpopen.c, so assume it's the directory with
         # the shapefile library to use
         break
+else:
+    print >>sys.stderr, "no shapelib directory found"
+    sys.exit(1)
 
 def dbf_macros():
     """Return the macros to define when compiling the dbflib wrapper.
@@ -34,7 +42,6 @@
     f = open(convert_path(shp_dir + "/shapefil.h"))
     contents = f.read()
     f.close()
-    print contents.find("DBFUpdateHeader")
     if contents.find("DBFUpdateHeader") >= 0:
         return [("HAVE_UPDATE_HEADER", "1")]
     else:





More information about the Thuban-devel mailing list

This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)