[pywps] 01/02: Update WSGI example for PyWPS 4.
Bas Couwenberg
sebastic at debian.org
Sat Jan 21 18:46:48 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository pywps.
commit 30f3aac322a464560d6edb15c0eba4ed7c3c27a4
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Sat Jan 21 19:17:11 2017 +0100
Update WSGI example for PyWPS 4.
---
debian/changelog | 6 ++++
debian/control | 12 ++++----
debian/{pywps.docs => python-pywps.docs} | 0
debian/pywps-wsgi.conf | 7 +----
debian/pywps-wsgi.install | 5 ++--
debian/pywps.install | 1 -
debian/share/pywps/processes/__init__.py | 1 -
debian/share/pywps/processes/hello_world.py | 23 ---------------
debian/share/pywps/processes/sayhello.py | 43 +++++++++++++++++++++++++++
debian/share/pywps/wps.py | 45 ++++++++++-------------------
10 files changed, 74 insertions(+), 69 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 8dca7e4..13b9121 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+pywps (4.0.0-2) UNRELEASED; urgency=medium
+
+ * Update WSGI example for PyWPS 4.
+
+ -- Bas Couwenberg <sebastic at debian.org> Sat, 21 Jan 2017 19:16:40 +0100
+
pywps (4.0.0-1) unstable; urgency=medium
* New upstream release.
diff --git a/debian/control b/debian/control
index 6200521..3f8384e 100644
--- a/debian/control
+++ b/debian/control
@@ -50,9 +50,9 @@ Description: Implementation of OGC's Web Processing Service - Python 2 module
Package: pywps
Architecture: all
-Section: web
-Depends: python-pywps (= ${binary:Version}),
- pywps-wsgi,
+Section: metapackages
+Depends: python-pywps (>= ${source:Version}),
+ pywps-wsgi (>= ${source:Version}),
${python:Depends},
${misc:Depends}
Suggests: cgi-mapserver,
@@ -62,7 +62,7 @@ Description: Implementation of OGC's Web Processing Service
Geospatial Consortium Inc.(R) with help of Python Programming
Language and GIS GRASS as working tool in background.
.
- This package contains the pywps executable and example processes.
+ This metapackage depends on the pywps Python module and WSGI example.
Package: pywps-wsgi
Architecture: all
@@ -70,12 +70,12 @@ Section: web
Depends: libapache2-mod-wsgi | httpd-wsgi,
${misc:Depends}
Recommends: ${misc:Recommends}
-Description: Implementation of OGC's Web Processing Service - WSGI script
+Description: Implementation of OGC's Web Processing Service - WSGI example
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.
+ This package contains the wps.py WSGI script and process examples.
Package: pywps-doc
Architecture: all
diff --git a/debian/pywps.docs b/debian/python-pywps.docs
similarity index 100%
rename from debian/pywps.docs
rename to debian/python-pywps.docs
diff --git a/debian/pywps-wsgi.conf b/debian/pywps-wsgi.conf
index a644e0f..b6edf2b 100644
--- a/debian/pywps-wsgi.conf
+++ b/debian/pywps-wsgi.conf
@@ -1,11 +1,6 @@
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">
+<Directory "/usr/share/pywps">
AllowOverride None
Options -MultiViews +SymLinksIfOwnerMatch
Require all granted
diff --git a/debian/pywps-wsgi.install b/debian/pywps-wsgi.install
index 83ed218..9aff76a 100644
--- a/debian/pywps-wsgi.install
+++ b/debian/pywps-wsgi.install
@@ -1,2 +1,3 @@
-debian/pywps-wsgi.cfg etc/pywps/
-debian/share/pywps/wps.py usr/share/pywps/
+debian/pywps-wsgi.cfg etc/pywps/
+debian/share/pywps/wps.py usr/share/pywps/
+debian/share/pywps/processes usr/share/pywps/
diff --git a/debian/pywps.install b/debian/pywps.install
deleted file mode 100644
index 515f403..0000000
--- a/debian/pywps.install
+++ /dev/null
@@ -1 +0,0 @@
-debian/share/pywps/processes usr/share/pywps/
diff --git a/debian/share/pywps/processes/__init__.py b/debian/share/pywps/processes/__init__.py
index b452028..e69de29 100644
--- a/debian/share/pywps/processes/__init__.py
+++ b/debian/share/pywps/processes/__init__.py
@@ -1 +0,0 @@
-__all__ = ['hello_world']
diff --git a/debian/share/pywps/processes/hello_world.py b/debian/share/pywps/processes/hello_world.py
deleted file mode 100644
index 8a1dad5..0000000
--- a/debian/share/pywps/processes/hello_world.py
+++ /dev/null
@@ -1,23 +0,0 @@
-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.addLiteralInput(identifier='name',
- type=type('string'),
- title='Name')
-
- self.out = self.addLiteralOutput(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/processes/sayhello.py b/debian/share/pywps/processes/sayhello.py
new file mode 100644
index 0000000..c03dcba
--- /dev/null
+++ b/debian/share/pywps/processes/sayhello.py
@@ -0,0 +1,43 @@
+# Copyright (c) 2016 PyWPS Project Steering Committee
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in all
+# copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+from pywps import Process, LiteralInput, LiteralOutput, OGCUNIT, UOM
+
+
+class SayHello(Process):
+ def __init__(self):
+ inputs = [LiteralInput('name', 'Input name', data_type='string')]
+ outputs = [LiteralOutput('response', 'Output response', data_type='string')]
+
+ super(SayHello, self).__init__(
+ self._handler,
+ identifier='say_hello',
+ title='Process Say Hello',
+ version='1.3.3.7',
+ inputs=inputs,
+ outputs=outputs,
+ store_supported=True,
+ status_supported=True
+ )
+
+ def _handler(self, request, response):
+ response.outputs['response'].data = 'Hello ' + request.inputs['name'][0].data
+ response.outputs['response'].uom = UOM('unity')
+ return response
diff --git a/debian/share/pywps/wps.py b/debian/share/pywps/wps.py
index 63a4e86..cdd0f17 100644
--- a/debian/share/pywps/wps.py
+++ b/debian/share/pywps/wps.py
@@ -1,35 +1,20 @@
-import os
-import pywps
-from pywps.Exceptions import NoApplicableCode, WPSException
+import sys
+sys.path.append('/usr/share/pywps')
-def application(environ, start_response):
+from pywps.app.Service import Service
- os.environ['PYWPS_CFG'] = environ['PYWPS_CFG']
- os.environ['PYWPS_PROCESSES'] = environ['PYWPS_PROCESSES']
+# processes need to be installed in PYTHON_PATH
+from processes.sayhello import SayHello
- status = '200 OK'
- response_headers = [('Content-type', 'text/xml')]
- start_response(status, response_headers)
+processes = [
+ SayHello()
+]
- 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]
+# Service accepts two parameters:
+# 1 - list of process instances
+# 2 - list of configuration files
+application = Service(
+ processes,
+ ['/etc/pywps/pywps-wsgi.cfg']
+)
--
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