Accepting request 589977 from home:mwilck:hplip
- photocard.py: fixed broken import statement (bsc#1071255) * added photocard-fix-import-error-for-pcardext.patch * spec file: fixed dependency for dbus-1-python (Leap42.2) - 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) OBS-URL: https://build.opensuse.org/request/show/589977 OBS-URL: https://build.opensuse.org/package/show/Printing/hplip?expand=0&rev=151
This commit is contained in:
86
hplip.spec
86
hplip.spec
@@ -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 @@ Patch109: no-systray-failure-message.patch
|
||||
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: libtool
|
||||
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 @@ Requires: %{name}-sane = %{version}-%{release}
|
||||
# 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 @@ Requires: foomatic-filters
|
||||
# (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 @@ Requires: python-qt4
|
||||
# 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 @@ This sub-package is only required by developers.
|
||||
# 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 @@ export CXXFLAGS="%{optflags} -fno-strict-aliasing"
|
||||
--with-mimedir=%{_sysconfdir}/cups \
|
||||
--with-docdir=%{_defaultdocdir}/%{name} \
|
||||
--with-htmldir==%{_defaultdocdir}/%{name} \
|
||||
CFLAGS='%{optflags}'
|
||||
CFLAGS='%{optflags}' \
|
||||
PYTHON=%{pyexe}
|
||||
make
|
||||
|
||||
%install
|
||||
@@ -450,17 +486,31 @@ make DESTDIR=%{buildroot} install
|
||||
# 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 @@ exit 0
|
||||
%{_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
|
||||
|
Reference in New Issue
Block a user