Add Python/Ruby bindings to GEOS package (#8218)
* Add python/ruby bindings to GEOS package * Add comment on Python 3 support
This commit is contained in:
		| @@ -25,7 +25,7 @@ | |||||||
| from spack import * | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
| class Geos(Package): | class Geos(AutotoolsPackage): | ||||||
|     """GEOS (Geometry Engine - Open Source) is a C++ port of the Java |     """GEOS (Geometry Engine - Open Source) is a C++ port of the Java | ||||||
|        Topology Suite (JTS). As such, it aims to contain the complete |        Topology Suite (JTS). As such, it aims to contain the complete | ||||||
|        functionality of JTS in C++. This includes all the OpenGIS |        functionality of JTS in C++. This includes all the OpenGIS | ||||||
| @@ -33,15 +33,12 @@ class Geos(Package): | |||||||
|        operators, as well as specific JTS enhanced topology functions.""" |        operators, as well as specific JTS enhanced topology functions.""" | ||||||
|  |  | ||||||
|     homepage = "http://trac.osgeo.org/geos/" |     homepage = "http://trac.osgeo.org/geos/" | ||||||
|     url      = "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2" |     url      = "http://download.osgeo.org/geos/geos-3.6.2.tar.bz2" | ||||||
|  |  | ||||||
|     # Versions from 3.5.1 support Autotools and CMake |  | ||||||
|     version('3.6.2', 'a32142343c93d3bf151f73db3baa651f') |     version('3.6.2', 'a32142343c93d3bf151f73db3baa651f') | ||||||
|     version('3.6.1', 'c97e338b3bc81f9848656e9d693ca6cc') |     version('3.6.1', 'c97e338b3bc81f9848656e9d693ca6cc') | ||||||
|     version('3.6.0', '55de5fdf075c608d2d7b9348179ee649') |     version('3.6.0', '55de5fdf075c608d2d7b9348179ee649') | ||||||
|     version('3.5.1', '2e3e1ccbd42fee9ec427106b65e43dc0') |     version('3.5.1', '2e3e1ccbd42fee9ec427106b65e43dc0') | ||||||
|  |  | ||||||
|     # Versions through 3.5.0 have CMake, but only Autotools is supported |  | ||||||
|     version('3.5.0', '136842690be7f504fba46b3c539438dd') |     version('3.5.0', '136842690be7f504fba46b3c539438dd') | ||||||
|     version('3.4.3', '77f2c2cca1e9f49bc1bece9037ac7a7a') |     version('3.4.3', '77f2c2cca1e9f49bc1bece9037ac7a7a') | ||||||
|     version('3.4.2', 'fc5df2d926eb7e67f988a43a92683bae') |     version('3.4.2', 'fc5df2d926eb7e67f988a43a92683bae') | ||||||
| @@ -55,21 +52,39 @@ class Geos(Package): | |||||||
|     version('3.3.4', '1bb9f14d57ef06ffa41cb1d67acb55a1') |     version('3.3.4', '1bb9f14d57ef06ffa41cb1d67acb55a1') | ||||||
|     version('3.3.3', '8454e653d7ecca475153cc88fd1daa26') |     version('3.3.3', '8454e653d7ecca475153cc88fd1daa26') | ||||||
|  |  | ||||||
| #    # Python3 is not supported. |     # Ruby bindings are fully supported | ||||||
| #    variant('python', default=False, description='Enable Python support') |     variant('ruby',   default=False, description='Enable Ruby support') | ||||||
|  |  | ||||||
| #    extends('python', when='+python') |     # Since version 3.0, the Python bindings are unsupported | ||||||
| #    depends_on('python', when='+python') |     variant('python', default=False, description='Enable Python support') | ||||||
| #    depends_on('swig', when='+python') |  | ||||||
|  |  | ||||||
|     def install(self, spec, prefix): |     extends('ruby', when='+ruby') | ||||||
|         args = ["--prefix=%s" % prefix] |  | ||||||
| #        if '+python' in spec: |  | ||||||
| #            os.environ['PYTHON'] = spec['python'].command.path |  | ||||||
| #            os.environ['SWIG'] = spec['swig'].command.path |  | ||||||
| # |  | ||||||
| #            args.append("--enable-python") |  | ||||||
|  |  | ||||||
|         configure(*args) |     # Python 3 is supposedly supported, but I couldn't get it to work | ||||||
|         make() |     # https://trac.osgeo.org/geos/ticket/774 | ||||||
|         make("install") |     extends('python@:2', when='+python') | ||||||
|  |  | ||||||
|  |     depends_on('swig', type='build', when='+ruby') | ||||||
|  |     depends_on('swig', type='build', when='+python') | ||||||
|  |  | ||||||
|  |     # `make check` fails with: | ||||||
|  |     # FAIL: geos_unit | ||||||
|  |  | ||||||
|  |     # I wasn't able to get the ruby bindings working. | ||||||
|  |     # It resulted in "Undefined symbols for architecture x86_64". | ||||||
|  |  | ||||||
|  |     def configure_args(self): | ||||||
|  |         spec = self.spec | ||||||
|  |         args = [] | ||||||
|  |  | ||||||
|  |         if '+ruby' in spec: | ||||||
|  |             args.append('--enable-ruby') | ||||||
|  |         else: | ||||||
|  |             args.append('--disable-ruby') | ||||||
|  |  | ||||||
|  |         if '+python' in spec: | ||||||
|  |             args.append('--enable-python') | ||||||
|  |         else: | ||||||
|  |             args.append('--disable-python') | ||||||
|  |  | ||||||
|  |         return args | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Adam J. Stewart
					Adam J. Stewart