From: <js...@us...> - 2008-12-18 20:20:21
|
Revision: 6678 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6678&view=rev Author: jswhit Date: 2008-12-18 20:20:18 +0000 (Thu, 18 Dec 2008) Log Message: ----------- check for already installed pyshapelib Modified Paths: -------------- trunk/toolkits/basemap/Changelog trunk/toolkits/basemap/README trunk/toolkits/basemap/setup.cfg trunk/toolkits/basemap/setup.py Modified: trunk/toolkits/basemap/Changelog =================================================================== --- trunk/toolkits/basemap/Changelog 2008-12-18 19:40:26 UTC (rev 6677) +++ trunk/toolkits/basemap/Changelog 2008-12-18 20:20:18 UTC (rev 6678) @@ -1,4 +1,6 @@ version 0.99.3 (not yet released) + * have setup.py check for already installed pyshapelib (just + like it does for httplib2 and pydap). * Basemap will now look for it's data in BASEMAPDATA. If that env var not set, it will fall back to it's default location. Modified: trunk/toolkits/basemap/README =================================================================== --- trunk/toolkits/basemap/README 2008-12-18 19:40:26 UTC (rev 6677) +++ trunk/toolkits/basemap/README 2008-12-18 20:20:18 UTC (rev 6678) @@ -100,11 +100,11 @@ by running "from mpl_toolkits.basemap import Basemap" at the python prompt. -Basemap includes two auxilliary packages, pydap (http://pydap.org, just -the client is included) and httplib2. By default, setup.py checks to +Basemap includes three auxilliary packages, pydap (http://pydap.org, just +the client is included), httplib2 and pyshapelib. By default, setup.py checks to see if these are already installed, and if so does not try to overwrite them. If you get import errors related to either of these two packages, -edit setup.cfg and set pydap and/or httplib2 to True to force +edit setup.cfg and set pydap, httplib2 and/or pyshapelib to True to force installation of the included versions. 4) To test, cd to the examples directory and run 'python simpletest.py'. Modified: trunk/toolkits/basemap/setup.cfg =================================================================== --- trunk/toolkits/basemap/setup.cfg 2008-12-18 19:40:26 UTC (rev 6677) +++ trunk/toolkits/basemap/setup.cfg 2008-12-18 20:20:18 UTC (rev 6678) @@ -2,9 +2,10 @@ # By default, basemap checks for a few dependencies and # installs them if missing. This feature can be turned off # by uncommenting the following lines. Acceptible values are: -# True: install, overwrite an existing installation +# auto: install, overwrite an existing installation # False: do not install # auto: install only if the package is unavailable. This # is the default behavior pydap = auto httplib2 = auto +pyshapelib = auto Modified: trunk/toolkits/basemap/setup.py =================================================================== --- trunk/toolkits/basemap/setup.py 2008-12-18 19:40:26 UTC (rev 6677) +++ trunk/toolkits/basemap/setup.py 2008-12-18 20:20:18 UTC (rev 6678) @@ -99,25 +99,6 @@ include_dirs=geos_include_dirs, libraries=['geos_c','geos'])) -# install shapelib and dbflib. -packages = packages + ['shapelib','dbflib'] -package_dirs['shapelib'] = os.path.join('lib','shapelib') -package_dirs['dbflib'] = os.path.join('lib','dbflib') -extensions = extensions + \ - [Extension("shapelibc", - ["pyshapelib/shapelib_wrap.c", - "pyshapelib/shapelib/shpopen.c", - "pyshapelib/shapelib/shptree.c"], - include_dirs = ["pyshapelib/shapelib"]), - Extension("shptree", - ["pyshapelib/shptreemodule.c"], - include_dirs = ["pyshapelib/shapelib"]), - Extension("dbflibc", - ["pyshapelib/dbflib_wrap.c", - "pyshapelib/shapelib/dbfopen.c"], - include_dirs = ["pyshapelib/shapelib"], - define_macros = dbf_macros()) ] - # check setup.cfg file to see how to install auxilliary packages. options = {} if os.path.exists("setup.cfg"): @@ -128,10 +109,14 @@ except: options['provide_pydap'] = 'auto' try: options['provide_httplib2'] = config.getboolean("provide_packages", "httplib2") except: options['provide_httplib2'] = 'auto' + try: options['provide_pyshapelib'] = config.getboolean("provide_packages", "pyshapelib") + except: options['provide_pyshapelib'] = 'auto' else: options['provide_pydap'] = 'auto' options['provide_httplib2'] = 'auto' + options['provide_pyshapelib'] = 'auto' + provide_pydap = options['provide_pydap'] if provide_pydap == 'auto': # install pydap stuff if not already available. # only the client is installed (not the server). @@ -171,16 +156,65 @@ except ImportError: print 'httplib2 not installed, will be installed' packages = packages + ['httplib2'] - package_dirs['httlib2'] = os.path.join('lib','httplib2') + package_dirs['httplib2'] = os.path.join('lib','httplib2') else: print 'httplib2 installed' elif provide_httplib2: # force install of httplib2 print 'forcing install of included httplib2' packages = packages + ['httplib2'] - package_dirs['httlib2'] = os.path.join('lib','httplib2') + package_dirs['httplib2'] = os.path.join('lib','httplib2') else: print 'will not install httplib2' +provide_pyshapelib = options['provide_pyshapelib'] +if provide_pyshapelib == 'auto': + print 'checking to see if pyshapelib installed ..' + try: + import shapelib + import dbflib + except ImportError: + print 'shapelib/dbflib not installed, will be installed' + packages = packages + ['shapelib','dbflib'] + package_dirs['shapelib'] = os.path.join('lib','shapelib') + package_dirs['dbflib'] = os.path.join('lib','dbflib') + extensions = extensions + \ + [Extension("shapelibc", + ["pyshapelib/shapelib_wrap.c", + "pyshapelib/shapelib/shpopen.c", + "pyshapelib/shapelib/shptree.c"], + include_dirs = ["pyshapelib/shapelib"]), + Extension("shptree", + ["pyshapelib/shptreemodule.c"], + include_dirs = ["pyshapelib/shapelib"]), + Extension("dbflibc", + ["pyshapelib/dbflib_wrap.c", + "pyshapelib/shapelib/dbfopen.c"], + include_dirs = ["pyshapelib/shapelib"], + define_macros = dbf_macros()) ] + else: + print 'pyshapelib installed' +elif provide_pyshapelib: # force install of shapelib + print 'forcing install of included pyshapelib' + packages = packages + ['shapelib','dbflib'] + package_dirs['shapelib'] = os.path.join('lib','shapelib') + package_dirs['dbflib'] = os.path.join('lib','dbflib') + extensions = extensions + \ + [Extension("shapelibc", + ["pyshapelib/shapelib_wrap.c", + "pyshapelib/shapelib/shpopen.c", + "pyshapelib/shapelib/shptree.c"], + include_dirs = ["pyshapelib/shapelib"]), + Extension("shptree", + ["pyshapelib/shptreemodule.c"], + include_dirs = ["pyshapelib/shapelib"]), + Extension("dbflibc", + ["pyshapelib/dbflib_wrap.c", + "pyshapelib/shapelib/dbfopen.c"], + include_dirs = ["pyshapelib/shapelib"], + define_macros = dbf_macros()) ] +else: + print 'will not install pyshapelib' + # Specify all the required mpl data pyproj_datafiles = ['data/epsg', 'data/esri', 'data/esri.extra', 'data/GL27', 'data/nad.lst', 'data/nad27', 'data/nad83', 'data/ntv2_out.dist', 'data/other.extra', 'data/pj_out27.dist', 'data/pj_out83.dist', 'data/proj_def.dat', 'data/README', 'data/td_out.dist', 'data/test27', 'data/test83', 'data/testntv2', 'data/testvarious', 'data/world','data/bmng.jpg','data/bmng_low.jpg'] boundaryfiles = [] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |