[elbe-devel] [PATCH 12/25] py3: print error if spyne is not available
Manuel Traut
manut at linutronix.de
Fri Dec 1 16:51:09 CET 2017
python3-spyne is not available in debian at the moment.
This prints a warning to enable the user installing it from another
source.
Signed-off-by: Manuel Traut <manut at linutronix.de>
---
elbepack/daemons/soap/__init__.py | 18 +++++++++++++-----
elbepack/daemons/soap/esoap.py | 25 ++++++++++++++++---------
2 files changed, 29 insertions(+), 14 deletions(-)
diff --git a/elbepack/daemons/soap/__init__.py b/elbepack/daemons/soap/__init__.py
index 623f76f8..560333fc 100644
--- a/elbepack/daemons/soap/__init__.py
+++ b/elbepack/daemons/soap/__init__.py
@@ -16,16 +16,24 @@
# You should have received a copy of the GNU General Public License
# along with ELBE. If not, see <http://www.gnu.org/licenses/>.
-from esoap import ESoap
+from __future__ import print_function
-from beaker.middleware import SessionMiddleware
+import sys
-from spyne import Application
-from spyne.protocol.soap import Soap11
-from spyne.server.wsgi import WsgiApplication
+from esoap import ESoap
+from beaker.middleware import SessionMiddleware
from cherrypy.process.plugins import SimplePlugin
+try:
+ from spyne import Application
+ from spyne.protocol.soap import Soap11
+ from spyne.server.wsgi import WsgiApplication
+except ImportError as e:
+ print("failed to import spyne", file=sys.stderr)
+ print("please install python(3)-spyne", file=sys.stderr)
+ sys.exit(-20)
+
from elbepack.projectmanager import ProjectManager
class EsoapApp(Application):
diff --git a/elbepack/daemons/soap/esoap.py b/elbepack/daemons/soap/esoap.py
index 8189a94f..711e8118 100644
--- a/elbepack/daemons/soap/esoap.py
+++ b/elbepack/daemons/soap/esoap.py
@@ -18,26 +18,33 @@
# You should have received a copy of the GNU General Public License
# along with ELBE. If not, see <http://www.gnu.org/licenses/>.
+from __future__ import print_function
+
import binascii
import os
import tarfile
import fnmatch
+import sys
from tempfile import NamedTemporaryFile
from elbepack.shellhelper import system
from elbepack.version import elbe_version
-
-from faults import soap_faults
-
from elbepack.elbexml import ValidationMode
-from datatypes import SoapProject, SoapFile
-from authentication import authenticated_admin, authenticated_uid
-from spyne.service import ServiceBase
-from spyne.decorator import rpc
-from spyne.model.primitive import String, Boolean, Integer
-from spyne.model.complex import Array
+from .faults import soap_faults
+from .datatypes import SoapProject, SoapFile
+from .authentication import authenticated_admin, authenticated_uid
+
+try:
+ from spyne.service import ServiceBase
+ from spyne.decorator import rpc
+ from spyne.model.primitive import String, Boolean, Integer
+ from spyne.model.complex import Array
+except ImportError as e:
+ print("failed to import spyne", file=sys.stderr)
+ print("please install python(3)-spyne", file=sys.stderr)
+ sys.exit(-20)
class ESoap (ServiceBase):
--
2.15.1
More information about the elbe-devel
mailing list