mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
be quiter when switching branches
This commit is contained in:
parent
030a7c6320
commit
efbd02bb2e
@ -33,7 +33,7 @@ if flags == '1': # A branch checkout
|
|||||||
shutil.rmtree(extdir)
|
shutil.rmtree(extdir)
|
||||||
subprocess.check_call(['python', 'setup.py', 'build', '--only', ext])
|
subprocess.check_call(['python', 'setup.py', 'build', '--only', ext])
|
||||||
|
|
||||||
subprocess.check_call(['python', 'setup.py', 'gui'])
|
subprocess.check_call(['python', 'setup.py', 'gui', '--summary'])
|
||||||
|
|
||||||
# Remove .pyc files as some of them might have been orphaned
|
# Remove .pyc files as some of them might have been orphaned
|
||||||
for dirpath, dirnames, filenames in os.walk('.'):
|
for dirpath, dirnames, filenames in os.walk('.'):
|
||||||
|
11
setup/gui.py
11
setup/gui.py
@ -15,6 +15,10 @@ class GUI(Command):
|
|||||||
PATH = os.path.join(Command.SRC, __appname__, 'gui2')
|
PATH = os.path.join(Command.SRC, __appname__, 'gui2')
|
||||||
QRC = os.path.join(Command.RESOURCES, 'images.qrc')
|
QRC = os.path.join(Command.RESOURCES, 'images.qrc')
|
||||||
|
|
||||||
|
def add_options(self, parser):
|
||||||
|
parser.add_option('--summary', default=False, action='store_true',
|
||||||
|
help='Only display a summary about how many files were compiled')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def find_forms(cls):
|
def find_forms(cls):
|
||||||
# We do not use the calibre function find_forms as
|
# We do not use the calibre function find_forms as
|
||||||
@ -34,7 +38,7 @@ class GUI(Command):
|
|||||||
return form.rpartition('.')[0]+'_ui.py'
|
return form.rpartition('.')[0]+'_ui.py'
|
||||||
|
|
||||||
def run(self, opts):
|
def run(self, opts):
|
||||||
self.build_forms()
|
self.build_forms(summary=opts.summary)
|
||||||
self.build_images()
|
self.build_images()
|
||||||
|
|
||||||
def build_images(self):
|
def build_images(self):
|
||||||
@ -55,10 +59,9 @@ class GUI(Command):
|
|||||||
finally:
|
finally:
|
||||||
os.chdir(cwd)
|
os.chdir(cwd)
|
||||||
|
|
||||||
|
def build_forms(self, summary=False):
|
||||||
def build_forms(self):
|
|
||||||
from calibre.gui2 import build_forms
|
from calibre.gui2 import build_forms
|
||||||
build_forms(self.SRC, info=self.info)
|
build_forms(self.SRC, info=self.info, summary=summary)
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
forms = self.find_forms()
|
forms = self.find_forms()
|
||||||
|
@ -1119,7 +1119,7 @@ def find_forms(srcdir):
|
|||||||
def form_to_compiled_form(form):
|
def form_to_compiled_form(form):
|
||||||
return form.rpartition('.')[0]+'_ui.py'
|
return form.rpartition('.')[0]+'_ui.py'
|
||||||
|
|
||||||
def build_forms(srcdir, info=None):
|
def build_forms(srcdir, info=None, summary=False):
|
||||||
import re, cStringIO
|
import re, cStringIO
|
||||||
from PyQt4.uic import compileUi
|
from PyQt4.uic import compileUi
|
||||||
forms = find_forms(srcdir)
|
forms = find_forms(srcdir)
|
||||||
@ -1131,9 +1131,11 @@ def build_forms(srcdir, info=None):
|
|||||||
ans = 'I(%s%s%s)'%(match.group(1), match.group(2), match.group(1))
|
ans = 'I(%s%s%s)'%(match.group(1), match.group(2), match.group(1))
|
||||||
return ans
|
return ans
|
||||||
|
|
||||||
|
num = 0
|
||||||
for form in forms:
|
for form in forms:
|
||||||
compiled_form = form_to_compiled_form(form)
|
compiled_form = form_to_compiled_form(form)
|
||||||
if not os.path.exists(compiled_form) or os.stat(form).st_mtime > os.stat(compiled_form).st_mtime:
|
if not os.path.exists(compiled_form) or os.stat(form).st_mtime > os.stat(compiled_form).st_mtime:
|
||||||
|
if not summary:
|
||||||
info('\tCompiling form', form)
|
info('\tCompiling form', form)
|
||||||
buf = cStringIO.StringIO()
|
buf = cStringIO.StringIO()
|
||||||
compileUi(form, buf)
|
compileUi(form, buf)
|
||||||
@ -1149,6 +1151,9 @@ def build_forms(srcdir, info=None):
|
|||||||
'from PyQt4 import QtWebKit\nfrom PyQt4.QtWebKit import QWebView')
|
'from PyQt4 import QtWebKit\nfrom PyQt4.QtWebKit import QWebView')
|
||||||
|
|
||||||
open(compiled_form, 'wb').write(dat)
|
open(compiled_form, 'wb').write(dat)
|
||||||
|
num += 1
|
||||||
|
if num:
|
||||||
|
info('Compiled %d forms' % num)
|
||||||
|
|
||||||
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
_df = os.environ.get('CALIBRE_DEVELOP_FROM', None)
|
||||||
if _df and os.path.exists(_df):
|
if _df and os.path.exists(_df):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user