def run_task(self, fw_spec): ignore_errors = self.get("ignore_errors", False) dest = self.get("dest", os.getcwd()) compression = self.get("compression", "gz") try: compress_dir(dest, compression=compression) except: if not ignore_errors: raise ValueError("There was an error performing compression {} in {}.".format(compression, dest))
def run_task(self, fw_spec): ignore_errors = self.get('ignore_errors', False) dest = self.get("dest", os.getcwd()) compression = self.get("compression", "gz") try: compress_dir(dest, compression=compression) except Exception: if not ignore_errors: raise ValueError("There was an error performing compression {} in {}.".format( compression, dest))
def test_recursive_copy_and_compress(self): copy_r(os.path.join(test_dir, "cpr_src"), os.path.join(test_dir, "cpr_dst")) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_dst", "test"))) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_dst", "sub", "testr"))) compress_dir(os.path.join(test_dir, "cpr_src")) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_src", "test.gz"))) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_src", "sub", "testr.gz"))) decompress_dir(os.path.join(test_dir, "cpr_src")) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_src", "test"))) self.assertTrue(os.path.exists(os.path.join(test_dir, "cpr_src", "sub", "testr"))) with open(os.path.join(test_dir, "cpr_src", "test")) as f: txt = f.read() self.assertEqual(txt, "what")
def test_recursive_copy_and_compress(self): copy_r(os.path.join(test_dir, "cpr_src"), os.path.join(test_dir, "cpr_dst")) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_dst", "test"))) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_dst", "sub", "testr"))) compress_dir(os.path.join(test_dir, "cpr_src")) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_src", "test.gz"))) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_src", "sub", "testr.gz"))) decompress_dir(os.path.join(test_dir, "cpr_src")) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_src", "test"))) self.assertTrue( os.path.exists(os.path.join(test_dir, "cpr_src", "sub", "testr"))) with open(os.path.join(test_dir, "cpr_src", "test")) as f: txt = f.read() self.assertEqual(txt, "what")
def run_task(self, fw_spec): compress_dir(".", compression=self["compression"])
def run_task(self, fw_spec): pth = self.get("dest", os.getcwd()) compress_dir(pth, compression=self["compression"])
def run_task(self, fw_spec): compress_dir(".", compression=self["compression"])