def bead(self, timestamp): tmp = self.new_temp_dir() ws = Workspace(tmp / 'ws') ws.create('bead-uuid') bead_archive = tmp / 'bead.zip' ws.pack(bead_archive, timestamp, comment='bead for a shared box') return bead_archive
def bead(self, timestamp): tmp = self.new_temp_dir() ws = Workspace(tmp / 'ws') ws.create('a bead kind') bead_archive = tmp / 'bead.zip' ws.pack(bead_archive, timestamp, comment='bead for a shared box') return bead_archive
def hacked_bead(self, robot, beads): hacked_bead_path = self.new_temp_dir() / 'hacked_bead.zip' workspace_dir = self.new_temp_dir() / 'hacked_bead' ws = Workspace(workspace_dir) ws.create('hacked-kind') tech.fs.write_file(ws.directory / 'code', 'code') tech.fs.write_file(ws.directory / 'output/README', 'README') ws.pack(hacked_bead_path, TS1, comment='hacked bead') with zipfile.ZipFile(hacked_bead_path, 'a') as z: with warnings.catch_warnings(): warnings.simplefilter('ignore') # this would cause a warning from zipfile for duplicate # name in zip file (which is perfectly valid, though hacky) z.writestr(layouts.Archive.CODE / 'code', 'HACKED') z.writestr(layouts.Archive.DATA / 'README', 'HACKED') return hacked_bead_path