diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2010-03-23 14:18:44 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2010-03-23 14:18:44 +0100 |
| commit | 37650a078f5504dfbc6622d2c06f4435a3302dd4 (patch) | |
| tree | 35d7df75535420cbe0712a5f7b7b66d61f5e44d1 /python/tar.cc | |
| parent | 2aa709e41d8896ef897863ea9181c409c4c87a8c (diff) | |
| parent | 3a08cfb10590d5cf5df1f45d94a424ef6a0f674b (diff) | |
| download | python-apt-37650a078f5504dfbc6622d2c06f4435a3302dd4.tar.gz | |
merged from lp:~mvo/python-apt/mvo
Diffstat (limited to 'python/tar.cc')
| -rw-r--r-- | python/tar.cc | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/python/tar.cc b/python/tar.cc index e5aaee6f..b994d4e7 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -4,10 +4,13 @@ /* ###################################################################### Tar Inteface + * THIS FILE IS COMPLETELY DEPRECATED, AND NOT USED ANYMORE IF BUILT * + * WITHOUT COMPATIBILITY. * ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ +#ifdef COMPAT_0_7 #include "generic.h" #include <apt-pkg/extracttar.h> @@ -72,8 +75,12 @@ bool ProcessTar::DoItem(Item &Itm,int &Fd) case Item::FIFO: Type = "FIFO"; break; + + default: + return false; } + if (PyObject_CallFunction(Function,"sssiiiiiii",Type,Itm.Name, Itm.LinkTarget,Itm.Mode,Itm.UID,Itm.GID,Itm.Size, Itm.MTime,Itm.Major,Itm.Minor) == 0) @@ -97,8 +104,7 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args) PyObject *Function; char *Comp; - if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, - &Function,&Comp) == 0) + if (PyArg_ParseTuple(Args,"OOs",&File, &Function,&Comp) == 0) return 0; if (PyCallable_Check(Function) == 0) @@ -109,7 +115,11 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args) { // Open the file and associate the tar - FileFd Fd(fileno(PyFile_AsFile(File)),false); + int fileno = PyObject_AsFileDescriptor(File); + if (fileno == -1) + return 0; + + FileFd Fd(fileno,false); ExtractTar Tar(Fd,0xFFFFFFFF,Comp); if (_error->PendingError() == true) return HandleErrors(); @@ -139,8 +149,7 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) char *Chunk; const char *Comp = "gzip"; - if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, - &Function,&Chunk) == 0) + if (PyArg_ParseTuple(Args,"OOs",&File,&Function,&Chunk) == 0) return 0; if (PyCallable_Check(Function) == 0) @@ -149,10 +158,13 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) return 0; } + int fileno = PyObject_AsFileDescriptor(File); + if (fileno == -1) + return 0; { // Open the file and associate the tar // Open the file and associate the .deb - FileFd Fd(fileno(PyFile_AsFile(File)),false); + FileFd Fd(fileno,false); debDebFile Deb(Fd); if (_error->PendingError() == true) return HandleErrors(); @@ -180,3 +192,4 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) return HandleErrors(Py_None); } /*}}}*/ +#endif // defined(COMPAT_0_7) |
