Hello community,
here is the log from the commit of package yast2-python-bindings
checked in at Thu Dec 6 01:50:11 CET 2007.
--------
--- yast2-python-bindings/yast2-python-bindings.changes 2007-11-15 16:52:36.000000000 +0100
+++ /mounts/work_src_done/STABLE/yast2-python-bindings/yast2-python-bindings.changes 2007-12-05 10:46:02.000000000 +0100
@@ -1,0 +2,7 @@
+Wed Dec 5 10:18:40 CET 2007 - juhliarik@suse.cz
+
+- Added patch for problem with handling error from python
+- Correction for handling adding None(nil) as argument to yast function
+- V 2.16.2
+
+-------------------------------------------------------------------
Old:
----
yast2-python-bindings-2.16.1.tar.bz2
New:
----
yast2-python-bindings-2.16.2.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-python-bindings.spec ++++++
--- /var/tmp/diff_new_pack.h18994/_old 2007-12-06 01:49:46.000000000 +0100
+++ /var/tmp/diff_new_pack.h18994/_new 2007-12-06 01:49:46.000000000 +0100
@@ -1,5 +1,5 @@
#
-# spec file for package yast2-python-bindings (Version 2.16.1)
+# spec file for package yast2-python-bindings (Version 2.16.2)
#
# Copyright (c) 2007 SUSE LINUX Products GmbH, Nuernberg, Germany.
# This file and all modifications and additions to the pristine
@@ -11,12 +11,12 @@
# norootforbuild
Name: yast2-python-bindings
-Version: 2.16.1
+Version: 2.16.2
Release: 1
License: GPL v2 only
Group: System/YaST
BuildRoot: %{_tmppath}/%{name}-%{version}-build
-Source0: yast2-python-bindings-2.16.1.tar.bz2
+Source0: yast2-python-bindings-2.16.2.tar.bz2
Prefix: /usr
BuildRequires: blocxx-devel curl-devel gcc-c++ libxcrypt-devel python-devel yast2-core-devel yast2-devtools
# YCPValue::valuetype_str()
@@ -35,7 +35,7 @@
Jozef Uhliarik
%prep
-%setup -n yast2-python-bindings-2.16.1
+%setup -n yast2-python-bindings-2.16.2
%build
%{prefix}/bin/y2tool y2autoconf
@@ -69,6 +69,10 @@
%{_libdir}/python/site-packages
%doc %{prefix}/share/doc/packages/yast2-python-bindings
%changelog
+* Wed Dec 05 2007 - juhliarik@suse.cz
+- Added patch for problem with handling error from python
+- Correction for handling adding None(nil) as argument to yast function
+- V 2.16.2
* Thu Nov 15 2007 - juhliarik@suse.cz
- Addded correction in makefile and for YCPDeclaration
- V 2.16.1
++++++ yast2-python-bindings-2.16.1.tar.bz2 -> yast2-python-bindings-2.16.2.tar.bz2 ++++++
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/src/Makefile.am new/yast2-python-bindings-2.16.2/src/Makefile.am
--- old/yast2-python-bindings-2.16.1/src/Makefile.am 2007-11-15 13:31:50.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/src/Makefile.am 2007-11-21 10:44:18.000000000 +0100
@@ -2,7 +2,8 @@
# Makefile.am for python-bindings/src
#
-AM_CXXFLAGS = -DY2LOG=\"Python\" -DMODULEDIR=\"$(moduledir)\"
+AM_CXXFLAGS = -DY2LOG=\"Python\" -DMODULEDIR=\"$(moduledir)\" \
+ -DLOCALEDIR=\"${localedir}\"
MY_PYTHON_VENDORARCH = $(subst /usr,$(prefix),$(PYTHON_VENDORARCH))
#pythonpydir = $(MY_PYTHON_VENDORARCH)/YaST
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/src/Makefile.in new/yast2-python-bindings-2.16.2/src/Makefile.in
--- old/yast2-python-bindings-2.16.1/src/Makefile.in 2007-11-15 16:37:48.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/src/Makefile.in 2007-11-21 10:53:33.000000000 +0100
@@ -267,7 +267,9 @@
ydatadir = @ydatadir@
yncludedir = @yncludedir@
ystartupdir = @ystartupdir@
-AM_CXXFLAGS = -DY2LOG=\"Python\" -DMODULEDIR=\"$(moduledir)\"
+AM_CXXFLAGS = -DY2LOG=\"Python\" -DMODULEDIR=\"$(moduledir)\" \
+ -DLOCALEDIR=\"${localedir}\"
+
MY_PYTHON_VENDORARCH = $(subst /usr,$(prefix),$(PYTHON_VENDORARCH))
#pythonpydir = $(MY_PYTHON_VENDORARCH)/YaST
pythonpydir = $(MY_PYTHON_VENDORARCH)/site-packages
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/src/YCP.cc new/yast2-python-bindings-2.16.2/src/YCP.cc
--- old/yast2-python-bindings-2.16.1/src/YCP.cc 2007-11-15 16:17:49.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/src/YCP.cc 2007-12-05 10:34:40.000000000 +0100
@@ -20,6 +20,7 @@
#include
#include
#include
+#include
#include
#include "YPython.h"
@@ -32,6 +33,8 @@
/**
* Store pointer to ycp module itself.
*/
+
+
static PyObject *Self;
YCPList * ycp_ListFunctions;
@@ -46,6 +49,8 @@
PyObject * _SCR_Run (PyObject *args);
+
+
void Py_y2logger(PyObject *args);
void init_wfm ();
@@ -186,8 +191,25 @@
file, line, func, txt = traceback.extract_stack(None, 2)[0]\n\
y2logger(0, file, line, func, message)";
+ string textdomain =
+ "def textdomain(domain):\n\
+ gettext.bindtextdomain(domain, '";
+
+ textdomain +=LOCALEDIR;
+ textdomain +="')\n\
+ gettext.textdomain(domain)";
+
+ //cout << textdomain << endl;
+
+ // added space - important for checking texdomain during make package
+ string _fun =
+ "def _" "(str): \n\
+ return gettext.gettext(str)";
+
+
PyRun_SimpleString("import sys, traceback");
+ PyRun_SimpleString(_fun.c_str());
Self = Py_InitModule("ycp", YCPMethods);
initYCPTypes(Self);
@@ -195,7 +217,16 @@
traceback = PyImport_AddModule("traceback");
PyModule_AddObject(Self,"traceback",traceback);
+
+ PyRun_SimpleString("import gettext");
+ PyObject * gettext = PyImport_AddModule("gettext");
+
+
+
+ PyModule_AddObject(Self,"gettext",gettext);
init_wfm ();
+
+ //cout <<"local dir" <PythonTypeToYCPType(pPythonValue);
-
+ //transform YCPNull to YCPVoid
+ if (ycpArg.isNull()) {
+ ycpArg = YCPVoid();
+ }
/*XXX
if (fun_type->parameterType(i-2)->matchvalue(ycpArg) != 0) {
y2error ("Wrong type of argumment %d",i-2);
return PyExc_TypeError;
-
}*/
bool ok = func_call->appendParameter (ycpArg);
if (!ok) {
@@ -816,6 +855,8 @@
}
+
+
void delete_all () {
if (owned_uic != 0) {
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/src/YPython.cc new/yast2-python-bindings-2.16.2/src/YPython.cc
--- old/yast2-python-bindings-2.16.1/src/YPython.cc 2007-11-13 15:13:24.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/src/YPython.cc 2007-12-04 17:19:30.000000000 +0100
@@ -151,7 +151,9 @@
y2error("Can't import module %s", module_name.c_str());
if (PyErr_Occurred() != NULL){
- PyErr_Print();
+ //string err = PyErrorHandler();
+ y2error("Python error: %s", PyErrorHandler().c_str());
+ //PyErr_Print();
}
return YCPError("The module was not imported");
@@ -210,8 +212,13 @@
//convert python value to YCPValue
if (pReturn)
result = PythonTypeToYCPType(pReturn); // create YCP value
- else
- y2error("pReturn == 0");
+ else{
+ y2error("PyObject_CallObject(pFunc, pArgs) failed!");
+ if (PyErr_Occurred() != NULL){
+ y2error("Python error: %s", PyErrorHandler().c_str());
+ //PyErr_Print();
+ }
+ }
//delete pReturn
Py_CLEAR(pReturn);
@@ -802,6 +809,62 @@
+string YPython::PyErrorHandler() {
+ /* process Python-related errors */
+ /* call after Python API raises an exception */
+
+ PyObject *errobj, *errdata, *errtraceback, *pystring;
+
+ string result = "error type: ";
+ /* get latest python exception info */
+ PyErr_Fetch(&errobj, &errdata, &errtraceback);
+
+ pystring = NULL;
+ if (errobj != NULL &&
+ (pystring = PyObject_Str(errobj)) != NULL && /* str(object) */
+ (PyString_Check(pystring))
+ )
+ //strcpy(save_error_type, PyString_AsString(pystring));
+ result += PyString_AsString(pystring);
+ else
+ result += "<unknown exception type>";
+ Py_XDECREF(pystring);
+ result +="; error value: ";
+
+ pystring = NULL;
+ if (errdata != NULL &&
+ (pystring = PyObject_Str(errdata)) != NULL &&
+ (PyString_Check(pystring))
+ )
+ //strcpy(save_error_info, PyString_AsString(pystring));
+ result += PyString_AsString(pystring);
+ else
+ //strcpy(save_error_info, "<unknown exception data>");
+ result += "<unknown exception value>";
+ Py_XDECREF(pystring);
+
+ result +="; error traceback: ";
+
+ pystring = NULL;
+ if (errdata != NULL &&
+ (pystring = PyObject_Str(errtraceback)) != NULL &&
+ (PyString_Check(pystring))
+ )
+ //strcpy(save_error_info, PyString_AsString(pystring));
+ result += PyString_AsString(pystring);
+ else
+ //strcpy(save_error_info, "<unknown exception data>");
+ result += "<unknown exception traceback>";
+ Py_XDECREF(pystring);
+ //printf("%s\n%s\n", save_error_type, save_error_info);
+ Py_XDECREF(errobj);
+ Py_XDECREF(errdata); /* caller owns all 3 */
+ Py_XDECREF(errtraceback); /* already NULL'd out */
+ return result;
+
+}
+
+
YPythonCode::YPythonCode (PyObject *pFunc):YCode() {
m_kind = YCode::yeReference;
_pFunc = pFunc;
@@ -830,6 +893,10 @@
result = YPython::yPython()->PythonTypeToYCPType(pReturn); // create YCP value
} else {
y2error("pReturn == 0");
+ if (PyErr_Occurred() != NULL){
+ y2error("Python error: %s", YPython::PyErrorHandler().c_str());
+ //PyErr_Print();
+ }
}
}
return result;
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/src/YPython.h new/yast2-python-bindings-2.16.2/src/YPython.h
--- old/yast2-python-bindings-2.16.1/src/YPython.h 2007-11-07 10:31:30.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/src/YPython.h 2007-12-04 17:20:08.000000000 +0100
@@ -113,7 +113,11 @@
*/
PyObject *YCPTypeToPythonType(YCPValue);
-
+ /**
+ * Handler for python errors, info will be saved into yast logs
+ * FUnction saves info from void PyErr_Fetch(PyObject **ptype, PyObject **pvalue, PyObject **ptraceback)
+ **/
+ static string PyErrorHandler();
private:
diff -urN --exclude=CVS --exclude=.cvsignore --exclude=.svn --exclude=.svnignore old/yast2-python-bindings-2.16.1/VERSION new/yast2-python-bindings-2.16.2/VERSION
--- old/yast2-python-bindings-2.16.1/VERSION 2007-11-15 13:35:39.000000000 +0100
+++ new/yast2-python-bindings-2.16.2/VERSION 2007-12-05 10:20:41.000000000 +0100
@@ -1 +1 @@
-2.16.1
+2.16.2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
---------------------------------------------------------------------
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org