[pywps] 01/01: Use separate CGI & WSGI packages.

Sebastiaan Couwenberg sebastic at moszumanska.debian.org
Fri Jun 10 15:08:53 UTC 2016


This is an automated email from the git hooks/post-receive script.

sebastic pushed a commit to branch master
in repository pywps.

commit ba435d5dab344c9d4566336d2787bb05498073d1
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date:   Fri Jun 10 16:41:10 2016 +0200

    Use separate CGI & WSGI packages.
---
 debian/control                              | 40 +++++++++++++++++++++++++----
 debian/pywps-cgi.apache2                    |  1 +
 debian/pywps-cgi.cfg                        | 32 +++++++++++++++++++++++
 debian/pywps-cgi.conf                       |  6 +++++
 debian/pywps-cgi.install                    |  1 +
 debian/pywps-cgi.links                      |  1 +
 debian/pywps-wsgi.apache2                   |  1 +
 debian/pywps-wsgi.cfg                       | 32 +++++++++++++++++++++++
 debian/pywps-wsgi.conf                      | 13 ++++++++++
 debian/pywps-wsgi.install                   |  2 ++
 debian/pywps.dirs                           |  1 -
 debian/pywps.install                        |  1 +
 debian/pywps.links                          |  2 --
 debian/rules                                |  2 +-
 debian/share/pywps/processes/__init__.py    |  1 +
 debian/share/pywps/processes/hello_world.py | 22 ++++++++++++++++
 debian/share/pywps/wps.py                   | 35 +++++++++++++++++++++++++
 17 files changed, 184 insertions(+), 9 deletions(-)

diff --git a/debian/control b/debian/control
index fb5e348..c42b365 100644
--- a/debian/control
+++ b/debian/control
@@ -4,6 +4,7 @@ Uploaders: Bas Couwenberg <sebastic at debian.org>
 Section: python
 Priority: optional
 Build-Depends: debhelper (>= 9),
+               dh-apache2,
                dh-python,
                python-all,
                python-gdal,
@@ -22,8 +23,10 @@ Depends: python-gdal,
          python-lxml,
          ${python:Depends},
          ${misc:Depends}
-Recommends: python-mapscript
-Suggests: grass-core
+Recommends: python-mapscript,
+            python-pyproj
+Suggests: grass-core,
+          r-base
 Description: Implementation of OGC's Web Processing Service - Python 2 module
  PyWPS is implementation of Web Processing Service from Open
  Geospatial Consortium Inc.(R) with help of  Python Programming
@@ -36,17 +39,44 @@ Architecture: all
 Section: web
 Depends: libjs-openlayers,
          python-pywps (= ${binary:Version}),
+         pywps-wsgi | pywps-cgi,
          ${python:Depends},
          ${misc:Depends}
-Suggests: apache2 | httpd-cgi,
-          cgi-mapserver,
+Suggests: cgi-mapserver,
           pywps-doc
 Description: Implementation of OGC's Web Processing Service
  PyWPS is implementation of Web Processing Service from Open
  Geospatial Consortium Inc.(R) with help of  Python Programming
  Language and GIS GRASS as working tool in background.
  .
- This package contains the pywps executable & wps.py CGI script.
+ This package contains the pywps executable and example processes.
+
+Package: pywps-cgi
+Architecture: all
+Section: web
+Depends: apache2 | httpd-cgi,
+         pywps,
+         ${misc:Depends}
+Recommends: ${misc:Recommends}
+Description: Implementation of OGC's Web Processing Service - CGI script
+ PyWPS is implementation of Web Processing Service from Open
+ Geospatial Consortium Inc.(R) with help of  Python Programming
+ Language and GIS GRASS as working tool in background.
+ .
+ This package contains the wps.py CGI script.
+
+Package: pywps-wsgi
+Architecture: all
+Section: web
+Depends: libapache2-mod-wsgi | httpd-wsgi,
+         ${misc:Depends}
+Recommends: ${misc:Recommends}
+Description: Implementation of OGC's Web Processing Service - WSGI script
+ PyWPS is implementation of Web Processing Service from Open
+ Geospatial Consortium Inc.(R) with help of  Python Programming
+ Language and GIS GRASS as working tool in background.
+ .
+ This package contains the wps.py WSGI script.
 
 Package: pywps-doc
 Architecture: all
diff --git a/debian/pywps-cgi.apache2 b/debian/pywps-cgi.apache2
new file mode 100644
index 0000000..c8fff10
--- /dev/null
+++ b/debian/pywps-cgi.apache2
@@ -0,0 +1 @@
+conf debian/pywps-cgi.conf
diff --git a/debian/pywps-cgi.cfg b/debian/pywps-cgi.cfg
new file mode 100644
index 0000000..611f113
--- /dev/null
+++ b/debian/pywps-cgi.cfg
@@ -0,0 +1,32 @@
+[wps]
+encoding=utf-8
+title=PyWPS OSGeo-Live Demo
+version=1.0.0
+abstract=PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
+fees=None
+constraints=None
+serveraddress=http://localhost/cgi-bin/wps.py
+keywords=PyWPS,WPS,OGC,processing,ogc,interoperability
+lang=en-US
+
+[provider]
+providerName=Organization Name
+individualName=Lastname, Firstname
+positionName=Position Title
+role=pointOfContact
+deliveryPoint=Mailing Address
+city=City
+postalCode=Zip or Postal Code
+country=Country
+electronicMailAddress=Email Address
+providerSite=http://pywps.org
+phoneVoice=+xx-xxx-xxx-xxxx
+phoneFacsimile=+xx-xxx-xxx-xxxx
+administrativeArea=Administrative Area
+
+[server]
+maxoperations=50
+maxinputparamlength=1024
+maxfilesize=3mb
+tempPath=/tmp
+debug=true
diff --git a/debian/pywps-cgi.conf b/debian/pywps-cgi.conf
new file mode 100644
index 0000000..eb013fe
--- /dev/null
+++ b/debian/pywps-cgi.conf
@@ -0,0 +1,6 @@
+
+<Location /cgi-bin/wps.py>
+  SetEnv PYWPS_CFG /etc/pywps/pywps-cgi.cfg
+  SetEnv PYWPS_PROCESSES /usr/share/pywps/processes
+</Location>
+
diff --git a/debian/pywps-cgi.install b/debian/pywps-cgi.install
new file mode 100644
index 0000000..6d88813
--- /dev/null
+++ b/debian/pywps-cgi.install
@@ -0,0 +1 @@
+debian/pywps-cgi.cfg etc/pywps/
diff --git a/debian/pywps-cgi.links b/debian/pywps-cgi.links
new file mode 100644
index 0000000..0c384c5
--- /dev/null
+++ b/debian/pywps-cgi.links
@@ -0,0 +1 @@
+usr/bin/pywps usr/lib/cgi-bin/wps.py
diff --git a/debian/pywps-wsgi.apache2 b/debian/pywps-wsgi.apache2
new file mode 100644
index 0000000..ef67354
--- /dev/null
+++ b/debian/pywps-wsgi.apache2
@@ -0,0 +1 @@
+conf debian/pywps-wsgi.conf
diff --git a/debian/pywps-wsgi.cfg b/debian/pywps-wsgi.cfg
new file mode 100644
index 0000000..1961051
--- /dev/null
+++ b/debian/pywps-wsgi.cfg
@@ -0,0 +1,32 @@
+[wps]
+encoding=utf-8
+title=PyWPS OSGeo-Live Demo
+version=1.0.0
+abstract=PyWPS is an implementation of the Web Processing Service standard from the Open Geospatial Consortium. PyWPS is written in Python.
+fees=None
+constraints=None
+serveraddress=http://localhost/pywps/wps.py
+keywords=PyWPS,WPS,OGC,processing,ogc,interoperability
+lang=en-US
+
+[provider]
+providerName=Organization Name
+individualName=Lastname, Firstname
+positionName=Position Title
+role=pointOfContact
+deliveryPoint=Mailing Address
+city=City
+postalCode=Zip or Postal Code
+country=Country
+electronicMailAddress=Email Address
+providerSite=http://pywps.org
+phoneVoice=+xx-xxx-xxx-xxxx
+phoneFacsimile=+xx-xxx-xxx-xxxx
+administrativeArea=Administrative Area
+
+[server]
+maxoperations=50
+maxinputparamlength=1024
+maxfilesize=3mb
+tempPath=/tmp
+debug=true
diff --git a/debian/pywps-wsgi.conf b/debian/pywps-wsgi.conf
new file mode 100644
index 0000000..a644e0f
--- /dev/null
+++ b/debian/pywps-wsgi.conf
@@ -0,0 +1,13 @@
+WSGIScriptAlias /pywps/wps.py /usr/share/pywps/wps.py
+
+<Location /pywps/wps.py>
+  SetEnv PYWPS_CFG /etc/pywps/pywps-wsgi.cfg
+  SetEnv PYWPS_PROCESSES /usr/share/pywps/processes
+</Location>
+
+<Directory "/usr/share/pywps/www">
+  AllowOverride None
+  Options -MultiViews +SymLinksIfOwnerMatch
+  Require all granted
+</Directory>
+
diff --git a/debian/pywps-wsgi.install b/debian/pywps-wsgi.install
new file mode 100644
index 0000000..83ed218
--- /dev/null
+++ b/debian/pywps-wsgi.install
@@ -0,0 +1,2 @@
+debian/pywps-wsgi.cfg     etc/pywps/
+debian/share/pywps/wps.py usr/share/pywps/
diff --git a/debian/pywps.dirs b/debian/pywps.dirs
index 4723a79..e772481 100644
--- a/debian/pywps.dirs
+++ b/debian/pywps.dirs
@@ -1,2 +1 @@
 usr/bin
-usr/lib/cgi-bin
diff --git a/debian/pywps.install b/debian/pywps.install
index e772481..f5edb25 100644
--- a/debian/pywps.install
+++ b/debian/pywps.install
@@ -1 +1,2 @@
 usr/bin
+debian/share/pywps/processes usr/share/pywps/
diff --git a/debian/pywps.links b/debian/pywps.links
index 9005cd6..b61fa33 100644
--- a/debian/pywps.links
+++ b/debian/pywps.links
@@ -1,3 +1 @@
-usr/bin/pywps usr/lib/cgi-bin/wps.py
-
 usr/share/javascript/openlayers usr/share/doc/pywps/examples/webclient/openlayers
diff --git a/debian/rules b/debian/rules
index 4aa2dc8..f9a46dd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,7 +13,7 @@
 export DEB_BUILD_MAINT_OPTIONS=hardening=+all,-pie
 
 %:
-	dh $@ --with python2,sphinxdoc --buildsystem=pybuild --parallel
+	dh $@ --with apache2,python2,sphinxdoc --buildsystem=pybuild --parallel
 
 override_dh_clean:
 	dh_clean pywps/Templates/*/*.tmplc
diff --git a/debian/share/pywps/processes/__init__.py b/debian/share/pywps/processes/__init__.py
new file mode 100644
index 0000000..b452028
--- /dev/null
+++ b/debian/share/pywps/processes/__init__.py
@@ -0,0 +1 @@
+__all__ = ['hello_world']
diff --git a/debian/share/pywps/processes/hello_world.py b/debian/share/pywps/processes/hello_world.py
new file mode 100644
index 0000000..e6c29cd
--- /dev/null
+++ b/debian/share/pywps/processes/hello_world.py
@@ -0,0 +1,22 @@
+from pywps.Process import WPSProcess
+class HelloWorldProcess(WPSProcess):
+    def __init__(self):
+        WPSProcess.__init__(
+            self,
+            version='0.1.0',
+            identifier='hello-world',
+            title='Hello World',
+            abstract='Sample process',
+            storeSupported=False,
+            statusSupported=False)
+
+        self.data = self.addComplexInput(identifier='name',
+                                         title='Name')
+
+        self.out = self.addComplexOutput(identifier='output',
+                                         title='Output')
+
+    def execute(self):
+        value = self.data.getValue()
+        self.out.setValue('Hello World from %s' % value)
+        return
diff --git a/debian/share/pywps/wps.py b/debian/share/pywps/wps.py
new file mode 100644
index 0000000..63a4e86
--- /dev/null
+++ b/debian/share/pywps/wps.py
@@ -0,0 +1,35 @@
+import os
+import pywps
+from pywps.Exceptions import NoApplicableCode, WPSException
+
+
+def application(environ, start_response):
+
+    os.environ['PYWPS_CFG'] = environ['PYWPS_CFG']
+    os.environ['PYWPS_PROCESSES'] = environ['PYWPS_PROCESSES']
+
+    status = '200 OK'
+    response_headers = [('Content-type', 'text/xml')]
+    start_response(status, response_headers)
+
+    inputQuery = None
+    if "REQUEST_METHOD" in environ and environ["REQUEST_METHOD"] == "GET":
+        inputQuery = environ["QUERY_STRING"]
+    elif "wsgi.input" in environ:
+        inputQuery = environ['wsgi.input']
+
+    if not inputQuery:
+        err = NoApplicableCode("No query string found.")
+        return [err.getResponse()]
+
+    # create the WPS object
+    try:
+        wps = pywps.Pywps(environ["REQUEST_METHOD"])
+        if wps.parseRequest(inputQuery):
+            pywps.debug(wps.inputs)
+            wps.performRequest()
+            return wps.response
+    except WPSException as e:
+        return [e]
+    except Exception as e:
+        return [e]

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/pywps.git



More information about the Pkg-grass-devel mailing list