Allow the first file in a bundle to be "mimetype", and ignore it if it's there

This commit is contained in:
Dan Winship 2007-10-01 11:48:46 -04:00
parent e81ed53d00
commit 53adb39e84

View File

@ -61,6 +61,9 @@ class Bundle:
if len(file_names) == 0: if len(file_names) == 0:
raise MalformedBundleException('Empty zip file') raise MalformedBundleException('Empty zip file')
if file_names[0] == 'mimetype':
del file_names[0]
self._zip_root_dir = file_names[0].split('/')[0] self._zip_root_dir = file_names[0].split('/')[0]
if self._unzipped_extension is not None: if self._unzipped_extension is not None:
(name, ext) = os.path.splitext(self._zip_root_dir) (name, ext) = os.path.splitext(self._zip_root_dir)
@ -113,7 +116,7 @@ class Bundle:
# features, etc makes it impractical. # features, etc makes it impractical.
# FIXME: use manifest # FIXME: use manifest
if os.spawnlp(os.P_WAIT, 'unzip', 'unzip', self._path, if os.spawnlp(os.P_WAIT, 'unzip', 'unzip', self._path,
'-d', install_dir): '-x', 'mimetype', '-d', install_dir):
raise ZipExtractException raise ZipExtractException
def _zip(self, bundle_path): def _zip(self, bundle_path):