mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Rebuild progress_indicator when switching to/from qt5
This commit is contained in:
parent
463f245078
commit
030a7c6320
@ -6,13 +6,15 @@ from __future__ import (unicode_literals, division, absolute_import,
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
__copyright__ = '2013, Kovid Goyal <kovid at kovidgoyal.net>'
|
||||||
|
|
||||||
import os, subprocess, sys
|
import os, subprocess, sys, shutil
|
||||||
|
|
||||||
prev_rev, current_rev, flags = [x.decode('utf-8') if isinstance(x, bytes) else x for x in sys.argv[1:]]
|
prev_rev, current_rev, flags = [x.decode('utf-8') if isinstance(x, bytes) else x for x in sys.argv[1:]]
|
||||||
def get_branch_name(rev):
|
def get_branch_name(rev):
|
||||||
return subprocess.check_output(['git', 'name-rev', '--name-only', rev]).decode('utf-8').strip()
|
return subprocess.check_output(['git', 'name-rev', '--name-only', rev]).decode('utf-8').strip()
|
||||||
|
|
||||||
if flags == '1': # A branch checkout
|
if flags == '1': # A branch checkout
|
||||||
|
base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||||
|
os.chdir(base)
|
||||||
|
|
||||||
prev_branch, cur_branch = map(get_branch_name, (prev_rev, current_rev))
|
prev_branch, cur_branch = map(get_branch_name, (prev_rev, current_rev))
|
||||||
is_qt5_transition = 'qt5' in (prev_branch, cur_branch)
|
is_qt5_transition = 'qt5' in (prev_branch, cur_branch)
|
||||||
@ -24,8 +26,13 @@ if flags == '1': # A branch checkout
|
|||||||
if f.endswith('_ui.py'):
|
if f.endswith('_ui.py'):
|
||||||
os.remove(os.path.join(dirpath, f))
|
os.remove(os.path.join(dirpath, f))
|
||||||
|
|
||||||
base = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
# Rebuild PyQt extensions
|
||||||
os.chdir(base)
|
for ext in ('progress_indicator',):
|
||||||
|
extdir = os.path.join('build', 'pyqt', ext)
|
||||||
|
if os.path.exists(extdir):
|
||||||
|
shutil.rmtree(extdir)
|
||||||
|
subprocess.check_call(['python', 'setup.py', 'build', '--only', ext])
|
||||||
|
|
||||||
subprocess.check_call(['python', 'setup.py', 'gui'])
|
subprocess.check_call(['python', 'setup.py', 'gui'])
|
||||||
|
|
||||||
# Remove .pyc files as some of them might have been orphaned
|
# Remove .pyc files as some of them might have been orphaned
|
||||||
|
Loading…
x
Reference in New Issue
Block a user