- Updated to 1.0.11.

- Updated pycups to 1.9.43.
This commit is contained in:
Tim Waugh 2008-11-21 17:36:31 +00:00
parent 3793d335b6
commit 22f986fefc
9 changed files with 11 additions and 77234 deletions

View File

@ -186,3 +186,5 @@ system-config-printer-1.0.8.tar.bz2
pysmbc-1.0.6.tar.bz2
system-config-printer-1.0.9.tar.bz2
system-config-printer-1.0.10.tar.bz2
system-config-printer-1.0.11.tar.bz2
pycups-1.9.43.tar.bz2

Binary file not shown.

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

Binary file not shown.

View File

@ -1,208 +0,0 @@
diff -U0 pycups-1.9.42/ChangeLog.git-master pycups-1.9.42/ChangeLog
--- pycups-1.9.42/ChangeLog.git-master 2008-08-29 09:56:45.000000000 +0100
+++ pycups-1.9.42/ChangeLog 2008-11-12 17:30:17.000000000 +0000
@@ -0,0 +1,12 @@
+2008-11-12 Tim Waugh <twaugh@redhat.com>
+
+ * cupsconnection.c (Connection): Store thread state in Connection
+ data.
+ (Connection_begin_allow_threads): Save current thread state.
+ (Connection_end_allow_threads): Restore current thread state.
+ (Connection_init): Use new functions.
+ (Connection_getPPDs): Likewise.
+ (Connection_getServerPPD): Likewise.
+ (Connection_getDocument): Likewise.
+ (Connection_getDevices): Likewise.
+
diff -up pycups-1.9.42/cupsconnection.c.git-master pycups-1.9.42/cupsconnection.c
--- pycups-1.9.42/cupsconnection.c.git-master 2008-08-29 09:56:45.000000000 +0100
+++ pycups-1.9.42/cupsconnection.c 2008-11-12 17:30:17.000000000 +0000
@@ -41,6 +41,7 @@ typedef struct
PyObject_HEAD
http_t *http;
char *host; /* for repr */
+ PyThreadState *tstate;
} Connection;
typedef struct
@@ -143,6 +144,7 @@ Connection_new (PyTypeObject *type, PyOb
if (self != NULL) {
self->http = NULL;
self->host = NULL;
+ self->tstate = NULL;
}
return (PyObject *) self;
@@ -167,10 +169,10 @@ Connection_init (Connection *self, PyObj
return -1;
}
- Py_BEGIN_ALLOW_THREADS;
+ Connection_begin_allow_threads (self);
debugprintf ("httpConnectEncrypt(...)\n");
self->http = httpConnectEncrypt (host, port, (http_encryption_t) encryption);
- Py_END_ALLOW_THREADS;
+ Connection_end_allow_threads (self);
if (!self->http) {
PyErr_SetString (PyExc_RuntimeError, "httpConnectionEncrypt failed");
@@ -201,6 +203,30 @@ Connection_repr (Connection *self)
self->host, self);
}
+void
+Connection_begin_allow_threads (void *connection)
+{
+ Connection *self = (Connection *) connection;
+ if (!self || !self->tstate)
+ return;
+
+ debugprintf ("begin allow threads\n");
+ g_current_connection = connection;
+ self->tstate = PyEval_SaveThread ();
+}
+
+void
+Connection_end_allow_threads (void *connection)
+{
+ Connection *self = (Connection *) connection;
+ if (!self || !self->tstate)
+ return;
+
+ debugprintf ("end allow threads\n");
+ PyEval_RestoreThread (self->tstate);
+ self->tstate = NULL;
+}
+
////////////////
// Connection // METHODS
////////////////
@@ -632,9 +658,9 @@ Connection_getPPDs (Connection *self)
debugprintf ("-> Connection_getPPDs()\n");
debugprintf ("cupsDoRequest(\"/\")\n");
- Py_BEGIN_ALLOW_THREADS;
+ Connection_begin_allow_threads (self);
answer = cupsDoRequest (self->http, request, "/");
- Py_END_ALLOW_THREADS;
+ Connection_end_allow_threads (self);
if (!answer || answer->request.status.status_code > IPP_OK_CONFLICT) {
set_ipp_error (answer ?
answer->request.status.status_code :
@@ -700,9 +726,9 @@ Connection_getServerPPD (Connection *sel
if (!PyArg_ParseTuple (args, "s", &ppd_name))
return NULL;
debugprintf ("-> Connection_getServerPPD()\n");
- Py_BEGIN_ALLOW_THREADS;
+ Connection_begin_allow_threads (self);
filename = cupsGetServerPPD (self->http, ppd_name);
- Py_END_ALLOW_THREADS;
+ Connection_end_allow_threads (self);
if (!filename) {
set_ipp_error (cupsLastError ());
debugprintf ("<- Connection_getServerPPD() (error)\n");
@@ -759,9 +785,9 @@ Connection_getDocument (Connection *self
return NULL;
}
- Py_BEGIN_ALLOW_THREADS;
+ Connection_begin_allow_threads (self);
answer = cupsDoIORequest (self->http, request, "/", -1, fd);
- Py_END_ALLOW_THREADS;
+ Connection_end_allow_threads (self);
close (fd);
if (!answer || answer->request.status.status_code > IPP_OK_CONFLICT) {
@@ -823,9 +849,9 @@ Connection_getDevices (Connection *self)
debugprintf ("-> Connection_getDevices()\n");
debugprintf ("cupsDoRequest(\"/\")\n");
- Py_BEGIN_ALLOW_THREADS;
+ Connection_begin_allow_threads (self);
answer = cupsDoRequest (self->http, request, "/");
- Py_END_ALLOW_THREADS;
+ Connection_end_allow_threads (self);
if (!answer || answer->request.status.status_code > IPP_OK_CONFLICT) {
set_ipp_error (answer ?
answer->request.status.status_code :
diff -up pycups-1.9.42/cupsconnection.h.git-master pycups-1.9.42/cupsconnection.h
--- pycups-1.9.42/cupsconnection.h.git-master 2008-07-05 18:19:02.000000000 +0100
+++ pycups-1.9.42/cupsconnection.h 2008-11-12 17:30:17.000000000 +0000
@@ -1,6 +1,6 @@
/*
* cups - Python bindings for CUPS
- * Copyright (C) 2002, 2005, 2006 Tim Waugh <twaugh@redhat.com>
+ * Copyright (C) 2002, 2005, 2006, 2008 Tim Waugh <twaugh@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -29,4 +29,6 @@ extern PyTypeObject cups_DestType;
extern PyObject *HTTPError;
extern PyObject *IPPError;
+void Connection_begin_allow_threads (void *connection);
+void Connection_end_allow_threads (void *connection);
#endif /* HAVE_CUPSCONNECTION_H */
diff -up pycups-1.9.42/cupsmodule.c.git-master pycups-1.9.42/cupsmodule.c
--- pycups-1.9.42/cupsmodule.c.git-master 2008-07-05 18:19:02.000000000 +0100
+++ pycups-1.9.42/cupsmodule.c 2008-11-12 17:30:17.000000000 +0000
@@ -30,6 +30,7 @@
#include "cupsppd.h"
static PyObject *cups_password_callback = NULL;
+void *g_current_connection = NULL;
//////////////////////
// Worker functions //
@@ -105,11 +106,17 @@ do_password_callback (const char *prompt
PyObject *result;
const char *pwval;
+ debugprintf ("-> do_password_callback\n");
+ Connection_end_allow_threads (g_current_connection);
args = Py_BuildValue ("(s)", prompt);
result = PyEval_CallObject (cups_password_callback, args);
Py_DECREF (args);
if (result == NULL)
+ {
+ debugprintf ("<- do_password_callback (empty string)\n");
+ Connection_begin_allow_threads (g_current_connection);
return "";
+ }
if (password) {
free (password);
@@ -120,8 +127,14 @@ do_password_callback (const char *prompt
password = strdup (pwval);
Py_DECREF (result);
if (!password)
+ {
+ debugprintf ("<- do_password_callback (empty string)\n");
+ Connection_begin_allow_threads (g_current_connection);
return "";
-
+ }
+
+ Connection_begin_allow_threads (g_current_connection);
+ debugprintf ("<- do_password_callback\n");
return password;
}
diff -up pycups-1.9.42/cupsmodule.h.git-master pycups-1.9.42/cupsmodule.h
--- pycups-1.9.42/cupsmodule.h.git-master 2008-07-05 18:19:02.000000000 +0100
+++ pycups-1.9.42/cupsmodule.h 2008-11-12 17:30:17.000000000 +0000
@@ -1,6 +1,6 @@
/*
* cups - Python bindings for CUPS
- * Copyright (C) 2006, 2007 Tim Waugh <twaugh@redhat.com>
+ * Copyright (C) 2006, 2007, 2008 Tim Waugh <twaugh@redhat.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -53,4 +53,6 @@ extern void debugprintf (const char *fmt
#error pycups requires CUPS 1.2.x
#endif
+extern void *g_current_connection;
+
#endif /* HAVE_CUPSMODULE_H */

View File

@ -1,3 +1,3 @@
030379d4accc18c402cd1ec367524a3b pycups-1.9.42.tar.bz2
ac8f98a40b0fc4b6ab4470f10489887a pysmbc-1.0.6.tar.bz2
50bb00e5cc0103bba5f00b08a679ad92 system-config-printer-1.0.10.tar.bz2
9e1557bb357c9f9c7b7bff4f12628d20 system-config-printer-1.0.11.tar.bz2
963b5b320c96ced475e3bc46c240e6d1 pycups-1.9.43.tar.bz2

Binary file not shown.

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
%define pycups_version 1.9.42
%define pycups_version 1.9.43
%define pysmbc_version 1.0.6
%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")}
%{!?python_sitearch: %define python_sitearch %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")}
@ -6,16 +6,14 @@
Summary: A printer administration tool
Name: system-config-printer
Version: 1.0.10
Release: 2%{?dist}
Version: 1.0.11
Release: 1%{?dist}
License: GPLv2+
URL: http://cyberelk.net/tim/software/system-config-printer/
Group: System Environment/Base
Source0: http://cyberelk.net/tim/data/system-config-printer/1.0.x/system-config-printer-%{version}.tar.bz2
Source1: http://cyberelk.net/tim/data/pycups/pycups-%{pycups_version}.tar.bz2
Source2: http://cyberelk.net/tim/data/pysmbc/pysmbc-%{pysmbc_version}.tar.bz2
Patch0: pycups-git-master.patch
Patch1: system-config-printer-git-1.0.x.patch
BuildRequires: cups-devel >= 1.2
BuildRequires: python-devel >= 2.4
@ -62,11 +60,6 @@ the configuration tool.
%prep
%setup -q -a 1 -a 2
%patch1 -p1 -b .git-1.0.x
pushd pycups-%{pycups_version}
%patch0 -p1 -b .git-master
popd
%build
%configure
@ -156,6 +149,10 @@ rm -rf %buildroot
exit 0
%changelog
* Fri Nov 21 2008 Tim Waugh <twaugh@redhat.com> 1.0.11-1
- Updated to 1.0.11.
- Updated pycups to 1.9.43.
* Wed Nov 12 2008 Tim Waugh <twaugh@redhat.com> 1.0.10-2
- Updated to 1.0.10. Applied patch from git.
- Applied pycups patch from git.