Removed no-longer-needed patches.

This commit is contained in:
Tim Waugh 2010-08-02 11:58:18 +01:00
parent 257b000ec6
commit 21f794c2a1
3 changed files with 0 additions and 231 deletions

View File

@ -1,198 +0,0 @@
diff -U0 pycups-1.9.49/ChangeLog.add-getJobs-requested-attrs pycups-1.9.49/ChangeLog
diff -up pycups-1.9.49/cupsconnection.c.add-getJobs-requested-attrs pycups-1.9.49/cupsconnection.c
--- pycups-1.9.49/cupsconnection.c.add-getJobs-requested-attrs 2010-02-24 15:07:28.000000000 +0000
+++ pycups-1.9.49/cupsconnection.c 2010-04-22 16:02:33.425457367 +0100
@@ -1382,6 +1382,52 @@ Connection_getDevices (Connection *self,
return result;
}
+static int
+get_requested_attrs (PyObject *requested_attrs, size_t *n_attrs, char ***attrs)
+{
+ int i;
+ size_t n;
+ char **as;
+
+ if (!PyList_Check (requested_attrs)) {
+ PyErr_SetString (PyExc_TypeError, "List required");
+ return -1;
+ }
+
+ n = PyList_Size (requested_attrs);
+ as = malloc ((n + 1) * sizeof (char *));
+ for (i = 0; i < n; i++) {
+ PyObject *val = PyList_GetItem (requested_attrs, i); // borrowed ref
+ if (!PyString_Check (val)) {
+ PyErr_SetString (PyExc_TypeError, "String required");
+ while (--i >= 0)
+ free (as[i]);
+ free (as);
+ return -1;
+ }
+
+ as[i] = strdup (PyString_AsString (val));
+ }
+ as[n] = NULL;
+
+ debugprintf ("Requested attributes:\n");
+ for (i = 0; as[i] != NULL; i++)
+ debugprintf (" %s\n", as[i]);
+
+ *n_attrs = n;
+ *attrs = as;
+ return 0;
+}
+
+static void
+free_requested_attrs (size_t n_attrs, char **attrs)
+{
+ int i;
+ for (i = 0; i < n_attrs; i++)
+ free (attrs[i]);
+ free (attrs);
+}
+
static PyObject *
Connection_getJobs (Connection *self, PyObject *args, PyObject *kwds)
{
@@ -1392,10 +1438,14 @@ Connection_getJobs (Connection *self, Py
int my_jobs = 0;
int limit = -1;
int first_job_id = -1;
+ PyObject *requested_attrs = NULL;
+ char **attrs = NULL; /* initialised to calm compiler */
+ size_t n_attrs = 0; /* initialised to calm compiler */
static char *kwlist[] = { "which_jobs", "my_jobs", "limit", "first_job_id",
- NULL };
- if (!PyArg_ParseTupleAndKeywords (args, kwds, "|siii", kwlist,
- &which, &my_jobs, &limit, &first_job_id))
+ "requested_attributes", NULL };
+ if (!PyArg_ParseTupleAndKeywords (args, kwds, "|siiiO", kwlist,
+ &which, &my_jobs, &limit, &first_job_id,
+ &requested_attrs))
return NULL;
debugprintf ("-> Connection_getJobs(%s,%d)\n",
@@ -1419,6 +1469,18 @@ Connection_getJobs (Connection *self, Py
ippAddInteger (request, IPP_TAG_OPERATION, IPP_TAG_INTEGER,
"first-job-id", first_job_id);
+ if (requested_attrs) {
+ if (get_requested_attrs (requested_attrs, &n_attrs, &attrs) == -1) {
+ ippDelete (request);
+ return NULL;
+ }
+
+ ippAddStrings (request, IPP_TAG_OPERATION, IPP_TAG_KEYWORD,
+ "requested-attributes", n_attrs, NULL,
+ (const char **) attrs);
+ free_requested_attrs (n_attrs, attrs);
+ }
+
debugprintf ("cupsDoRequest(\"/\")\n");
Connection_begin_allow_threads (self);
answer = cupsDoRequest (self->http, request, "/");
@@ -1474,6 +1536,18 @@ Connection_getJobs (Connection *self, Py
else if (!strcmp (attr->name, "job-preserved") &&
attr->value_tag == IPP_TAG_BOOLEAN)
val = PyBool_FromLong (attr->values[0].integer);
+ else {
+ if (attr->num_values > 1) {
+ int i;
+ val = PyList_New (0);
+ for (i = 0; i < attr->num_values; i++) {
+ PyObject *item = PyObject_from_attr_value (attr, i);
+ if (item)
+ PyList_Append (val, item);
+ }
+ } else
+ val = PyObject_from_attr_value (attr, 0);
+ }
if (val) {
debugprintf ("Adding %s to job dict\n", attr->name);
@@ -1500,52 +1574,6 @@ Connection_getJobs (Connection *self, Py
return result;
}
-static int
-get_requested_attrs (PyObject *requested_attrs, size_t *n_attrs, char ***attrs)
-{
- int i;
- size_t n;
- char **as;
-
- if (!PyList_Check (requested_attrs)) {
- PyErr_SetString (PyExc_TypeError, "List required");
- return -1;
- }
-
- n = PyList_Size (requested_attrs);
- as = malloc ((n + 1) * sizeof (char *));
- for (i = 0; i < n; i++) {
- PyObject *val = PyList_GetItem (requested_attrs, i); // borrowed ref
- if (!PyString_Check (val)) {
- PyErr_SetString (PyExc_TypeError, "String required");
- while (--i >= 0)
- free (as[i]);
- free (as);
- return -1;
- }
-
- as[i] = strdup (PyString_AsString (val));
- }
- as[n] = NULL;
-
- debugprintf ("Requested attributes:\n");
- for (i = 0; as[i] != NULL; i++)
- debugprintf (" %s\n", as[i]);
-
- *n_attrs = n;
- *attrs = as;
- return 0;
-}
-
-static void
-free_requested_attrs (size_t n_attrs, char **attrs)
-{
- int i;
- for (i = 0; i < n_attrs; i++)
- free (attrs[i]);
- free (attrs);
-}
-
static PyObject *
Connection_getJobAttributes (Connection *self, PyObject *args, PyObject *kwds)
{
@@ -4439,7 +4467,7 @@ PyMethodDef Connection_methods[] =
{ "getJobs",
(PyCFunction) Connection_getJobs, METH_VARARGS | METH_KEYWORDS,
- "getJobs(which_jobs='not-completed', my_jobs=False, limit=-1, first_job_id=-1) -> dict\n"
+ "getJobs(which_jobs='not-completed', my_jobs=False, limit=-1, first_job_id=-1, requested_attributes=None) -> dict\n"
"Fetch a list of jobs.\n"
"@type which_jobs: string\n"
"@param which_jobs: which jobs to fetch; possible values: \n"
@@ -4453,6 +4481,8 @@ PyMethodDef Connection_methods[] =
"@param limit: maximum number of jobs to return\n"
"@type first_job_id: integer\n"
"@param first_job_id: lowest job ID to return\n"
+ "@type requested_attributes: string list\n"
+ "@param requested_attributes: list of requested attribute names\n"
"@raise IPPError: IPP problem" },
{ "getJobAttributes",
diff -up pycups-1.9.49/NEWS.add-getJobs-requested-attrs pycups-1.9.49/NEWS
--- pycups-1.9.49/NEWS.add-getJobs-requested-attrs 2010-01-19 12:33:26.000000000 +0000
+++ pycups-1.9.49/NEWS 2010-04-22 16:01:37.816457416 +0100
@@ -1,6 +1,10 @@
NEWS
----
+New in 1.9.50:
+
+* cups.getJobs() now takes optional requested_attributes argument.
+
New in 1.9.48:
* cups.cancelJob()'s optional second argument is now a keyword.

View File

@ -1,21 +0,0 @@
diff -U0 pycups-1.9.47/ChangeLog.request-readio pycups-1.9.47/ChangeLog
diff -up pycups-1.9.47/cupsipp.c.request-readio pycups-1.9.47/cupsipp.c
--- pycups-1.9.47/cupsipp.c.request-readio 2009-08-18 11:56:03.000000000 +0100
+++ pycups-1.9.47/cupsipp.c 2010-01-06 15:54:37.978283521 +0000
@@ -1,6 +1,6 @@
/*
* cups - Python bindings for CUPS
- * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009 Red Hat, Inc.
+ * Copyright (C) 2002, 2005, 2006, 2007, 2008, 2009, 2010 Red Hat, Inc.
* Author: Tim Waugh <twaugh@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
@@ -421,7 +421,7 @@ IPPRequest_getAttributes (IPPRequest *se
if (!value) {
Py_DECREF (values);
values = NULL;
- break;
+ continue;
}
debugprintf ("\n");

View File

@ -1,12 +0,0 @@
diff -up pycups-1.9.49/Makefile.pycups-build pycups-1.9.49/Makefile
--- pycups-1.9.49/Makefile.pycups-build 2010-03-22 12:46:31.351447572 +0000
+++ pycups-1.9.49/Makefile 2010-03-22 12:46:41.155449391 +0000
@@ -31,7 +31,7 @@ dist:
install:
ROOT= ; \
if [ -n "$$DESTDIR" ]; then ROOT="--root $$DESTDIR"; fi; \
- python setup.py install $$ROOT
+ CFLAGS=-DVERSION=\\\"$(VERSION)\\\" python setup.py install $$ROOT
.PHONY: doc clean dist install