From a1558ff4b92b60b00c04696e675cc464bda9c643 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 15 Dec 2020 11:53:20 +0530 Subject: [PATCH] Dont re-download the liberation fonts if they are already present --- setup/liberation.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/setup/liberation.py b/setup/liberation.py index d3d6f175a7..797b05ceb6 100644 --- a/setup/liberation.py +++ b/setup/liberation.py @@ -21,7 +21,20 @@ class LiberationFonts(ReVendor): def vendored_dir(self): return self.j(self.RESOURCES, 'fonts', 'liberation') + @property + def version_file(self): + return self.j(self.vendored_dir, 'version.txt') + + def already_present(self): + if os.path.exists(self.version_file): + with open(self.version_file) as f: + return f.read() == self.VERSION + return False + def run(self, opts): + if not opts.system_liberation_fonts and self.already_present(): + self.info('Liberation Fonts already present in the resources directory, not downloading') + return self.clean() os.makedirs(self.vendored_dir) self.use_symlinks = opts.system_liberation_fonts @@ -33,3 +46,5 @@ class LiberationFonts(ReVendor): for x in font_files: self.add_file(x, os.path.basename(x)) + with open(self.j(self.vendored_dir, 'version.txt'), 'w') as f: + f.write(self.VERSION)