OpenLayers buildout recipe
I've just uploaded my first zc.buildout recipe to PyPI: http://pypi.python.org/pypi/zgeo.recipe.openlayers/. It's a recipe for creating custom builds of OpenLayers.js. Based on Kai Lautaportti's hexagonit.recipe.cmmi, it does some of the same useful tricks: working on either OpenLayers distributions (by url
option) or local checkouts (by path
option), and code patching (by patch-options
and patches
). Put a list of files in the include
option, following the OpenLayers documentation for custom build profiles, and crank out the custom compressed files.
I've put it to use in a project that implements nothing other than the Atom publishing protocol. No layers, no WxS, no strategies. My custom profile buildout configuration is very simple:
[buildout] parts = openlayers-bingo [openlayers-bingo] recipe = zgeo.recipe.openlayers path = ${buildout:directory}/src/openlayers include = OpenLayers/Format/Atom.js OpenLayers/Format/GeoJSON.js
Running it generates the output you may have seen before:
$ bin/buildout -c buildout.cfg Uninstalling openlayers-bingo. Installing openlayers-bingo. openlayers-bingo: Using local source directory: /Users/seang/code/ol-recipes/src/openlayers Merging libraries. Importing: OpenLayers.js Importing: OpenLayers/BaseTypes.js Importing: OpenLayers/SingleFile.js Importing: OpenLayers/Util.js Importing: OpenLayers/BaseTypes/Class.js Importing: OpenLayers/Format/Atom.js Importing: OpenLayers/Format/GeoJSON.js Resolution pass 1... Importing: OpenLayers/BaseTypes/Bounds.js Importing: OpenLayers/BaseTypes/Element.js Importing: OpenLayers/BaseTypes/LonLat.js Importing: OpenLayers/BaseTypes/Pixel.js Importing: OpenLayers/BaseTypes/Size.js Importing: OpenLayers/Console.js Importing: OpenLayers/Feature/Vector.js Importing: OpenLayers/Format/GML/v3.js Importing: OpenLayers/Format/JSON.js Importing: OpenLayers/Format/XML.js Importing: OpenLayers/Geometry/LineString.js Importing: OpenLayers/Geometry/MultiLineString.js Importing: OpenLayers/Geometry/MultiPoint.js Importing: OpenLayers/Geometry/MultiPolygon.js Importing: OpenLayers/Geometry/Point.js Importing: OpenLayers/Geometry/Polygon.js Importing: OpenLayers/Lang/en.js Resolution pass 2... Importing: OpenLayers/Feature.js Importing: OpenLayers/Format.js Importing: OpenLayers/Format/GML/Base.js Importing: OpenLayers/Geometry.js Importing: OpenLayers/Geometry/Collection.js Importing: OpenLayers/Geometry/Curve.js Importing: OpenLayers/Geometry/LinearRing.js Importing: OpenLayers/Lang.js Resolution pass 3... Importing: OpenLayers/Format/GML.js Importing: OpenLayers/Format/WKT.js Importing: OpenLayers/Marker.js Importing: OpenLayers/Popup/AnchoredBubble.js Resolution pass 4... Importing: OpenLayers/Events.js Importing: OpenLayers/Icon.js Importing: OpenLayers/Popup/Anchored.js Resolution pass 5... Importing: OpenLayers/Popup.js Re-ordering files... Exporting: OpenLayers/SingleFile.js Exporting: OpenLayers.js Exporting: OpenLayers/BaseTypes.js Exporting: OpenLayers/BaseTypes/Class.js Exporting: OpenLayers/Util.js Exporting: OpenLayers/BaseTypes/Element.js Exporting: OpenLayers/BaseTypes/Size.js Exporting: OpenLayers/Console.js Exporting: OpenLayers/Icon.js Exporting: OpenLayers/Popup.js Exporting: OpenLayers/BaseTypes/Bounds.js Exporting: OpenLayers/BaseTypes/LonLat.js Exporting: OpenLayers/BaseTypes/Pixel.js Exporting: OpenLayers/Lang.js Exporting: OpenLayers/Popup/Anchored.js Exporting: OpenLayers/Events.js Exporting: OpenLayers/Format.js Exporting: OpenLayers/Lang/en.js Exporting: OpenLayers/Popup/AnchoredBubble.js Exporting: OpenLayers/Format/JSON.js Exporting: OpenLayers/Format/XML.js Exporting: OpenLayers/Marker.js Exporting: OpenLayers/Feature.js Exporting: OpenLayers/Feature/Vector.js Exporting: OpenLayers/Format/WKT.js Exporting: OpenLayers/Geometry.js Exporting: OpenLayers/Geometry/Collection.js Exporting: OpenLayers/Geometry/Point.js Exporting: OpenLayers/Geometry/MultiPoint.js Exporting: OpenLayers/Geometry/Curve.js Exporting: OpenLayers/Geometry/LineString.js Exporting: OpenLayers/Geometry/LinearRing.js Exporting: OpenLayers/Geometry/MultiLineString.js Exporting: OpenLayers/Geometry/Polygon.js Exporting: OpenLayers/Geometry/MultiPolygon.js Exporting: OpenLayers/Format/GML.js Exporting: OpenLayers/Format/GeoJSON.js Exporting: OpenLayers/Format/GML/Base.js Exporting: OpenLayers/Format/GML/v3.js Exporting: OpenLayers/Format/Atom.js Total files merged: 40 Compressing using jsmin. Adding license file. Writing to OpenLayers.js. Done.
And yields these files, ready to be copied or linked to a location for production:
$ ls -l parts/openlayers-bingo/ total 360 -rw-r--r-- 1 seang staff 180958 Jun 3 15:35 OpenLayers.js drwxr-xr-x 25 seang staff 850 Jun 3 15:23 img drwxr-xr-x 3 seang staff 102 Jun 3 15:23 theme
Oh, and collective.checkdocs is great for finding bugs in your package's long descriptions.