예제 #1
0
 def create_aarfile(self, location, name, filenames=None):
   """Create an aar file, using the contents created by self.unpacked_aar_library."""
   with temporary_dir() as temp:
     aar_contents = self.unpacked_aar_library(temp, filenames=filenames)
     archive = ZIP.create(aar_contents, location, name)
     aar = os.path.join(location, '{}.aar'.format(name))
     os.rename(archive, aar)
     return aar
예제 #2
0
 def create_aarfile(self, location, name, filenames=None):
   """Create an aar file, using the contents created by self.unpacked_aar_library."""
   with temporary_dir() as temp:
     aar_contents = self.unpacked_aar_library(temp, filenames=filenames)
     archive = ZIP.create(aar_contents, location, name)
     aar = os.path.join(location, '{}.aar'.format(name))
     os.rename(archive, aar)
     return aar
예제 #3
0
  def test_zip_filter(self):
    def do_filter(path):
      return path == 'allowed.txt'

    with temporary_dir() as fromdir:
      touch(os.path.join(fromdir, 'allowed.txt'))
      touch(os.path.join(fromdir, 'disallowed.txt'))

      with temporary_dir() as archivedir:
        archive = ZIP.create(fromdir, archivedir, 'archive')
        with temporary_dir() as todir:
          ZIP.extract(archive, todir, filter_func=do_filter)
          self.assertEquals(set(['allowed.txt']), self._listtree(todir, empty_dirs=False))
예제 #4
0
  def test_zip_filter(self):
    def do_filter(path):
      return path == 'allowed.txt'

    with temporary_dir() as fromdir:
      touch(os.path.join(fromdir, 'allowed.txt'))
      touch(os.path.join(fromdir, 'disallowed.txt'))

      with temporary_dir() as archivedir:
        archive = ZIP.create(fromdir, archivedir, 'archive')
        with temporary_dir() as todir:
          ZIP.extract(archive, todir, filter=do_filter)
          self.assertEquals(set(['allowed.txt']), self._listtree(todir, empty_dirs=False))