| 1 | ============================================ |
|---|
| 2 | Python Cartographic Library (PCL) - Buildout |
|---|
| 3 | ============================================ |
|---|
| 4 | |
|---|
| 5 | This is a buildout system for the Python Cartographic Library (PCL) |
|---|
| 6 | software suite. Its main purpose is to provide a dependable and |
|---|
| 7 | repeatable way for developers to easily setup a development |
|---|
| 8 | environment that contains all dependencies. |
|---|
| 9 | |
|---|
| 10 | Although geared towards developers the end result of the buildout is a |
|---|
| 11 | working environment containing the PCL components which may also be |
|---|
| 12 | used for non-development purposes. |
|---|
| 13 | |
|---|
| 14 | The buildout provides an isolated sandbox environment for using and |
|---|
| 15 | developing PCL without interfering with the rest of your system. |
|---|
| 16 | |
|---|
| 17 | The buildout is implemented using zc.buildout_ |
|---|
| 18 | |
|---|
| 19 | _zc.buildout: http://pypi.python.org/pypi/zc.buildout |
|---|
| 20 | |
|---|
| 21 | |
|---|
| 22 | Quickstart |
|---|
| 23 | ---------- |
|---|
| 24 | |
|---|
| 25 | The following commands will install the whole of PCL, setup a |
|---|
| 26 | PostgreSQL db for testing and run the full test suite. For detailed |
|---|
| 27 | instructions read below. |
|---|
| 28 | |
|---|
| 29 | $ svn co http://svn.gispython.org/svn/gispy/buildout/pcl.buildout/trunk pcl.buildout |
|---|
| 30 | $ python bootstrap.py |
|---|
| 31 | $ ./bin/buildout |
|---|
| 32 | $ python init_postgresql.py |
|---|
| 33 | $ ./bin/test_core |
|---|
| 34 | $ ./bin/test_gdal |
|---|
| 35 | $ ./bin/test_georss |
|---|
| 36 | $ ./bin/test_mapserver |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | Bootstrapping the buildout |
|---|
| 40 | -------------------------- |
|---|
| 41 | |
|---|
| 42 | When the buildout is checked out from the repository it needs to be |
|---|
| 43 | bootstrapped before it is ready to use. Simply run:: |
|---|
| 44 | |
|---|
| 45 | $ python bootstrap.py |
|---|
| 46 | |
|---|
| 47 | in the root of the buildout to get everything ready for work. This |
|---|
| 48 | will not build PCL, but will set the necessary scripts in the right |
|---|
| 49 | places for doing it. |
|---|
| 50 | |
|---|
| 51 | After the bootstrapping you will have the buildout script in:: |
|---|
| 52 | |
|---|
| 53 | ./bin/buildout |
|---|
| 54 | |
|---|
| 55 | which is used to run the actual buildout process. For a full listing |
|---|
| 56 | of available options see:: |
|---|
| 57 | |
|---|
| 58 | ./bin/buildout --help |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | Buildout structure |
|---|
| 62 | ------------------- |
|---|
| 63 | |
|---|
| 64 | The buildout is divided into smaller parts that correspond directly to |
|---|
| 65 | the components of PCL: |
|---|
| 66 | |
|---|
| 67 | - PCL-Core -- the core functionality |
|---|
| 68 | - PCL-GDAL -- disk oriented data access using GDAL |
|---|
| 69 | - PCL-MapServer -- MapServer based rendering engine |
|---|
| 70 | - PCL-GeoRSS -- GeoRSS data source |
|---|
| 71 | |
|---|
| 72 | Each component has its own buildout configuration (.cfg) file named |
|---|
| 73 | after the component. A developer wishing to work on a particular |
|---|
| 74 | component of PCL can build only the necessary components and avoid the |
|---|
| 75 | cost of having to build the whole of PCL. |
|---|
| 76 | |
|---|
| 77 | To build a specific component you can simply run:: |
|---|
| 78 | |
|---|
| 79 | ./bin/buildout -c [component].cfg |
|---|
| 80 | |
|---|
| 81 | For example, to build PCL-Core you would run:: |
|---|
| 82 | |
|---|
| 83 | ./bin/buildout -c pcl-core.cfg |
|---|
| 84 | |
|---|
| 85 | After building a single component, you will have a script to run the |
|---|
| 86 | corresponding test suite:: |
|---|
| 87 | |
|---|
| 88 | ./bin/test |
|---|
| 89 | |
|---|
| 90 | You can optionally build the whole PCL suite by simply calling the |
|---|
| 91 | buildout script without any parameters:: |
|---|
| 92 | |
|---|
| 93 | ./bin/buildout |
|---|
| 94 | |
|---|
| 95 | Building the whole PCL will give you invidual scripts for running the |
|---|
| 96 | test suites of the components. |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | Dependencies |
|---|
| 100 | ------------ |
|---|
| 101 | |
|---|
| 102 | PCL has a lot of dependencies on external libraries and programs. The |
|---|
| 103 | dependencies are defined in the ``dependencies.cfg`` configuration |
|---|
| 104 | file which the components of the buildout depend on. |
|---|
| 105 | |
|---|
| 106 | You may wish to edit the dependencies configuration for two reasons: |
|---|
| 107 | |
|---|
| 108 | - change the version, download url, etc of a component |
|---|
| 109 | - omit a component in favor of an already installed system component |
|---|
| 110 | (e.g. a library) |
|---|
| 111 | |
|---|
| 112 | Please note that if you do the latter, you may need to update the |
|---|
| 113 | sections using the component to make sure that paths are set |
|---|
| 114 | correctly. |
|---|
| 115 | |
|---|
| 116 | |
|---|
| 117 | Setting up PostgreSQL |
|---|
| 118 | --------------------- |
|---|
| 119 | |
|---|
| 120 | PCL-Core contains code and tests that interacts with a PostgreSQL |
|---|
| 121 | database. The buildout compiles the database server automatically, but |
|---|
| 122 | test data must be populated with a manual step. |
|---|
| 123 | |
|---|
| 124 | In the root of the buildout directory is a python script called |
|---|
| 125 | ``init_postgresql.py`` that takes care of setting up a database for |
|---|
| 126 | testing PCL. You can run by simply calling:: |
|---|
| 127 | |
|---|
| 128 | $ ./bin/python init_postgresql.py |
|---|
| 129 | |
|---|
| 130 | You can optionally set the port number by using the --port option. The |
|---|
| 131 | default port is 5432. |
|---|
| 132 | |
|---|
| 133 | Note that if you are using an alternative buildout configuration, such |
|---|
| 134 | as buildout-deb.cfg, you need to tell the init script about it because |
|---|
| 135 | it may need to rerun the buildout in order to update the |
|---|
| 136 | configuration. Use the --buildout-cfg switch for this |
|---|
| 137 | |
|---|
| 138 | You can run the script as many times as you want, but be aware that it |
|---|
| 139 | will reset the whole database. You shouldn't use the test database to |
|---|
| 140 | store any important data as it will be lost on subsequent runs of the |
|---|
| 141 | script. |
|---|
| 142 | |
|---|
| 143 | See the OSX Notes section below if you are using Mac OSX. |
|---|
| 144 | |
|---|
| 145 | |
|---|
| 146 | Developing PCL |
|---|
| 147 | -------------- |
|---|
| 148 | |
|---|
| 149 | All the PCL components will be installed as development eggs, so you |
|---|
| 150 | can keep modifying the source on-the-fly. All editable source code is |
|---|
| 151 | located under the ``src/`` directory within the buildout. |
|---|
| 152 | |
|---|
| 153 | There is also a Python interpreter script located in:: |
|---|
| 154 | |
|---|
| 155 | ./bin/python |
|---|
| 156 | |
|---|
| 157 | which has all the relevant components available for instant use. For |
|---|
| 158 | example, if you built PCL-Core the following will work without having |
|---|
| 159 | to modify any paths or whatsoever:: |
|---|
| 160 | |
|---|
| 161 | ./bin/python |
|---|
| 162 | >>> import cartography |
|---|
| 163 | |
|---|
| 164 | |
|---|
| 165 | OSX Notes |
|---|
| 166 | --------- |
|---|
| 167 | |
|---|
| 168 | Running the PostgreSQL database server on Mac OS X may require |
|---|
| 169 | modifying the amount of shared memory available on your system. See |
|---|
| 170 | |
|---|
| 171 | http://www.postgresql.org/docs/8.2/static/kernel-resources.html#SYSVIPC |
|---|
| 172 | |
|---|
| 173 | for more detailed instructions. |
|---|