mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix --clean-all
This commit is contained in:
parent
12072ac7d7
commit
ee3baf7dcf
@ -17,8 +17,8 @@ class GUI(Command):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_forms(cls):
|
def find_forms(cls):
|
||||||
from calibre.gui2 import find_forms
|
# We do not use the calibre function find_forms as
|
||||||
return find_forms(cls.SRC)
|
# mporting calibre.gui2 may not work
|
||||||
forms = []
|
forms = []
|
||||||
for root, _, files in os.walk(cls.PATH):
|
for root, _, files in os.walk(cls.PATH):
|
||||||
for name in files:
|
for name in files:
|
||||||
@ -29,8 +29,9 @@ class GUI(Command):
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def form_to_compiled_form(cls, form):
|
def form_to_compiled_form(cls, form):
|
||||||
from calibre.gui2 import form_to_compiled_form
|
# We do not use the calibre function form_to_compiled_form as
|
||||||
return form_to_compiled_form(form)
|
# importing calibre.gui2 may not work
|
||||||
|
return form.rpartition('.')[0]+'_ui.py'
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
self.build_forms()
|
self.build_forms()
|
||||||
|
@ -219,12 +219,17 @@ class Resources(Command):
|
|||||||
json.dump(function_dict, open(dest, 'wb'), indent=4)
|
json.dump(function_dict, open(dest, 'wb'), indent=4)
|
||||||
|
|
||||||
def clean(self):
|
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')
|
x = self.j(self.RESOURCES, x+'.pickle')
|
||||||
if os.path.exists(x):
|
if os.path.exists(x):
|
||||||
os.remove(x)
|
os.remove(x)
|
||||||
from setup.commands import kakasi
|
from setup.commands import kakasi
|
||||||
kakasi.clean()
|
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 @@ class Translations(POT): # {{{
|
|||||||
for x in (i, j, d):
|
for x in (i, j, d):
|
||||||
if os.path.exists(x):
|
if os.path.exists(x):
|
||||||
os.remove(x)
|
os.remove(x)
|
||||||
|
zf = self.DEST + '.zip'
|
||||||
|
if os.path.exists(zf):
|
||||||
|
os.remove(zf)
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class GetTranslations(Translations):
|
class GetTranslations(Translations):
|
||||||
@ -273,13 +277,14 @@ class GetTranslations(Translations):
|
|||||||
class ISO639(Command):
|
class ISO639(Command):
|
||||||
|
|
||||||
description = 'Compile translations for ISO 639 codes'
|
description = 'Compile translations for ISO 639 codes'
|
||||||
|
DEST = os.path.join(os.path.dirname(POT.SRC), 'resources', 'localization',
|
||||||
|
'iso639.pickle')
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
src = self.j(self.d(self.SRC), 'setup', 'iso639.xml')
|
src = self.j(self.d(self.SRC), 'setup', 'iso639.xml')
|
||||||
if not os.path.exists(src):
|
if not os.path.exists(src):
|
||||||
raise Exception(src + ' does not exist')
|
raise Exception(src + ' does not exist')
|
||||||
dest = self.j(self.d(self.SRC), 'resources', 'localization',
|
dest = self.DEST
|
||||||
'iso639.pickle')
|
|
||||||
if not self.newer(dest, src):
|
if not self.newer(dest, src):
|
||||||
self.info('Pickled code is up to date')
|
self.info('Pickled code is up to date')
|
||||||
return
|
return
|
||||||
@ -322,3 +327,8 @@ class ISO639(Command):
|
|||||||
'3to2':m3to2, '3bto3t':m3bto3t, 'name_map':nm}
|
'3to2':m3to2, '3bto3t':m3bto3t, 'name_map':nm}
|
||||||
dump(x, open(dest, 'wb'), -1)
|
dump(x, open(dest, 'wb'), -1)
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if os.path.exists(self.DEST):
|
||||||
|
os.remove(self.DEST)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user