1 new commit in galaxy-central: https://bitbucket.org/galaxy/galaxy-central/commits/6e063ca1960f/ Changeset: 6e063ca1960f User: Dave Bouvier Date: 2013-10-04 18:53:50 Summary: Fix for the wrong extraction path with certain archives' internal structures. Affected #: 1 file diff -r e2839b5b365966a09b6ad9fd4140b0f067621e93 -r 6e063ca1960f9fd0539ad974f4e98520e31fc0a9 lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py --- a/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py +++ b/lib/tool_shed/galaxy_install/tool_dependencies/td_common_util.py @@ -20,7 +20,7 @@ self.file_type = 'tar' elif iszip( file_path ) and not isjar( file_path ): self.file_type = 'zip' - self.file_name = os.path.splitext( file_path )[ 0 ] + self.file_name = os.path.splitext( os.path.basename( file_path ) )[ 0 ] if self.file_name.endswith( '.tar' ): self.file_name = os.path.splitext( self.file_name )[ 0 ] self.type = self.file_type @@ -31,11 +31,6 @@ raise NameError( 'File type %s specified, no open method found.' % self.file_type ) def extract( self, path ): - full_path = self.extraction_path( path ) - self.archive.extractall( full_path ) - return full_path - - def extraction_path( self, path ): '''Determine the path to which the archive should be extracted.''' contents = self.getmembers() extraction_path = path @@ -43,6 +38,9 @@ # The archive contains a single file, return the extraction path. if self.isfile( contents[ 0 ] ): extraction_path = os.path.join( path, self.file_name ) + if not os.path.exists( extraction_path ): + os.makedirs( extraction_path ) + self.archive.extractall( extraction_path ) else: # Sort filenames within the archive by length, because if the shortest path entry in the archive is a directory, # and the next entry has the directory prepended, then everything following that entry must be within that directory. @@ -63,11 +61,17 @@ parent = self.getmember( parent_name ) first_child = filenames[ 1 ] if first_child.startswith( parent_name ) and parent is not None and self.isdir( parent ): - extraction_path = os.path.join( path, self.getname( parent ) ) + if self.getname( parent ) == self.file_name: + self.archive.extractall( os.path.join( path ) ) + extraction_path = os.path.join( path, self.file_name ) + else: + self.archive.extractall( os.path.join( path ) ) + extraction_path = os.path.join( path, self.getname( parent ) ) else: extraction_path = os.path.join( path, self.file_name ) - if not os.path.exists( extraction_path ): - os.makedirs( extraction_path ) + if not os.path.exists( extraction_path ): + os.makedirs( extraction_path ) + self.archive.extractall( os.path.join( extraction_path ) ) return os.path.abspath( extraction_path ) def getmembers_tar( self ): Repository URL: https://bitbucket.org/galaxy/galaxy-central/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email.