Example #1
0
    def test_unknown_progress(self):
        """We can instantiate an unknown progress"""
        def foo():
            yield
        inter = UnknownProgress(foo)
        inter.bar = "BarElement"

        self.assertEquals(inter.bar, "BarElement")
Example #2
0
    def test_unknown_progress(self):
        """We can instantiate an unknown progress"""
        def foo():
            yield

        inter = UnknownProgress(foo)
        inter.bar = "BarElement"

        self.assertEquals(inter.bar, "BarElement")
Example #3
0
    def decompress_and_install(self, fds):
        UI.display(DisplayMessage("Installing {}".format(self.name)))
        # empty destination directory if reinstall
        for dir_to_remove in self._paths_to_clean:
            with suppress(FileNotFoundError):
                shutil.rmtree(dir_to_remove)
            # marked them as cleaned
            self._paths_to_clean = []

        os.makedirs(self.install_path, exist_ok=True)
        decompress_fds = {}
        for fd in fds:
            direct_copy = False
            for ext in self.DIRECT_COPY_EXT:
                if fd.name.endswith(ext):
                    direct_copy = True
                    break
            if direct_copy:
                shutil.copy2(
                    fd.name,
                    os.path.join(self.install_path, os.path.basename(fd.name)))
            else:
                decompress_fds[fd] = Decompressor.DecompressOrder(
                    dir=self.dir_to_decompress_in_tarball,
                    dest=self.install_path)
        Decompressor(decompress_fds, self.decompress_and_install_done)
        UI.display(UnknownProgress(self.iterate_until_install_done))
Example #4
0
    def decompress_and_install(self, fd):
        UI.display(DisplayMessage("Installing {}".format(self.name)))
        # empty destination directory if reinstall
        for dir_to_remove in self._paths_to_clean:
            with suppress(FileNotFoundError):
                shutil.rmtree(dir_to_remove)

        Decompressor({fd: Decompressor.DecompressOrder(dir=self.dir_to_decompress_in_tarball, dest=self.install_path)},
                     self.decompress_and_install_done)
        UI.display(UnknownProgress(self.iterate_until_install_done))