Hello community,

here is the log from the commit of package hplip for openSUSE:Factory checked 
in at 2018-03-24 16:08:53
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/hplip (Old)
 and      /work/SRC/openSUSE:Factory/.hplip.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "hplip"

Sat Mar 24 16:08:53 2018 rev:115 rq:590041 version:3.17.9

Changes:
--------
--- /work/SRC/openSUSE:Factory/hplip/hplip.changes      2017-10-23 
16:36:47.495018170 +0200
+++ /work/SRC/openSUSE:Factory/.hplip.new/hplip.changes 2018-03-24 
16:08:54.849482712 +0100
@@ -1,0 +2,19 @@
+Thu Mar 22 08:44:17 UTC 2018 - [email protected]
+
+- photocard.py: fixed broken import statement (bsc#1071255) 
+  * added photocard-fix-import-error-for-pcardext.patch
+  * spec file: fixed dependency for dbus-1-python
+
+-------------------------------------------------------------------
+Wed Mar 21 23:52:02 UTC 2018 - [email protected]
+
+- Use python3 on tumbleweed and SLE15/Leap15 (bsc#1071255)
+  * add pcardext-python3-fixes.patch
+  * add hplip-misc-missing-includes-and-definitions.patch
+  * hp_ipp.h-add-missing-prototypes.patch
+  * spec file: replace "/usr/bin/env python" and "/usr/bin/python" with
+    desired interpreter
+  * spec file: add py2/py3 selection macros
+  * spec file: dropped python-openssl build dependency (not needed anymore)
+
+-------------------------------------------------------------------

New:
----
  hp_ipp.h-add-missing-prototypes.patch
  hplip-misc-missing-includes-and-definitions.patch
  pcardext-python3-fixes.patch
  photocard-fix-import-error-for-pcardext.patch

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ hplip.spec ++++++
--- /var/tmp/diff_new_pack.owHa37/_old  2018-03-24 16:08:56.573420567 +0100
+++ /var/tmp/diff_new_pack.owHa37/_new  2018-03-24 16:08:56.577420422 +0100
@@ -1,7 +1,7 @@
 #
 # spec file for package hplip
 #
-# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
 #
 # All modifications and additions to the file contributed by third parties
 # remain the property of their copyright owners, unless otherwise agreed
@@ -16,6 +16,20 @@
 #
 
 
+%if 0%{suse_version} >= 1500
+%define pyversion 3
+%define pymod() python3-%{**}
+%define pyver %py3_ver
+%define pyexe /usr/bin/python3
+%define gobject gobject
+%else
+%define pyversion 2
+%define pymod() python-%{**}
+%define pyver %py_ver
+%define pyexe /usr/bin/python
+%define gobject gobject2
+%endif
+
 %if 0%{?suse_version} == 1315 && 0%{?is_opensuse}
 %define is_leap 1
 %else
@@ -79,6 +93,13 @@
 Patch200:       hplip-mdns.patch
 # Patch201 makes MDNS lookups more robust by retrying queries:
 Patch201:       hplip-mdns-retry-query.patch
+# Python3 port: cleanup patches
+Patch300:       pcardext-python3-fixes.patch
+Patch301:       hplip-misc-missing-includes-and-definitions.patch
+Patch302:       hp_ipp.h-add-missing-prototypes.patch
+# Fix import error for pcardext
+Patch303:       photocard-fix-import-error-for-pcardext.patch
+
 BuildRequires:  dbus-1-devel
 BuildRequires:  fdupes
 BuildRequires:  hicolor-icon-theme
@@ -89,20 +110,20 @@
 BuildRequires:  libusb-1_0-devel
 BuildRequires:  net-snmp-devel
 BuildRequires:  pkgconfig
+# BuildRequires:  python-rpm-macros
 # All printer driver packages should have "BuildRequires: python-cups"
 # because python-cups installs special rpm macros that adds Provides tags
 # for the printer drivers supported by the package,
 # see https://bugzilla.novell.com/show_bug.cgi?id=735865
-BuildRequires:  python-cups
-BuildRequires:  python-devel
-BuildRequires:  python-openssl
+BuildRequires:  %{pymod cups}
+BuildRequires:  %{pymod devel}
 %if %use_qt5
-BuildRequires:  python-qt5-devel
+BuildRequires:  %{pymod qt5-devel}
 %else
+BuildRequires:  %{pymod qt4}
 BuildRequires:  libqt4-devel
-BuildRequires:  python-qt4
 %endif
-BuildRequires:  python-xml
+BuildRequires:  %{pymod xml}
 BuildRequires:  readline-devel
 BuildRequires:  update-desktop-files
 # Require the exact matching version-release of the hpijs sub-package to make 
sure
@@ -118,7 +139,11 @@
 # The dbus stuff in HPLIP requires the Python module gobject
 # but there is no automated RPM requirement for python-gobject2,
 # see https://answers.launchpad.net/hplip/+question/30741
+%if 0%{pyversion} == 3
+Requires:       dbus-1-python3 >= 0.80
+%else
 Requires:       dbus-1-python >= 0.80
+%endif
 # Because foomatic-rip-hplip has CVE-2011-2697 (bnc#698451)
 # plus a leftover in CVE-2004-0801 (bnc#59233)
 # foomatic-rip-hplip is no longer installed and foomatic-rip
@@ -139,13 +164,13 @@
 # (see the comment for the hplip-hpijs sub-package below).
 # Therefore the hplip main package which is intended
 # to get "all the HPLIP stuff" installed has the RPM requirement:
+Requires:       %{pymod %gobject}
 Requires:       ghostscript
-Requires:       python-gobject2
 
 %if %use_qt5
-Requires:       python-qt5
+Requires:       %{pymod qt5}
 %else
-Requires:       python-qt4
+Requires:       %{pymod qt4}
 %endif
 # Require special Python stuff (which pulls in Python base stuff).
 # At least since openSUSE 11.1 and SLE11 pyxml is no longer required
@@ -153,7 +178,7 @@
 #  see https://answers.launchpad.net/hplip/+question/25696)
 # but meanwhile python-xml alone is sufficient for "import xml.parsers.expat"
 # see https://bugzilla.novell.com/show_bug.cgi?id=656779#c3
-Requires:       python-xml
+Requires:       %{pymod xml}
 Requires(post): %{_bindir}/find
 Requires(post): /bin/grep
 Requires(post): /bin/sed
@@ -370,9 +395,19 @@
 # Patch108 add_missing_includes_and_define_GNU_SOURCE.patch adds missing 
'#include <...>'
 # and missing '#define _GNU_SOURCE' see 
https://bugs.launchpad.net/hplip/+bug/1456590
 %patch108 -p1 -b .add_missing_includes_and_define_GNU_SOURCE.orig
-%patch109 -p1 -b systemtray.py.orig
+%patch109 -p1 -b .systemtray.py.orig
 %patch200 -p1 -b .mdns
 %patch201 -p1 -b .mdns-retry
+%patch300 -p1 -b .pcardext-python3
+%patch301 -p1 -b .misc-headers
+%patch302 -p1 -b .hp_ipp_missing_prototypes
+%patch303 -p1 -b .photocard_import
+
+# replace "env" shebang and "/usr/bin/python" with real executable
+find . -name '*.py' -o -name pstotiff | \
+    xargs -n 1 sed -i '1s,^#!\(/usr/bin/env 
python\|/usr/bin/python\),#!%{pyexe},'
+sed -i 's,/usr/bin/python\>,%{pyexe},'  \
+    data/rules/*
 
 %build
 # If AUTOMAKE='automake --foreign' is not set, autoreconf (in fact automake)
@@ -437,7 +472,8 @@
             --with-mimedir=%{_sysconfdir}/cups \
             --with-docdir=%{_defaultdocdir}/%{name} \
             --with-htmldir==%{_defaultdocdir}/%{name} \
-           CFLAGS='%{optflags}'
+           CFLAGS='%{optflags}' \
+           PYTHON=%{pyexe}
 make
 
 %install
@@ -450,17 +486,31 @@
 # which results longer program startup time and waste of CPU for compiling,
 # see https://en.opensuse.org/openSUSE:Packaging_Python#Byte_Compiled_Files
 # and http://lists.opensuse.org/opensuse-packaging/2014-10/msg00028.html
+
+%if 0%{pyversion} == 3
+# Make and install .pyc files:
+%py3_compile %{buildroot}%{_datadir}/hplip
+# Make and install .pyo files:
+%py3_compile -O %{buildroot}%{_datadir}/hplip
+%else
 # Make and install .pyc files:
 %py_compile %{buildroot}%{_datadir}/hplip
 # Make and install .pyo files:
 %py_compile -O %{buildroot}%{_datadir}/hplip
+%endif
+
 # Hardlink .pyc and .pyo when they have same content.
 # Do not run "fdupes buildroot/_datadir/hplip" because
 # fdupes will link any files with same content there
 # which can have unexpected side-effects, compare
 # https://bugzilla.opensuse.org/show_bug.cgi?id=784670
 for pyc in $( find %{buildroot}%{_datadir}/hplip -name '*.pyc' )
-do pyo="${pyc%.pyc}.pyo"
+do
+%if 0%{pyversion} == 3
+   pyo="${pyc%.pyc}.opt-1.pyc"
+%else
+   pyo="${pyc%.pyc}.pyo"
+%endif
    if test -f $pyo && cmp -s $pyc $pyo
    then echo hardlinking $pyc and $pyo because both have same content
         ln -f $pyc $pyo
@@ -708,10 +758,10 @@
 %{_bindir}/hp-unload
 %{_bindir}/hp-upgrade
 %{_bindir}/hp-wificonfig
-%{_libdir}/python%{py_ver}/site-packages/cupsext.*
-%{_libdir}/python%{py_ver}/site-packages/hpmudext.*
-%{_libdir}/python%{py_ver}/site-packages/pcardext.*
-%{_libdir}/python%{py_ver}/site-packages/scanext.*
+%{_libdir}/python%{pyver}/site-packages/cupsext.*
+%{_libdir}/python%{pyver}/site-packages/hpmudext.*
+%{_libdir}/python%{pyver}/site-packages/pcardext.*
+%{_libdir}/python%{pyver}/site-packages/scanext.*
 %dir %{_libexecdir}/cups
 %dir %{_libexecdir}/cups/backend
 %{_libexecdir}/cups/backend/hpfax

++++++ hp_ipp.h-add-missing-prototypes.patch ++++++
>From e69884e9581d3c6013389ac0efa4e3778dbbee68 Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
Date: Wed, 21 Mar 2018 23:56:41 +0100
Subject: [PATCH] hp_ipp.h: add missing prototypes

---
 protocol/hp_ipp.h | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/protocol/hp_ipp.h b/protocol/hp_ipp.h
index 3853f8432dae..24daf8b37a9a 100644
--- a/protocol/hp_ipp.h
+++ b/protocol/hp_ipp.h
@@ -149,6 +149,7 @@ int auth_cancel_req = 0;  // 0--> authentication cancel is 
not requested,
 
 
 http_t*    acquireCupsInstance();
+void _releaseCupsInstance();
 const char *getCupsErrorString(int status);
 void freePrinterList(printer_t *list);
  
@@ -162,6 +163,11 @@ ipp_t * usbDoRequest(ipp_t *request, char* device_uri);
 ipp_t * networkDoRequest(ipp_t *request, char* device_uri);
 ipp_t * getDeviceStatusAttributes(char* device_uri, int *count);
 int     getCupsPrinters(printer_t **printer_list);
+int addCupsPrinter(char *name, char *device_uri, char *location, char 
*ppd_file,
+                  char *model, char *info);
+int delCupsPrinter(char *pr_name);
+int setDefaultCupsPrinter(char *pr_name);
+int controlCupsPrinter(char *pr_name, int op);
 
 HPIPP_RESULT parseResponseHeader(char* header, int *content_length, int 
*chunked, int* header_size);
 HPIPP_RESULT prepend_http_header(raw_ipp *raw_request);
-- 
2.16.1



++++++ hplip-misc-missing-includes-and-definitions.patch ++++++
>From 6dd5de8c21284530a7d9716b979812446cc4eb79 Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
Date: Wed, 21 Mar 2018 23:56:05 +0100
Subject: [PATCH] hplip: misc missing #includes and definitions

---
 protocol/discovery/mdns.c | 1 +
 protocol/discovery/mdns.h | 1 +
 scan/sane/hpaio.c         | 1 +
 scan/sane/http.c          | 1 +
 4 files changed, 4 insertions(+)

diff --git a/protocol/discovery/mdns.c b/protocol/discovery/mdns.c
index 75ef0eab7214..c58d218390f5 100644
--- a/protocol/discovery/mdns.c
+++ b/protocol/discovery/mdns.c
@@ -40,6 +40,7 @@
 #include <net/if.h>
 #include "mdns.h"
 #include <unistd.h>
+#include <ctype.h>
 #include <sys/ioctl.h>
 
 /* Convert "www.google.com" to "3www6google3com". */
diff --git a/protocol/discovery/mdns.h b/protocol/discovery/mdns.h
index 56d8847da28a..d64e668fe194 100644
--- a/protocol/discovery/mdns.h
+++ b/protocol/discovery/mdns.h
@@ -105,5 +105,6 @@ static unsigned char* mdns_readMDL(unsigned char *p, 
unsigned char *normalized_m
 static DNS_RECORD* send_and_receive(struct mdns_socket *mdns_sock, const char 
*name,
                                    int query_type, int read_mode);
 static int get_ipv4_address(const char *iface, struct in_addr *addr);
+int mdns_probe_nw_scanners(char* uris_buf, int buf_size, int *count);
 #endif // _DISCOVERY_MDNS_H
 
diff --git a/scan/sane/hpaio.c b/scan/sane/hpaio.c
index ae34cfb63fd9..28899d10bae3 100644
--- a/scan/sane/hpaio.c
+++ b/scan/sane/hpaio.c
@@ -46,6 +46,7 @@
 #include "sclpml.h"
 #include "escl.h"
 #include "io.h"
+#include "mdns.h"
 
 #define DEBUG_DECLARE_ONLY
 #include "sanei_debug.h"
diff --git a/scan/sane/http.c b/scan/sane/http.c
index 800df91bb3f3..ae5edf4c8fe8 100644
--- a/scan/sane/http.c
+++ b/scan/sane/http.c
@@ -33,6 +33,7 @@
 
 #include <stdio.h>
 #include <stdlib.h>
+#include <unistd.h>
 #include <string.h>
 #include <syslog.h>
 #include <ctype.h>
-- 
2.16.1


++++++ pcardext-python3-fixes.patch ++++++
>From 74ed15a16e7564d0665afc68defbd6d03bdff21d Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
Date: Wed, 21 Mar 2018 23:55:12 +0100
Subject: [PATCH] pcardext: python3 fixes

---
 pcard/pcardext/pcardext.c | 36 ++++++++++++++++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/pcard/pcardext/pcardext.c b/pcard/pcardext/pcardext.c
index c1a8273e4359..cdf260d62223 100644
--- a/pcard/pcardext/pcardext.c
+++ b/pcard/pcardext/pcardext.c
@@ -36,6 +36,12 @@ typedef int Py_ssize_t;
 #define PY_SSIZE_T_MIN INT_MIN
 #endif
 
+#if PY_MAJOR_VERSION >= 3
+#define PyString_AsStringAndSize PyBytes_AsStringAndSize
+#define PyString_FromStringAndSize PyBytes_FromStringAndSize
+#define PyInt_AS_LONG PyLong_AS_LONG
+#endif
+
 int verbose=0;
 
 PyObject * readsectorFunc = NULL;
@@ -78,8 +84,11 @@ int WriteSector(int sector, int nsector, void *buf, int size 
)
     
     if( writesectorFunc )
     {
+#if PY_MAJOR_VERSION >= 3
         result = PyObject_CallFunction( writesectorFunc, "iis#", sector, 
nsector, buf, size );
-        
+#else
+        result = PyObject_CallFunction( writesectorFunc, "iiy#", sector, 
nsector, buf, size );
+#endif
         return PyInt_AS_LONG( result );
     }
 
@@ -230,9 +239,31 @@ static PyMethodDef pcardext_methods[] =
     { NULL, NULL }
 };  
 
-
 static char pcardext_documentation[] = "Python extension for HP photocard 
services";
 
+#if PY_MAJOR_VERSION >= 3
+static struct PyModuleDef moduledef = {
+        .m_base = PyModuleDef_HEAD_INIT,
+        .m_name = "pcardext",
+        .m_doc = pcardext_documentation,
+        .m_size = -1,
+        .m_methods = pcardext_methods,
+        .m_slots = NULL,
+        .m_traverse = NULL,
+        .m_clear = NULL,
+        .m_free = NULL,
+};
+
+PyMODINIT_FUNC
+PyInit_pcardext( void )
+{
+       PyObject *module = PyModule_Create2(&moduledef, PYTHON_API_VERSION);
+
+       return module;
+}
+
+#else
+
 void initpcardext( void )
 {
     PyObject * mod = Py_InitModule4( "pcardext", pcardext_methods, 
@@ -243,4 +274,5 @@ void initpcardext( void )
       return;
 }
 
+#endif
 
-- 
2.16.1

++++++ photocard-fix-import-error-for-pcardext.patch ++++++
>From adca775071398e0dbb87a972798ee82975794640 Mon Sep 17 00:00:00 2001
From: Martin Wilck <[email protected]>
Date: Thu, 22 Mar 2018 09:30:38 +0100
Subject: [PATCH] photocard: fix import error for pcardext

Due to the way the C module is installed, explicit relative
import doesn't work for pcardext.
---
 pcard/photocard.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pcard/photocard.py b/pcard/photocard.py
index 913dc4e98d7f..2c7315883c8d 100644
--- a/pcard/photocard.py
+++ b/pcard/photocard.py
@@ -30,7 +30,7 @@ from base.codes import *
 from base import device, utils, exif
 
 try:
-    from . import pcardext
+    import pcardext
 except ImportError:
     if not os.getenv("HPLIP_BUILD"):
         log.error("PCARDEXT could not be loaded. Please check HPLIP 
installation.")
-- 
2.16.1


Reply via email to