Can create a subdirectory for projects whose zip files do not have one.

This commit is contained in:
Jussi Pakkanen 2015-05-31 12:58:50 +03:00
parent b896af9c5f
commit 63d101674d
1 changed files with 12 additions and 2 deletions

14
wrap.py
View File

@ -132,8 +132,18 @@ class Resolver:
pass pass
except ImportError: except ImportError:
pass pass
if os.path.isdir(os.path.join(self.subdir_root, package.get('directory'))): target_dir = os.path.join(self.subdir_root, package.get('directory'))
if os.path.isdir(target_dir):
return return
shutil.unpack_archive(os.path.join(self.cachedir, package.get('source_filename')), self.subdir_root) extract_dir = self.subdir_root
# Some upstreams ship packages that do not have a leading directory.
# Create one for them.
try:
package.get('lead_directory_missing')
os.mkdir(target_dir)
extract_dir = target_dir
except KeyError:
pass
shutil.unpack_archive(os.path.join(self.cachedir, package.get('source_filename')), extract_dir)
if package.has_patch(): if package.has_patch():
shutil.unpack_archive(os.path.join(self.cachedir, package.get('patch_filename')), self.subdir_root) shutil.unpack_archive(os.path.join(self.cachedir, package.get('patch_filename')), self.subdir_root)