diff options
| author | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:22:27 +0100 |
|---|---|---|
| committer | Michael Vogt <michael.vogt@ubuntu.com> | 2009-01-13 17:22:27 +0100 |
| commit | 38d602dc83006c51dfe4ed594d691ea9b0679498 (patch) | |
| tree | b7aedfba82c44cad6c3012f879b5d6d7e8ad1425 /python/tar.cc | |
| parent | 12cf58d12b969010f3d98b2974d72bbb950b775f (diff) | |
| parent | 614897f798d9f16591fbd29ebe2a6c5674102d2d (diff) | |
| download | python-apt-38d602dc83006c51dfe4ed594d691ea9b0679498.tar.gz | |
* apt/*.py:
- Almost complete cleanup of the code
- Remove inconsistent use of tabs and spaces (Closes: #505443)
- Improved documentation
* apt/debfile.py:
- Drop get*() methods, as they are deprecated and were
never in a stable release
- Make DscSrcPackage working
* apt/gtk/widgets.py:
- Fix the code and document the signals
* Introduce new documentation build with Sphinx
- Contains style Guide (Closes: #481562)
- debian/rules: Build the documentation here
- setup.py: Remove pydoc building and add new docs.
- debian/examples: Include examples from documentation
- debian/python-apt.docs:
+ Change html/ to build/doc/html.
+ Add build/doc/text for the text-only documentation
* setup.py:
- Only create build/data when building, not all the time
- Remove build/mo and build/data on clean -a
* debian/control:
- Remove the Conflicts on python2.3-apt, python2.4-apt, as
they are only needed for oldstable (sarge)
- Build-Depend on python-sphinx (>= 0.5)
* aptsources/distinfo.py:
- Allow @ in mirror urls (Closes: #478171) (LP: #223097)
* Merge Ben Finney's whitespace changes (Closes: #481563)
* Merge Ben Finney's do not use has_key() (Closes: #481878)
* Do not use deprecated form of raise statement (Closes: #494259)
* Add support for PkgRecords.SHA256Hash (Closes: #456113)
Diffstat (limited to 'python/tar.cc')
| -rw-r--r-- | python/tar.cc | 50 |
1 files changed, 25 insertions, 25 deletions
diff --git a/python/tar.cc b/python/tar.cc index 61c9d708..e5aaee6f 100644 --- a/python/tar.cc +++ b/python/tar.cc @@ -4,7 +4,7 @@ /* ###################################################################### Tar Inteface - + ##################################################################### */ /*}}}*/ // Include Files /*{{{*/ @@ -23,9 +23,9 @@ class ProcessTar : public pkgDirStream public: PyObject *Function; - + virtual bool DoItem(Item &Itm,int &Fd); - + ProcessTar(PyObject *Function) : Function(Function) { Py_INCREF(Function); @@ -48,55 +48,55 @@ bool ProcessTar::DoItem(Item &Itm,int &Fd) case Item::File: Type = "FILE"; break; - + case Item::HardLink: Type = "HARDLINK"; break; - + case Item::SymbolicLink: Type = "SYMLINK"; break; - + case Item::CharDevice: Type = "CHARDEV"; break; - + case Item::BlockDevice: Type = "BLKDEV"; break; - + case Item::Directory: Type = "DIR"; break; - + case Item::FIFO: Type = "FIFO"; break; } - + 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) return false; - + Fd = -1; return true; } /*}}}*/ - + // tarExtract - Examine files from a tar /*{{{*/ // --------------------------------------------------------------------- /* */ char *doc_tarExtract = "tarExtract(File,Func,Comp) -> None\n" "The tar file referenced by the file object File, Func called for each\n" -"Tar member. Comp must be the string \"gzip\" (gzip is automatically invoked) \n"; +"Tar member. Comp must be the string \"gzip\" (gzip is automatically invoked) \n"; PyObject *tarExtract(PyObject *Self,PyObject *Args) { PyObject *File; PyObject *Function; char *Comp; - + if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, &Function,&Comp) == 0) return 0; @@ -106,19 +106,19 @@ PyObject *tarExtract(PyObject *Self,PyObject *Args) PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); return 0; } - + { // Open the file and associate the tar FileFd Fd(fileno(PyFile_AsFile(File)),false); ExtractTar Tar(Fd,0xFFFFFFFF,Comp); if (_error->PendingError() == true) return HandleErrors(); - + ProcessTar Proc(Function); if (Tar.Go(Proc) == false) return HandleErrors(); - } - + } + Py_INCREF(Py_None); return HandleErrors(Py_None); } @@ -138,11 +138,11 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) PyObject *Function; char *Chunk; const char *Comp = "gzip"; - + if (PyArg_ParseTuple(Args,"O!Os",&PyFile_Type,&File, &Function,&Chunk) == 0) return 0; - + if (PyCallable_Check(Function) == 0) { PyErr_SetString(PyExc_TypeError,"argument 2: expected something callable."); @@ -156,15 +156,15 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) debDebFile Deb(Fd); if (_error->PendingError() == true) return HandleErrors(); - - // Get the archive member and positition the file + + // Get the archive member and positition the file const ARArchive::Member *Member = Deb.GotoMember(Chunk); if (Member == 0) { _error->Error("Cannot find chunk %s",Chunk); return HandleErrors(); } - + // Extract it. if (strcmp(".bz2", &Chunk[strlen(Chunk)-4]) == 0) Comp = "bzip2"; @@ -174,8 +174,8 @@ PyObject *debExtract(PyObject *Self,PyObject *Args) ProcessTar Proc(Function); if (Tar.Go(Proc) == false) return HandleErrors(); - } - + } + Py_INCREF(Py_None); return HandleErrors(Py_None); } |
