Merge branch 'bug-690872-copy_all_files'

This commit is contained in:
Piotr Zalewa 2011-10-18 16:54:40 +02:00
Родитель 0052e260fa 3fa7ede5e2
Коммит e678355cd8
2 изменённых файлов: 15 добавлений и 5 удалений

Просмотреть файл

@ -182,12 +182,24 @@ class Repackage(object):
response = xpi_utils.build(sdk_dir,
os.path.join(sdk_dir, 'packages', self.manifest['name']),
self.manifest['name'], hashtag, options=options)
log.debug("[%s] Done rebuilding XPI; cleaning up" % hashtag)
# clean up (sdk_dir is already removed)
self.cleanup()
# here find the created XPI and compare main dir list
# if not the same - copy the files from original XPI
target = os.path.join(settings.XPI_TARGETDIR, '%s.xpi' % hashtag)
target_zip = zipfile.ZipFile(target, 'a')
target_namelist = target_zip.namelist()
for f in self.xpi_zip.namelist():
if len(f.split('/')) == 1 and f not in target_namelist:
log.debug(f)
# export file from original xpi and pack file into target xpi
with tempfile.NamedTemporaryFile() as extr_file:
extr_file.write(self.xpi_zip.open(f).read())
target_zip.write(extr_file.name, f)
target_zip.close()
# clean up (sdk_dir is already removed)
log.debug("[%s] Done rebuilding XPI; cleaning up" % hashtag)
self.cleanup()
return response
def get_manifest(self, package_overrides={}):

Просмотреть файл

@ -81,8 +81,6 @@ class RepackageTest(TestCase):
xpi.close()
assert 'icon.png' in filenames
assert 'icon64.png' in filenames
raise SkipTest()
# I've got no idea how to copy icon16.png to main dir of the XPI
assert 'icon16.png' in filenames
def test_version_increment(self):