Hello community,
here is the log from the commit of package yast2-python-bindings for
openSUSE:Factory checked in at 2018-03-22 12:04:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/yast2-python-bindings (Old)
and /work/SRC/openSUSE:Factory/.yast2-python-bindings.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "yast2-python-bindings"
Thu Mar 22 12:04:40 2018 rev:36 rq:589219 version:4.0.3
Changes:
--------
---
/work/SRC/openSUSE:Factory/yast2-python-bindings/yast2-python-bindings.changes
2018-01-31 19:52:12.692584758 +0100
+++
/work/SRC/openSUSE:Factory/.yast2-python-bindings.new/yast2-python-bindings.changes
2018-03-22 12:10:30.322085505 +0100
@@ -1,0 +2,7 @@
+Fri Mar 9 16:35:09 UTC 2018 - [email protected]
+
+- Adapt the bindings to allow modules that will run in both python2
+ or python3. Also fix a py3 binary mistakenly packaged with the py2
+ bindings package (bsc#1074696).
+
+-------------------------------------------------------------------
Old:
----
yast2-python-bindings-4.0.2.tar.bz2
New:
----
yast2-python-bindings-4.0.3.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ yast2-python-bindings.spec ++++++
--- /var/tmp/diff_new_pack.onxYN4/_old 2018-03-22 12:10:31.430045793 +0100
+++ /var/tmp/diff_new_pack.onxYN4/_new 2018-03-22 12:10:31.438045506 +0100
@@ -28,9 +28,9 @@
%define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import
get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
Name: yast2-python-bindings
-Version: 4.0.2
+Version: 4.0.3
Release: 0
-Summary: Python3 bindings for the YaST platform
+Summary: Python bindings for the YaST platform
License: GPL-2.0
Group: System/YaST
@@ -113,7 +113,9 @@
%__install -m 0755 %{builddir}/python3/_ycp.so*
%{buildroot}/%{python3_sitearch}/
%__ln_s %{python3_sitearch}/_ycp.so.0.0.0
%{buildroot}/%{python3_sitearch}/_ycp.so.0
%__ln_s %{python3_sitearch}/_ycp.so.0.0.0
%{buildroot}/%{python3_sitearch}/_ycp.so
-%__install -m 0755 %{builddir}/python3/libpy2lang_python.so*
%{buildroot}/%{yast_plugindir}/
+%__install -m 0755 %{builddir}/python3/libpy2lang_python.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so.0.0.0
+%__ln_s %{yast_plugindir}/libpy2lang_python3.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so
+%__ln_s %{yast_plugindir}/libpy2lang_python3.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so.0
%endif
%if %{with_python3}
@@ -122,8 +124,8 @@
%doc %{yast_docdir}
%{python3_sitelib}/*.py
%{python3_sitearch}/_ycp.so*
-%{yast_plugindir}/libpy2lang_python.so.*
-%{yast_plugindir}/libpy2lang_python.so
+%{yast_plugindir}/libpy2lang_python3.so.*
+%{yast_plugindir}/libpy2lang_python3.so
%endif
%files -n yast2-python-bindings
++++++ yast2-python-bindings-4.0.2.tar.bz2 ->
yast2-python-bindings-4.0.3.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-python-bindings-4.0.2/package/yast2-python-bindings.changes
new/yast2-python-bindings-4.0.3/package/yast2-python-bindings.changes
--- old/yast2-python-bindings-4.0.2/package/yast2-python-bindings.changes
2018-01-30 16:31:46.000000000 +0100
+++ new/yast2-python-bindings-4.0.3/package/yast2-python-bindings.changes
2018-03-16 18:19:44.000000000 +0100
@@ -1,4 +1,11 @@
-------------------------------------------------------------------
+Fri Mar 9 16:35:09 UTC 2018 - [email protected]
+
+- Adapt the bindings to allow modules that will run in both python2
+ or python3. Also fix a py3 binary mistakenly packaged with the py2
+ bindings package (bsc#1074696).
+
+-------------------------------------------------------------------
Mon Jan 29 22:44:08 UTC 2018 - [email protected]
- Build both python2 and python3 versions of the bindings;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/yast2-python-bindings-4.0.2/package/yast2-python-bindings.spec
new/yast2-python-bindings-4.0.3/package/yast2-python-bindings.spec
--- old/yast2-python-bindings-4.0.2/package/yast2-python-bindings.spec
2018-01-30 16:31:46.000000000 +0100
+++ new/yast2-python-bindings-4.0.3/package/yast2-python-bindings.spec
2018-03-16 18:19:44.000000000 +0100
@@ -28,9 +28,9 @@
%define python3_sitearch %(%{__python3} -c "from distutils.sysconfig import
get_python_lib; import sys; sys.stdout.write(get_python_lib(1))")
Name: yast2-python-bindings
-Version: 4.0.2
+Version: 4.0.3
Release: 0
-Summary: Python3 bindings for the YaST platform
+Summary: Python bindings for the YaST platform
License: GPL-2.0
Group: System/YaST
@@ -113,7 +113,9 @@
%__install -m 0755 %{builddir}/python3/_ycp.so*
%{buildroot}/%{python3_sitearch}/
%__ln_s %{python3_sitearch}/_ycp.so.0.0.0
%{buildroot}/%{python3_sitearch}/_ycp.so.0
%__ln_s %{python3_sitearch}/_ycp.so.0.0.0
%{buildroot}/%{python3_sitearch}/_ycp.so
-%__install -m 0755 %{builddir}/python3/libpy2lang_python.so*
%{buildroot}/%{yast_plugindir}/
+%__install -m 0755 %{builddir}/python3/libpy2lang_python.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so.0.0.0
+%__ln_s %{yast_plugindir}/libpy2lang_python3.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so
+%__ln_s %{yast_plugindir}/libpy2lang_python3.so.0.0.0
%{buildroot}/%{yast_plugindir}/libpy2lang_python3.so.0
%endif
%if %{with_python3}
@@ -122,8 +124,8 @@
%doc %{yast_docdir}
%{python3_sitelib}/*.py
%{python3_sitearch}/_ycp.so*
-%{yast_plugindir}/libpy2lang_python.so.*
-%{yast_plugindir}/libpy2lang_python.so
+%{yast_plugindir}/libpy2lang_python3.so.*
+%{yast_plugindir}/libpy2lang_python3.so
%endif
%files -n yast2-python-bindings
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-python-bindings-4.0.2/src/yast-core.i
new/yast2-python-bindings-4.0.3/src/yast-core.i
--- old/yast2-python-bindings-4.0.2/src/yast-core.i 2018-01-30
16:31:46.000000000 +0100
+++ new/yast2-python-bindings-4.0.3/src/yast-core.i 2018-03-16
18:19:44.000000000 +0100
@@ -1,4 +1,7 @@
%module ycp
+%begin %{
+#define SWIG_PYTHON_2_UNICODE
+%}
%feature("autodoc", "3");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-python-bindings-4.0.2/src/yast.py
new/yast2-python-bindings-4.0.3/src/yast.py
--- old/yast2-python-bindings-4.0.2/src/yast.py 2018-01-30 16:31:46.000000000
+0100
+++ new/yast2-python-bindings-4.0.3/src/yast.py 2018-03-16 18:19:44.000000000
+0100
@@ -1,3 +1,4 @@
+from __future__ import absolute_import, division, print_function,
unicode_literals
import ycpbuiltins
from ycp import Symbol, List, String, Integer, Boolean, Float, Code, Map,
Byteblock, Path, Void
@@ -135,7 +136,11 @@
def Term(*args):
from ycp import Term as YCPTerm
from ycp import pyval_to_ycp
- name = args[0]
+ from six import binary_type, text_type, PY2
+ if PY2 and isinstance(args[0], text_type):
+ name = binary_type(args[0])
+ else:
+ name = args[0]
l = None
if len(args) > 1:
l = List()
@@ -147,8 +152,11 @@
def Opt(*args):
from ycp import Term as YCPTerm
+ from six import binary_type, text_type, PY2
l = List()
for arg in args:
+ if PY2 and isinstance(arg, text_type):
+ arg = binary_type(arg)
l.add(Symbol(arg))
return YCPTerm("opt", l)
@@ -156,9 +164,13 @@
def Id(arg, dont_force_sym = False):
from ycp import pyval_to_ycp
from ycp import Term as YCPTerm
+ from six import binary_type, text_type, PY2
l = List()
- if isinstance(arg, str) and not dont_force_sym:
- l.add(Symbol(arg))
+ if isinstance(arg, text_type) and not dont_force_sym:
+ if PY2:
+ l.add(Symbol(binary_type(arg)))
+ else:
+ l.add(Symbol(arg))
else:
l.add(pyval_to_ycp(arg))
return YCPTerm("id", l)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-python-bindings-4.0.2/src/ycpbuiltins.py
new/yast2-python-bindings-4.0.3/src/ycpbuiltins.py
--- old/yast2-python-bindings-4.0.2/src/ycpbuiltins.py 2018-01-30
16:31:46.000000000 +0100
+++ new/yast2-python-bindings-4.0.3/src/ycpbuiltins.py 2018-03-16
18:19:44.000000000 +0100
@@ -1,3 +1,4 @@
+from __future__ import absolute_import, division, print_function,
unicode_literals
from ycp import List, String, Integer, Boolean, Float, Value
from ycp import Term as YCPTerm
@@ -52,7 +53,7 @@
return None
return listOrMap
-# add — Add a key/value pair to a map or list
+# add - Add a key/value pair to a map or list
def add(listOrMap, key, value=None):
from ycp import pyval_to_ycp
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/yast2-python-bindings-4.0.2/src/ytypes.i
new/yast2-python-bindings-4.0.3/src/ytypes.i
--- old/yast2-python-bindings-4.0.2/src/ytypes.i 2018-01-30
16:31:46.000000000 +0100
+++ new/yast2-python-bindings-4.0.3/src/ytypes.i 2018-03-16
18:19:44.000000000 +0100
@@ -22,10 +22,14 @@
return YCPFloat(PyFloat_AsDouble(input));
if (PyString_Check(input))
return YCPString(PyString_AsString(input));
+ if (PyUnicode_Check(input)) {
#if PY_MAJOR_VERSION >= 3
- if (PyUnicode_Check(input))
return YCPString(_PyUnicode_AsString(input));
+#else
+ PyObject* encoded = PyUnicode_Encode(PyUnicode_AsUnicode(input),
PyUnicode_GetSize(input), "ascii", NULL);
+ return YCPString(PyBytes_AsString(encoded));
#endif
+ }
if (PyList_Check(input)) {
auto size = PyList_Size(input);
if (size > 0 && PyFunction_Check(PyList_GetItem(input, 0))) {