Annoyances:

Gentoo’s way of managing packages is flexible such that you can have several versions (a.k.a. “slots”) of the same package installed on the system. This is great for development such as in python, because you can have python-2.7 and python-3.x installed on the system and develop for both trees. And for Python, Gentoo has extended the slot concept to having python “targets”, since there are multiple, independent interpreters for python, e.g. C Python, PyPy, or Jython.

Geoscript’s setup tools definitely don’t take this into account. The start up script (given, it’s just a 10 line shell script) just kind of assumes that the interpreter is named “jython”, when in fact, I have two jythons… jython (2.2) and jython2.5. Turns out that I didn’t really need the crusty jython version, so I got rid of it, reinstalled jython2.5 and manually added a symlink :/

The start up script is kind of broken:

james@basalt ~/code/src/geoscript-1.3-20130322 $ geoscript
/usr/bin/geoscript-classpath: line 3: from: command not found
/usr/bin/geoscript-classpath: line 4: from: command not found
/usr/bin/geoscript-classpath: line 6: syntax error near unexpected token `"geoscript.bootstrap",'
/usr/bin/geoscript-classpath: line 6: `System.setProperty("geoscript.bootstrap", "true")'
Jython 2.5.3 (, Jun 5 2013, 10:37:23) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
Type "help", "copyright", "credits" or "license" for more information.
>>>

geoscript-classpath, doesn’t have a shebang at the beginning.

Install docs don’t say anything about installing GeoTools, but one needs that in the CLASSPATH as well.

And then…

james@basalt ~/code/src/geoscript-1.3-20130322 $ jython
Exception in thread "main" java.lang.NoClassDefFoundError: :/usr/share/jython-2/5/lib/jython/jar:/usr/share/antlr-3/lib/antlr3/jar:/usr/share/asm-3/lib/asm/jar:/usr/share/asm-3/lib/asm-analysis/jar:/usr/share/asm-3/lib/asm-commons/jar:/usr/share/asm-3/lib/asm-tree/jar:/usr/share/asm-3/lib/asm-util/jar:/usr/share/asm-3/lib/asm-xml/jar:/usr/share/guava/lib/guava/jar:/usr/share/jffi-1/0/lib/jffi/jar:/usr/share/jline/lib/jline/jar:/usr/share/jnr-constants/lib/jnr-constants/jar:/usr/share/jnr-posix-1/1/lib/jnr-posix/jar:/usr/share/libreadline-java/lib/libreadline-java/jar:/usr/share/tomcat-servlet-api-2/5/lib/jsp-api/jar:/usr/share/tomcat-servlet-api-2/5/lib/servlet-api/jar:/usr/share/jdbc-postgresql/lib/jdbc-postgresql/jar:/usr/share/jsr305/lib/jsr305/jar:/usr/share/antlr/lib/antlr/jar:/usr/share/stringtemplate/lib/stringtemplate/jar:/usr/share/jnr-ffi-0/5/lib/jnr-ffi/jar:/usr/share/junit/lib/junit/jar:/usr/share/jnr-x86asm-1/0/lib/jnr-x86asm/jar
Caused by: java.lang.ClassNotFoundException: :.usr.share.jython-2.5.lib.jython.jar:.usr.share.antlr-3.lib.antlr3.jar:.usr.share.asm-3.lib.asm.jar:.usr.share.asm-3.lib.asm-analysis.jar:.usr.share.asm-3.lib.asm-commons.jar:.usr.share.asm-3.lib.asm-tree.jar:.usr.share.asm-3.lib.asm-util.jar:.usr.share.asm-3.lib.asm-xml.jar:.usr.share.guava.lib.guava.jar:.usr.share.jffi-1.0.lib.jffi.jar:.usr.share.jline.lib.jline.jar:.usr.share.jnr-constants.lib.jnr-constants.jar:.usr.share.jnr-posix-1.1.lib.jnr-posix.jar:.usr.share.libreadline-java.lib.libreadline-java.jar:.usr.share.tomcat-servlet-api-2.5.lib.jsp-api.jar:.usr.share.tomcat-servlet-api-2.5.lib.servlet-api.jar:.usr.share.jdbc-postgresql.lib.jdbc-postgresql.jar:.usr.share.jsr305.lib.jsr305.jar:.usr.share.antlr.lib.antlr.jar:.usr.share.stringtemplate.lib.stringtemplate.jar:.usr.share.jnr-ffi-0.5.lib.jnr-ffi.jar:.usr.share.junit.lib.junit.jar:.usr.share.jnr-x86asm-1.0.lib.jnr-x86asm.jar
       at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: :/usr/share/jython-2.5/lib/jython.jar:/usr/share/antlr-3/lib/antlr3.jar:/usr/share/asm-3/lib/asm.jar:/usr/share/asm-3/lib/asm-analysis.jar:/usr/share/asm-3/lib/asm-commons.jar:/usr/share/asm-3/lib/asm-tree.jar:/usr/share/asm-3/lib/asm-util.jar:/usr/share/asm-3/lib/asm-xml.jar:/usr/share/guava/lib/guava.jar:/usr/share/jffi-1.0/lib/jffi.jar:/usr/share/jline/lib/jline.jar:/usr/share/jnr-constants/lib/jnr-constants.jar:/usr/share/jnr-posix-1.1/lib/jnr-posix.jar:/usr/share/libreadline-java/lib/libreadline-java.jar:/usr/share/tomcat-servlet-api-2.5/lib/jsp-api.jar:/usr/share/tomcat-servlet-api-2.5/lib/servlet-api.jar:/usr/share/jdbc-postgresql/lib/jdbc-postgresql.jar:/usr/share/jsr305/lib/jsr305.jar:/usr/share/antlr/lib/antlr.jar:/usr/share/stringtemplate/lib/stringtemplate.jar:/usr/share/jnr-ffi-0.5/lib/jnr-ffi.jar:/usr/share/junit/lib/junit.jar:/usr/share/jnr-x86asm-1.0/lib/jnr-x86asm.jar. Program will exit.

Well… maybe let’s just try to use the jars straight out of the package:

james@basalt ~/code/src/geoscript-1.3-20130322/jars $ export CLASSPATH=/home/james/code/src/geoscript-1.3-20130322/jars/*
james@basalt ~/code/src/geoscript-1.3-20130322/jars $ jython
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-gml2-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xalan-2.6.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-utils-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-anim-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-image-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-data-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-css-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-process-geometry-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalmrsidjp2-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-ows-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/picocontainer-1.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/hsqldb-1.8.0.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalnitf-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-kml-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-grid-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/ehcache-1.6.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-svg-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalerdasimg-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalmrsid-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/net.opengis.fes-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/fop-0.94.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-tiff-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-metadata-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-imagereadmt-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-collections-3.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-dom-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/common-2.6.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/json-simple-1.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-graph-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-teradata-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-process-feature-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/net.opengis.ows-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-charts-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-imageio-ext-gdal-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/ecore-2.6.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-wfs-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-dbcp-1.3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-process-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-bridge-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-rangelookup-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jai_imageio-1.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-filter-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdal-bindings-1.9.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-vectorize-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/geodb-0.7-RC2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jsr-275-1.0-beta-2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/junit-3.8.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/geoscript-py-java-1.3-SNAPSHOT.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-h2-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalecwjp2-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jai_codec-1.1.3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-core-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xercesImpl-2.7.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalenvihdr-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalrpftoc-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/net.opengis.wfs-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-api-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalarcbinarygrid-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-property-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalehdr-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xmlgraphics-commons-1.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalkakadujp2-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/vecmath-1.3.2.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-swing-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-utilities-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-svggen-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-jxpath-1.3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jai_core-1.1.3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-beanutils-1.7.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jcommon-1.0.13.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-gml3-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-zonalstats-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-vectorbinarize-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xsd-2.6.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalframework-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-opengis-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-geojson-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-logging-1.0.3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-process-raster-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-streams-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jdom-1.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-contour-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-ext-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-gvt-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-pool-1.5.4.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xml-apis-1.3.04.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-coverage-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-svg-dom-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jts-1.13.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-cql-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-main-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-imagemosaic-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-postgis-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/mysql-connector-java-5.1.17.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/org.w3.xlink-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/postgresql-8.4-701.jdbc3.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-util-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-mysql-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-geotiff-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xml-apis-ext-1.3.04.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/commons-io-2.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/hatbox-1.0.b7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/xml-apis-xerces-2.7.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-awt-util-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jfreechart-1.0.10.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-script-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-render-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-shapefile-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jgridshift-1.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-xsd-fes-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-geocore-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/avalon-framework-api-4.3.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/jt-attributeop-1.3.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-jdbc-oracle-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/miglayout-3.7-swing.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalidrisi-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-parser-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/h2-1.1.119.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/eastwood-1.1.1-20090908.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-xml-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-epsg-hsql-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdaldted-1.1.6.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/gt-referencing-9.0.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/batik-transcoder-1.7.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/avalon-framework-impl-4.3.1.jar'
*sys-package-mgr*: processing new jar, '/home/james/code/src/geoscript-1.3-20130322/jars/imageio-ext-gdalecw-1.1.6.jar'
Jython 2.5.3 (, Jun 5 2013, 10:37:23) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
Type "help", "copyright", "credits" or "license" for more information.
>>> import geoscript
>>> 

That works, so looks like the installer is not putting the jars in the right place. Although…

>>> # badness
>>> from geoscript import geom
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name geom
>>> # goodness
>>> from geoscript import proj


>>> from geoscript import layer
Traceback (most recent call last):
  File "", line 1, in 
ImportError: cannot import name layer
>>> import geoscript.style
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named style
>>> import geoscript.render
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named render


Jesus, do we have anything?

Oh... that's because I hacked on the setup.py script to not require setuptools.find_packages and I didn't enumerate all of the pacakges. Doh.

james@basalt ~/code/src $ export CLASSPATH="/home/james/code/src/geoscript-1.3-20130322/jars/*"
james@basalt ~/code/src $ jython
Jython 2.5.3 (, Jun 5 2013, 10:37:23) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
Type "help", "copyright", "credits" or "license" for more information.
>>> import geoscript
>>> import geoscript.geom
>>> 
There we go. But yeah, the install script definitely doesn't copy the jars. Result of CLASSPATH with a newline at the end (from print).
james@basalt /usr/share/jython-2.5/Lib/site-packages/geoscript $ CLASSPATH=`jython /usr/bin/geoscript-classpath` jython
Exception in thread "main" java.lang.NoClassDefFoundError: /usr/share/jython-2/5/jars/avalon-framework-impl-4/3/1/jar
Caused by: java.lang.ClassNotFoundException: .usr.share.jython-2.5.jars.avalon-framework-impl-4.3.1.jar
       at java.net.URLClassLoader$1.run(URLClassLoader.java:217)
       at java.security.AccessController.doPrivileged(Native Method)
       at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:321)
       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
       at java.lang.ClassLoader.loadClass(ClassLoader.java:266)
Could not find the main class: /usr/share/jython-2.5/jars/avalon-framework-impl-4.3.1.jar. Program will exit.
The shell script (geoscript) which calls a python script (geoscript-classpath) to set up the environment to the envoke python (!) seems kinda silly. Why can't python just set up it's own environment and do everything in one script. Take out the middle man! Well, I wrote a quick script to do just that:
#!python                                                                                                                                                    

import sys, os
from glob import glob
from subprocess	 import Popen

jar_dir = os.path.join(sys.prefix, 'jars', '*')
jar_files = glob(jar_dir)
cp_string = ':'.join(jar_files)
cp_string = '-Dpython.path=' + cp_string

os.execv(sys.executable, cp_string)         
It's super simple and would work great, but unfortunately, my version of jython doesn't seem to ship with os.execv (even though the docs say that it does). Oh well... jython->bash-jython it is.
>>> from geoscript.render import draw
Jun 5, 2013 3:24:31 PM it.geosolutions.imageio.gdalframework.GDALUtilities loadGDAL
WARNING: Failed to load the GDAL native libs. This is not a problem unless you need to use the GDAL plugins: they won't be enabled.
java.lang.UnsatisfiedLinkError: no gdaljni in java.library.path
Error import module spatialite: No module named spatialite
So, we need spatialite? I finally got the geoserver scripting extension installed and figured out the access URL (http://[server]:8080/geoserver/script/apps/[app_name]/ which is in the docs, but took me forever to find). But... wait a minute... which python binary is it using and how to I install and use other python packages? In particular all of the ones that we wrote? sys.path shows up as being ['/var/lib/tomcat6/webapps-available/geoserver232/geoserver_data/scripts/lib/py', '/var/lib/tomcat6/webapps-available/geoserver232/WEB-INF/lib/Lib', '/var/lib/tomcat6/webapps-available/geoserver232/WEB-INF/lib/jython-2.5.2.jar/Lib', '__classpath__', '__pyclasspath__/'], so I guess we can just plunk stuff down in [GEOSERVER_DATA]/scripts/lib/py, but it'd be nice if we could continue to manage that with pip and stuff. Maybe I can create a virtualenv there? Let's see. Nope. -----


blog comments powered by Disqus

Published

16 July 2013

Category

work

Tags