[elbe-devel] [PATCH 12/25] py3: print error if spyne is not available

Manuel Traut manuel.traut at linutronix.de
Fri Dec 8 17:18:50 CET 2017


On Wed, Dec 06, 2017 at 11:57:33AM +0100, Torben Hohn wrote:
> On Fri, Dec 01, 2017 at 04:51:09PM +0100, Manuel Traut wrote:
> > python3-spyne is not available in debian at the moment.
> > This prints a warning to enable the user installing it from another
> > source.
> 
> do we use this outside of the initvm ?
> we control packages in the initvm...

one might use it outside..

> Do we have a python3-spyne package ?

not, need to have a look at this

> What is our migration path here ?

someone needs to work on this:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=877783


> 
> > 
> > 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)
> 
> Calling exit on ImportError is not good.
> Can we just throw the import Error Up, after Printing a more prominent
> message ?

decided to handle it here instead of pushing in changes in several modules
that can be removed as soon as py3-spyne is available.

please let's take this simple workaround and investigate our time in
python3-spyne

> > +
> >  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
> > 
> > 
> > _______________________________________________
> > elbe-devel mailing list
> > elbe-devel at linutronix.de
> > https://lists.linutronix.de/mailman/listinfo/elbe-devel
> 
> -- 
> Mit freundlichen Grüßen
> Torben Hohn
> 
> Linutronix GmbH
> 
> Standort: Bremen
> 
> Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
> 
> Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
> Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
> Nr. / Trade register no.: 700 806
> 
> Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner
> 
> Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
> benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
> möglich ist, durch Antwort-Mail. Vielen Dank!





More information about the elbe-devel mailing list