- Updated pycups to 1.9.32.

This commit is contained in:
Tim Waugh 2007-12-17 12:42:56 +00:00
parent d776d229d9
commit 4a1969277f
7 changed files with 6 additions and 165 deletions

View File

@ -148,3 +148,4 @@ pycups-1.9.29.tar.bz2
pycups-1.9.30.tar.bz2
pycups-1.9.31.tar.bz2
system-config-printer-0.7.78.tar.bz2
pycups-1.9.32.tar.bz2

Binary file not shown.

BIN
pycups-1.9.32.tar.bz2.sig Normal file

Binary file not shown.

View File

@ -1,136 +0,0 @@
diff -up pycups-1.9.31/cupsconnection.c.attributes-uri pycups-1.9.31/cupsconnection.c
--- pycups-1.9.31/cupsconnection.c.attributes-uri 2007-11-27 12:47:43.000000000 +0000
+++ pycups-1.9.31/cupsconnection.c 2007-11-27 12:48:46.000000000 +0000
@@ -1975,42 +1975,77 @@ PyObject_from_attr_value (ipp_attribute_
}
static PyObject *
-Connection_getPrinterAttributes (Connection *self, PyObject *args)
+Connection_getPrinterAttributes (Connection *self, PyObject *args,
+ PyObject *kwds)
{
PyObject *ret;
- PyObject *nameobj;
+ PyObject *nameobj = NULL;
char *name;
+ PyObject *uriobj = NULL;
+ char *uri;
ipp_t *request, *answer;
ipp_attribute_t *attr;
- char uri[HTTP_MAX_URI];
+ char consuri[HTTP_MAX_URI];
int i;
+ static char *kwlist[] = { "name", "uri", NULL };
+
+ if (!PyArg_ParseTupleAndKeywords (args, kwds, "|OO", kwlist,
+ &nameobj, &uriobj))
+ return NULL;
- if (!PyArg_ParseTuple (args, "O", &nameobj))
+ if (nameobj && uriobj) {
+ PyErr_SetString (PyExc_RuntimeError,
+ "name or uri must be specified but not both");
return NULL;
+ }
- if (UTF8_from_PyObj (&name, nameobj) == NULL)
+ if (nameobj) {
+ if (UTF8_from_PyObj (&name, nameobj) == NULL)
+ return NULL;
+ } else if (uriobj) {
+ if (UTF8_from_PyObj (&uri, uriobj) == NULL)
+ return NULL;
+ } else {
+ PyErr_SetString (PyExc_RuntimeError,
+ "name or uri must be specified");
return NULL;
+ }
+
+ debugprintf ("-> Connection_getPrinterAttributes(%s)\n",
+ nameobj ? name : uri);
+ if (nameobj) {
+ snprintf (consuri, sizeof (consuri), "ipp://localhost/printers/%s", name);
+ free (name);
+ uri = consuri;
+ }
- snprintf (uri, sizeof (uri), "ipp://localhost/printers/%s", name);
for (i = 0; i < 2; i++) {
request = ippNewRequest (IPP_GET_PRINTER_ATTRIBUTES);
ippAddString (request, IPP_TAG_OPERATION, IPP_TAG_URI,
"printer-uri", NULL, uri);
+ debugprintf ("trying request with uri %s\n", uri);
answer = cupsDoRequest (self->http, request, "/");
if (answer && answer->request.status.status_code == IPP_NOT_POSSIBLE) {
ippDelete (answer);
+ if (uriobj)
+ break;
+
// Perhaps it's a class, not a printer.
snprintf (uri, sizeof (uri), "ipp://localhost/classes/%s", name);
} else break;
}
- free (name);
+ if (uriobj)
+ free (uri);
+
if (!answer || answer->request.status.status_code > IPP_OK_CONFLICT) {
set_ipp_error (answer ?
answer->request.status.status_code :
cupsLastError ());
if (answer)
ippDelete (answer);
+
+ debugprintf ("<- Connection_getPrinterAttributes() (error)\n");
return NULL;
}
@@ -2027,6 +2062,7 @@ Connection_getPrinterAttributes (Connect
size_t namelen = strlen (attr->name);
int is_list = attr->num_values > 1;
+ debugprintf ("Attribute: %s\n", attr->name);
// job-sheets-default is special, since it is always two values.
// Make it a tuple.
if (!strcmp (attr->name, "job-sheets-default") &&
@@ -2102,6 +2138,7 @@ Connection_getPrinterAttributes (Connect
break;
}
+ debugprintf ("<- Connection_getPrinterAttributes() = dict\n");
return ret;
}
@@ -3317,13 +3354,17 @@ PyMethodDef Connection_methods[] =
"@raise IPPError: IPP problem" },
{ "getPrinterAttributes",
- (PyCFunction) Connection_getPrinterAttributes, METH_VARARGS,
- "getPrinterAttributes(name) -> dict\n"
- "Fetch the attributes for a printer.\n\n"
+ (PyCFunction) Connection_getPrinterAttributes,
+ METH_VARARGS | METH_KEYWORDS,
+ "getPrinterAttributes() -> dict\n"
+ "Fetch the attributes for a printer, specified either by name or by \n"
+ "uri but not both.\n\n"
"@type name: string\n"
"@param name: queue name\n"
+ "@type uri: string\n"
+ "@param uri: queue URI\n"
"@return: a dict, indexed by attribute, of printer attributes\n"
- "for the printer 'name'.\n\n"
+ "for the specified printer.\n\n"
"Attributes:\n"
" - 'job-sheets-supported': list of strings\n"
" - 'job-sheets-default': tuple of strings (start, end)\n"
@@ -3332,7 +3373,7 @@ PyMethodDef Connection_methods[] =
" - 'printer-op-policy-supported': if present, list of strings\n"
" - 'printer-op-policy': if present, string\n\n"
"There are other attributes; the exact list of attributes returned \n"
- "will depend on the CUPS server.\n"
+ "will depend on the IPP server.\n"
"@raise IPPError: IPP problem"},
{ "addPrinterToClass",
diff -U0 pycups-1.9.31/ChangeLog.attributes-uri pycups-1.9.31/ChangeLog

View File

@ -1,21 +0,0 @@
diff -up pycups-1.9.31/cupsconnection.c.job-sheets pycups-1.9.31/cupsconnection.c
--- pycups-1.9.31/cupsconnection.c.job-sheets 2007-11-22 11:01:19.000000000 +0000
+++ pycups-1.9.31/cupsconnection.c 2007-11-22 13:27:43.000000000 +0000
@@ -2042,7 +2042,7 @@ Connection_getPrinterAttributes (Connect
startobj = PyObj_from_UTF8 (start);
endobj = PyObj_from_UTF8 (end);
PyDict_SetItemString (ret, "job-sheets-default",
- Py_BuildValue ("(ss)", startobj, endobj));
+ Py_BuildValue ("(OO)", startobj, endobj));
Py_DECREF (startobj);
Py_DECREF (endobj);
continue;
diff -U0 pycups-1.9.31/ChangeLog.job-sheets pycups-1.9.31/ChangeLog
--- pycups-1.9.31/ChangeLog.job-sheets 2007-11-22 11:04:25.000000000 +0000
+++ pycups-1.9.31/ChangeLog 2007-11-22 13:27:43.000000000 +0000
@@ -2,0 +3,5 @@
+ * cupsconnection.c (Connection_getPrinterAttributes): Fixed
+ job-sheets-default tuple.
+
+2007-11-22 Tim Waugh <twaugh@redhat.com>
+

View File

@ -1,2 +1,2 @@
febc7a53ef0fbedbef2d7d8e4b5c92f3 pycups-1.9.31.tar.bz2
300a038e623c4192a68b4a43cf9b5dd8 system-config-printer-0.7.78.tar.bz2
c88b387b233a0aca280c9d02c4e63a44 pycups-1.9.32.tar.bz2

View File

@ -1,4 +1,4 @@
%define pycups_version 1.9.31
%define pycups_version 1.9.32
Summary: A printer administration tool
Name: system-config-printer
@ -11,8 +11,6 @@ Source0: system-config-printer-%{version}.tar.bz2
Source1: pycups-%{pycups_version}.tar.bz2
Source2: system-config-printer.pam
Source3: system-config-printer.console
Patch0: pycups-job-sheets.patch
Patch1: pycups-attributes-uri.patch
Patch100: system-config-printer-0.7.x.patch
BuildRequires: cups-devel >= 1.2
@ -55,10 +53,6 @@ the configuration tool.
%prep
%setup -q -a 1
pushd pycups-%{pycups_version}
%patch0 -p1 -b .job-sheets
%patch1 -p1 -b .attributes-uri
popd
%patch100 -p1 -b .0.7.x
@ -131,6 +125,9 @@ rm -rf %buildroot
exit 0
%changelog
* Mon Dec 17 2007 Tim Waugh <twaugh@redhat.com>
- Updated pycups to 1.9.32.
* Tue Nov 27 2007 Tim Waugh <twaugh@redhat.com> 0.7.78-2
- pycups: Applied patch from SVN to allow fetching printer attributes by URI.
- Sync to SVN 1748.