[python-cups/f16] Define all constants regardless of the version of CUPS being built against (bug #807400).

Tim Waugh twaugh at fedoraproject.org
Wed Mar 28 09:12:58 UTC 2012


commit ce73011afea1642ffbade0932f1dba996e159502
Author: Tim Waugh <twaugh at redhat.com>
Date:   Wed Mar 28 09:57:46 2012 +0100

    Define all constants regardless of the version of CUPS being built against (bug #807400).

 python-cups-constants.patch |   75 +++++++++++++++++++++++++++++++++++++++++++
 python-cups.spec            |    9 ++++-
 2 files changed, 83 insertions(+), 1 deletions(-)
---
diff --git a/python-cups-constants.patch b/python-cups-constants.patch
new file mode 100644
index 0000000..ffe1b08
--- /dev/null
+++ b/python-cups-constants.patch
@@ -0,0 +1,75 @@
+diff -U0 pycups-1.9.60/ChangeLog.constants pycups-1.9.60/ChangeLog
+diff -up pycups-1.9.60/cupsmodule.c.constants pycups-1.9.60/cupsmodule.c
+--- pycups-1.9.60/cupsmodule.c.constants	2011-10-06 16:36:38.000000000 +0100
++++ pycups-1.9.60/cupsmodule.c	2012-03-28 09:55:35.532457425 +0100
+@@ -1,6 +1,6 @@
+ /*
+  * cups - Python bindings for CUPS
+- * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011  Red Hat, Inc
++ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012  Red Hat, Inc
+  * Author: Tim Waugh <twaugh at redhat.com>
+  *
+  * This program is free software; you can redistribute it and/or modify
+@@ -37,6 +37,21 @@
+ static pthread_key_t tls_key = -1;
+ static pthread_once_t tls_key_once = PTHREAD_ONCE_INIT;
+ 
++#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 3)
++# define CUPS_PRINTER_DISCOVERED	0x1000000
++# define CUPS_SERVER_REMOTE_ANY		"_remote_any"
++#endif /* CUPS < 1.3 */
++
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 5)
++# define HTTP_AUTHORIZATION_CANCELED	1000
++#endif /* CUPS < 1.4 */
++
++#if CUPS_VERSION_MAJOR < 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR < 5)
++# define HTTP_PKI_ERROR			1001
++# define IPP_AUTHENTICATION_CANCELED	0x1000
++# define IPP_PKI_ERROR			0x1001
++#endif /* CUPS < 1.5 */
++
+ //////////////////////
+ // Worker functions //
+ //////////////////////
+@@ -666,9 +681,7 @@ initcups (void)
+   INT_CONSTANT (CUPS_PRINTER_AUTHENTICATED);
+   INT_CONSTANT (CUPS_PRINTER_COMMANDS);
+   INT_CONSTANT (CUPS_PRINTER_OPTIONS);
+-#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 3)
+   INT_CONSTANT (CUPS_PRINTER_DISCOVERED);
+-#endif /* CUPS 1.3 */
+ 
+   // HTTP encryption
+   INT_CONSTANT (HTTP_ENCRYPT_IF_REQUESTED);
+@@ -693,9 +706,7 @@ initcups (void)
+   INT_CONSTANT (HTTP_GATEWAY_TIMEOUT);
+   INT_CONSTANT (HTTP_NOT_SUPPORTED);
+   INT_CONSTANT (HTTP_AUTHORIZATION_CANCELED);
+-#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 5)
+   INT_CONSTANT (HTTP_PKI_ERROR);
+-#endif /* CUPS 1.5 */
+ 
+   // PPD UI enum
+   INT_CONSTANT (PPD_UI_BOOLEAN);
+@@ -815,10 +826,8 @@ initcups (void)
+   INT_CONSTANT (IPP_ERROR_JOB_CANCELLED);
+   INT_CONSTANT (IPP_MULTIPLE_JOBS_NOT_SUPPORTED);
+   INT_CONSTANT (IPP_PRINTER_IS_DEACTIVATED);
+-#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 5)
+   INT_CONSTANT (IPP_AUTHENTICATION_CANCELED);
+   INT_CONSTANT (IPP_PKI_ERROR);
+-#endif /* CUPS 1.5 */
+ 
+   // IPP states
+   INT_CONSTANT (IPP_ERROR);
+@@ -858,9 +867,7 @@ initcups (void)
+   STR_CONSTANT (CUPS_SERVER_REMOTE_PRINTERS);
+   STR_CONSTANT (CUPS_SERVER_SHARE_PRINTERS);
+   STR_CONSTANT (CUPS_SERVER_USER_CANCEL_ANY);
+-#if CUPS_VERSION_MAJOR > 1 || (CUPS_VERSION_MAJOR == 1 && CUPS_VERSION_MINOR >= 3)
+   STR_CONSTANT (CUPS_SERVER_REMOTE_ANY);
+-#endif /* CUPS 1.3 */
+ 
+   // Exceptions
+   obj = PyDict_New ();
diff --git a/python-cups.spec b/python-cups.spec
index c8cb611..b51b221 100644
--- a/python-cups.spec
+++ b/python-cups.spec
@@ -6,7 +6,7 @@
 Summary:       Python bindings for CUPS
 Name:          python-cups
 Version:       1.9.60
-Release:       2%{?dist}
+Release:       3%{?dist}
 URL:           http://cyberelk.net/tim/software/pycups/
 Source:        http://cyberelk.net/tim/data/pycups/pycups-%{version}.tar.bz2
 License:       GPLv2+
@@ -15,6 +15,8 @@ BuildRequires: cups-devel
 BuildRequires: python2-devel
 BuildRequires: epydoc
 
+Patch1: python-cups-constants.patch
+
 Conflicts: rpm-build < 4.9.0
 
 %description
@@ -31,6 +33,7 @@ Documentation for python-cups.
 
 %prep
 %setup -q -n pycups-%{version}
+%patch1 -p1 -b .constants
 
 %build
 make CFLAGS="%{optflags} -fno-strict-aliasing"
@@ -52,6 +55,10 @@ make install DESTDIR="%{buildroot}"
 %doc examples html
 
 %changelog
+* Wed Mar 28 2012 Tim Waugh <twaugh at redhat.com> - 1.9.60-3
+- Define all constants regardless of the version of CUPS being built
+  against (bug #807400).
+
 * Sat Jan 14 2012 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.9.60-2
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild
 


More information about the scm-commits mailing list