mirror of
https://github.com/ankitects/anki.git
synced 2025-09-25 01:06:35 -04:00
speed up build_ui.sh
This commit is contained in:
parent
b9522487ad
commit
0d37223c88
1 changed files with 12 additions and 47 deletions
|
@ -1,6 +1,7 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# generate python files based on the designer ui files
|
||||
# generate python files based on the designer ui files. pyuic4 and pyrcc4
|
||||
# should be on the path.
|
||||
#
|
||||
|
||||
if [ ! -d "designer" ]
|
||||
|
@ -11,42 +12,6 @@ fi
|
|||
|
||||
mkdir -p aqt/forms
|
||||
|
||||
pyuic=`which pyuic4`
|
||||
pyrcc=`which pyrcc4`
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
if [ xDarwin = x$(uname) ]
|
||||
then
|
||||
if [ -e /Library/Frameworks/Python.framework/Versions/2.7/bin/pyuic4 ]
|
||||
then
|
||||
pyuic=/Library/Frameworks/Python.framework/Versions/2.7/bin/pyuic4
|
||||
pyrcc=/Library/Frameworks/Python.framework/Versions/2.7/bin/pyrcc4
|
||||
elif [ -e /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pyuic4 ]
|
||||
then
|
||||
pyuic=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pyuic4
|
||||
pyrcc=/opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/pyrcc4
|
||||
elif [ -e /System/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4 ]
|
||||
then
|
||||
pyuic=/System/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4
|
||||
pyrcc=/System/Library/Frameworks/Python.framework/Versions/2.6/bin/pyrcc4
|
||||
elif [ -e /Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4 ]
|
||||
then
|
||||
pyuic=/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4
|
||||
pyrcc=/Library/Frameworks/Python.framework/Versions/2.6/bin/pyrcc4
|
||||
elif [ -f /opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4 ]
|
||||
then
|
||||
pyuic=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pyuic4
|
||||
pyrcc=/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/pyrcc4
|
||||
else
|
||||
echo 'Unable to find pyuic4. If you use macports try `port install py-pyqt4`. If you use homebrew try `brew install pyqt`.'
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
echo "Unable to find pyuic4 on your path! Please install it and try this script again."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
init=aqt/forms/__init__.py
|
||||
temp=aqt/forms/scratch
|
||||
rm -f $init $temp
|
||||
|
@ -56,21 +21,21 @@ echo "__all__ = [" >> $init
|
|||
echo "Generating forms.."
|
||||
for i in designer/*.ui
|
||||
do
|
||||
base=$(echo $i | perl -pe 's/\.ui//; s%designer/%%;')
|
||||
py=$(echo $i | perl -pe 's/\.ui/.py/; s%designer%aqt/forms%;')
|
||||
echo " * "$py
|
||||
$pyuic $i -o $py
|
||||
base=$(basename -s.ui $i)
|
||||
py="aqt/forms/${base}.py"
|
||||
echo " \"$base\"," >> $init
|
||||
echo "import $base" >> $temp
|
||||
if [ $i -nt $py ]; then
|
||||
echo " * "$py
|
||||
pyuic4 $i -o $py
|
||||
# munge the output to use gettext
|
||||
perl -pi.bak -e 's/QtGui.QApplication.translate\(".*?", /_(/; s/, None, QtGui.*/))/' $py
|
||||
# remove the 'created' time, to avoid flooding the version control system
|
||||
perl -pi.bak -e 's/^# Created:.*$//' $py
|
||||
rm $py.bak
|
||||
fi
|
||||
done
|
||||
echo "]" >> $init
|
||||
cat $temp >> $init
|
||||
rm $temp
|
||||
|
||||
echo "Building resources.."
|
||||
$pyrcc designer/icons.qrc -o aqt/forms/icons_rc.py
|
||||
pyrcc4 designer/icons.qrc -o aqt/forms/icons_rc.py
|
||||
|
|
Loading…
Reference in a new issue