mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-01-06 20:27:00 +01:00
Fix --clean-all
This commit is contained in:
parent
12072ac7d7
commit
ee3baf7dcf
3 changed files with 23 additions and 7 deletions
|
|
@ -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 @@ def find_forms(cls):
|
|||
|
||||
@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()
|
||||
|
|
|
|||
|
|
@ -219,12 +219,17 @@ def run(self, opts):
|
|||
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)
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -206,6 +206,10 @@ def clean(self):
|
|||
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 @@ def check_for_errors(cls):
|
|||
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 @@ def run(self, opts):
|
|||
'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)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue