diff --git a/setup/gui.py b/setup/gui.py index 058a3f052f..912760ddf8 100644 --- a/setup/gui.py +++ b/setup/gui.py @@ -17,8 +17,8 @@ class GUI(Command): @classmethod def find_forms(cls): - from calibre.gui2 import find_forms - return find_forms(cls.SRC) + # We do not use the calibre function find_forms as + # mporting calibre.gui2 may not work forms = [] for root, _, files in os.walk(cls.PATH): for name in files: @@ -29,8 +29,9 @@ class GUI(Command): @classmethod def form_to_compiled_form(cls, form): - from calibre.gui2 import form_to_compiled_form - return form_to_compiled_form(form) + # We do not use the calibre function form_to_compiled_form as + # importing calibre.gui2 may not work + return form.rpartition('.')[0]+'_ui.py' def run(self, opts): self.build_forms() diff --git a/setup/resources.py b/setup/resources.py index 41068f78a0..ee72a98cb6 100644 --- a/setup/resources.py +++ b/setup/resources.py @@ -219,12 +219,17 @@ class Resources(Command): json.dump(function_dict, open(dest, 'wb'), indent=4) def clean(self): - for x in ('scripts', 'recipes', 'ebook-convert-complete'): + for x in ('scripts', 'ebook-convert-complete'): x = self.j(self.RESOURCES, x+'.pickle') if os.path.exists(x): os.remove(x) from setup.commands import kakasi kakasi.clean() + for x in ('builtin_recipes.xml', 'builtin_recipes.zip', + 'template-functions.json'): + x = self.j(self.RESOURCES, x) + if os.path.exists(x): + os.remove(x) diff --git a/setup/translations.py b/setup/translations.py index 2e8e6d52f3..3523272770 100644 --- a/setup/translations.py +++ b/setup/translations.py @@ -206,6 +206,10 @@ class Translations(POT): # {{{ for x in (i, j, d): if os.path.exists(x): os.remove(x) + zf = self.DEST + '.zip' + if os.path.exists(zf): + os.remove(zf) + # }}} class GetTranslations(Translations): @@ -273,13 +277,14 @@ class GetTranslations(Translations): class ISO639(Command): description = 'Compile translations for ISO 639 codes' + DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization', + 'iso639.pickle') def run(self, opts): src = self.j(self.d(self.SRC), 'setup', 'iso639.xml') if not os.path.exists(src): raise Exception(src + ' does not exist') - dest = self.j(self.d(self.SRC), 'resources', 'localization', - 'iso639.pickle') + dest = self.DEST if not self.newer(dest, src): self.info('Pickled code is up to date') return @@ -322,3 +327,8 @@ class ISO639(Command): '3to2':m3to2, '3bto3t':m3bto3t, 'name_map':nm} dump(x, open(dest, 'wb'), -1) + def clean(self): + if os.path.exists(self.DEST): + os.remove(self.DEST) + +