How to use the ratarmount.SQLiteIndexedTar._openCompressedFile function in ratarmount

To help you get started, we’ve selected a few ratarmount examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mxmlnkn / ratarmount / ratarmount.py View on Github external
self.parentFolderCache = []
        self.mountRecursively = recursive
        self.sqlConnection = None

        assert tarFileName or fileObject
        if not tarFileName:
            self.tarFileName = ''
            self.createIndex( fileObject )
            # return here because we can't find a save location without any identifying name
            return

        self.tarFileName = os.path.abspath( tarFileName )
        if not fileObject:
            fileObject = open( self.tarFileName, 'rb' )
        self.tarFileObject, self.rawFileObject, self.compression = \
            SQLiteIndexedTar._openCompressedFile( fileObject, gzipSeekPointSpacing )

        # will be used for storing indexes if current path is read-only
        possibleIndexFilePaths = [
            self.tarFileName + ".index.sqlite",
            os.path.expanduser( os.path.join( "~", ".ratarmount",
                                              self.tarFileName.replace( "/", "_" ) + ".index.sqlite" ) )
        ]

        self.indexFileName = None
        if clearIndexCache:
            for indexPath in possibleIndexFilePaths:
                if os.path.isfile( indexPath ):
                    os.remove( indexPath )

        # Try to find an already existing index
        for indexPath in possibleIndexFilePaths: