[Apt-offline-devel] [SCM] Offline APT Package Manager branch, master, updated. 0.9.3-22-g24373bd

Ritesh Raj Sarraf rrs at researchut.com
Sat Oct 10 18:22:19 UTC 2009


The following commit has been merged in the master branch:
commit 48649ed677b179f943d5183d916e4e31581dd96a
Author: Ritesh Raj Sarraf <rrs at researchut.com>
Date:   Sat Oct 10 22:08:34 2009 +0530

    remove redundant code

diff --git a/AptOfflineLib.py b/AptOfflineLib.py
index 39db461..dfe8a51 100644
--- a/AptOfflineLib.py
+++ b/AptOfflineLib.py
@@ -364,10 +364,18 @@ class Archiver:
 
         def decompress_the_file( self, archive_file, path, target_file, archive_type ):
                 '''Extracts all the files from a single condensed archive file'''
-                if archive_type == "bzip2":
-                        try:
-                                read_from = bz2.BZ2File( archive_file, 'r' )
-                        except IOError:
+                if archive_type == "bzip2" or archive_type == "gzip":
+                        if archive_type == "bzip2":
+                                try:
+                                        read_from = bz2.BZ2File( archive_file, 'r' )
+                                except IOError:
+                                        return False
+                        elif archive_type == "gzip":
+                                try:
+                                        read_from = gzip.GzipFile( archive_file, 'r' )
+                                except IOError:
+                                        return False
+                        else:
                                 return False
                                     
                         try:
@@ -381,22 +389,6 @@ class Archiver:
                         write_to.close()
                         read_from.close()
                         return True
-                elif archive_type == "gzip":
-                        try:
-                                read_from = gzip.GzipFile( archive_file, 'r' )
-                        except IOError:
-                                return False
-                        try:
-                                write_to = open( os.path.join( path, target_file ), 'wb' )
-                        except IOError:
-                                return False
-                        
-                        if self.TarGzipBZ2_Uncompress( read_from, write_to ) != True:
-                                #FIXME:
-                                raise ArchiveError
-                        write_to.close()
-                        read_from.close()
-                        return True
                 elif archive_type == "zip":
                         # FIXME: This looks odd. Where are we writing to a file ???
                         try:

-- 
Offline APT Package Manager



More information about the Apt-offline-devel mailing list