mirror of
git://xwords.git.sourceforge.net/gitroot/xwords/xwords
synced 2025-01-08 05:24:39 +01:00
Merge branch 'android_branch' into relay_noconn
Conflicts: xwords4/android/XWords4-dbg/AndroidManifest.xml xwords4/android/XWords4-dbg/res/layout/.gitignore xwords4/android/XWords4-dbg/src/org/eehouse/android/xw4dbg/.gitignore
This commit is contained in:
commit
265ac48b88
4 changed files with 93 additions and 56 deletions
|
@ -56,9 +56,9 @@
|
|||
<uses-feature android:name="android.hardware.nfc" android:required="false" />
|
||||
|
||||
<!-- GCM stuff -->
|
||||
<permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE"
|
||||
<permission android:name="org.eehouse.android.xw4dbg.permission.C2D_MESSAGE"
|
||||
android:protectionLevel="signature" />
|
||||
<uses-permission android:name="org.eehouse.android.xw4.permission.C2D_MESSAGE" />
|
||||
<uses-permission android:name="org.eehouse.android.xw4dbg.permission.C2D_MESSAGE" />
|
||||
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
|
||||
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
@ -252,7 +252,7 @@
|
|||
<intent-filter>
|
||||
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
|
||||
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
|
||||
<category android:name="org.eehouse.android.xw4" />
|
||||
<category android:name="org.eehouse.android.xw4dbg" />
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
|
||||
|
|
|
@ -3,35 +3,37 @@
|
|||
set -e -u
|
||||
|
||||
INDEX=0
|
||||
DRYRUN=''
|
||||
|
||||
usage() {
|
||||
echo "usage: $0 [--help] [-n <index>]"
|
||||
[ $# -gt 0 ] && echo "ERROR: $1"
|
||||
echo "usage: $0 [--dry-run] [--help] [-n <index>]"
|
||||
echo "uninstall crosswords from the <index>th device"
|
||||
exit 0
|
||||
}
|
||||
|
||||
if [ ! -e build.xml ]; then
|
||||
usage "No build.xml; please run me from the top android directory"
|
||||
fi
|
||||
while :; do
|
||||
WD=$(pwd)
|
||||
if [ -e ${WD}/AndroidManifest.xml ]; then
|
||||
break
|
||||
elif [ ${WD} = '/' ]; then
|
||||
usage "reached / without finding AndroidManifest.xml"
|
||||
else
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
|
||||
DIRNAME=$(basename $(pwd))
|
||||
case $DIRNAME in
|
||||
XWords4-bt)
|
||||
PKG=xw4bt
|
||||
;;
|
||||
XWords4-dbg)
|
||||
PKG=xw4dbg
|
||||
;;
|
||||
XWords4)
|
||||
PKG=xw4
|
||||
;;
|
||||
*)
|
||||
usage "running in unexpected directory $DIRNAME"
|
||||
;;
|
||||
esac
|
||||
PACK=$(grep 'package=\".*\..*\.*\"' ${WD}/AndroidManifest.xml | sed 's,^.*package="\(.*\)".*$,\1,')
|
||||
|
||||
if [ -z "${PACK}" ]; then
|
||||
usage "unable to find package in ${WD}/AndroidManifest.xml"
|
||||
fi
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
case $1 in
|
||||
--dry-run)
|
||||
DRYRUN=1
|
||||
;;
|
||||
-n)
|
||||
shift
|
||||
INDEX=$1
|
||||
|
@ -44,4 +46,5 @@ done
|
|||
|
||||
SERIAL="$(adb devices | grep 'device$' | sed -n "$((1+INDEX)) p" | awk '{print $1}')"
|
||||
|
||||
adb -s $SERIAL uninstall org.eehouse.android.${PKG}
|
||||
echo "adb -s $SERIAL uninstall $PACK"
|
||||
[ -z "$DRYRUN" ] && adb -s $SERIAL uninstall $PACK
|
||||
|
|
|
@ -4,6 +4,7 @@ import re, sys, os, getopt
|
|||
from lxml import etree
|
||||
|
||||
g_formats = {}
|
||||
g_verbose = 0
|
||||
|
||||
def usage(msg=''):
|
||||
print
|
||||
|
@ -20,8 +21,6 @@ def associate( formats, name, fmt ):
|
|||
else:
|
||||
forName = set()
|
||||
formats[name] = forName
|
||||
if fmt in forName:
|
||||
print "Warning: %s duplicated in %s" % (fmt, name)
|
||||
forName.add(fmt)
|
||||
# print 'added', fmt, 'to', name
|
||||
|
||||
|
@ -40,39 +39,64 @@ def checkFormats( formats ):
|
|||
if not foundDigit:
|
||||
break
|
||||
if curSet == testSet:
|
||||
print name, "is ok"
|
||||
if 0 < g_verbose: print name, "is ok"
|
||||
else:
|
||||
print 'ERROR: sets different for', name, curSet, testSet
|
||||
print 'WARNING: sets different for', name, curSet, testSet
|
||||
|
||||
def checkLangFormats( engData, langData, lang ):
|
||||
for key in langData:
|
||||
if not key in engData:
|
||||
print 'WARNING: key', key, 'in', lang, 'but not in English'
|
||||
elif not engData[key] == langData[key]:
|
||||
print 'ERROR: set mismatch', key, 'from', lang, engData[key], 'vs', langData[key]
|
||||
sys.exit(1)
|
||||
|
||||
def getForElem( data, pat, elem, name ):
|
||||
splits = re.split( pat, elem.text )
|
||||
nParts = len(splits)
|
||||
if 1 < nParts:
|
||||
for ii in range(nParts):
|
||||
part = splits[ii]
|
||||
if re.match( pat, part ):
|
||||
associate( data, name, part )
|
||||
|
||||
def getFormats( doc, pat, lang ):
|
||||
result = {}
|
||||
for elem in doc.findall('string'):
|
||||
getForElem( result, pat, elem, elem.get('name') )
|
||||
for elem in doc.findall('plurals'):
|
||||
name = elem.get('name')
|
||||
for elem in elem.findall('item'):
|
||||
quantity = elem.get('quantity')
|
||||
if not elem.text or 0 == len(elem.text):
|
||||
print 'plurals', name, 'has empty quantity', quantity, \
|
||||
'in file', lang
|
||||
sys.exit(1)
|
||||
else:
|
||||
getForElem( result, pat, elem, name + '/' + quantity )
|
||||
return result
|
||||
|
||||
def main():
|
||||
if 1 < len(sys.argv): usage()
|
||||
parser = etree.XMLParser(remove_blank_text=True, encoding="utf-8")
|
||||
|
||||
wd = os.path.dirname(sys.argv[0])
|
||||
path = wd + '/../XWords4/res/values/strings.xml'
|
||||
|
||||
# Load English
|
||||
engFormats = {}
|
||||
parser = etree.XMLParser(remove_blank_text=True, encoding="utf-8")
|
||||
path = wd + '/../XWords4/res/values/strings.xml'
|
||||
doc = etree.parse(path, parser)
|
||||
pat = re.compile( '(%\d\$[sd])', re.DOTALL | re.MULTILINE )
|
||||
for typ in ['string', 'item']:
|
||||
for elem in doc.findall(typ):
|
||||
splits = re.split( pat, elem.text )
|
||||
nParts = len(splits)
|
||||
if 1 < nParts:
|
||||
for ii in range(nParts):
|
||||
part = splits[ii]
|
||||
if re.match( pat, part ):
|
||||
associate( engFormats, elem.get('name'), part )
|
||||
engFormats = getFormats( doc, pat, 'en' )
|
||||
checkFormats( engFormats )
|
||||
|
||||
path = wd + '/../XWords4/res_src'
|
||||
for subdir, dirs, files in os.walk(path):
|
||||
for file in [file for file in files if file == "strings.xml" \
|
||||
and not subdir.endswith('/values')]:
|
||||
print file, subdir
|
||||
|
||||
|
||||
doc = etree.parse( subdir + '/' + file, parser )
|
||||
forLang = getFormats( doc, pat, subdir )
|
||||
checkLangFormats( engFormats, forLang, subdir )
|
||||
sys.exit(0)
|
||||
|
||||
##############################################################################
|
||||
if __name__ == '__main__':
|
||||
|
|
|
@ -2,25 +2,21 @@
|
|||
|
||||
set -u -e
|
||||
|
||||
DIRS=""
|
||||
VARIANT=""
|
||||
DIR=""
|
||||
|
||||
usage() {
|
||||
[ $# -ge 1 ] && echo "ERROR: $1"
|
||||
echo "usage: $0 [--dest-dir <dir>]*"
|
||||
echo "usage: $0 [--dir <dir>]"
|
||||
echo " uses variant parent of CWD as default if not provided"
|
||||
exit 1
|
||||
}
|
||||
|
||||
while [ $# -ge 1 ]; do
|
||||
echo "\"$1\""
|
||||
case $1 in
|
||||
--variant-name)
|
||||
--dir)
|
||||
shift
|
||||
VARIANT=$1
|
||||
;;
|
||||
--dest-dir)
|
||||
shift
|
||||
DIRS="$DIRS $1"
|
||||
DIR="$DIR $1"
|
||||
;;
|
||||
*)
|
||||
usage "unexpected param $1"
|
||||
|
@ -29,12 +25,26 @@ while [ $# -ge 1 ]; do
|
|||
shift
|
||||
done
|
||||
|
||||
for DIR in $DIRS; do
|
||||
for FILE in $(find $DIR -type f); do
|
||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||
echo "skipping $FILE; it's under version control within this variant"
|
||||
if [ -z "$DIR" ]; then
|
||||
while :; do
|
||||
WD=$(pwd)
|
||||
if [ "/" = "$WD" ]; then
|
||||
echo "reached / without finding AndroidManifest.xml"
|
||||
exit 1
|
||||
elif [ -e ${WD}/AndroidManifest.xml ]; then
|
||||
DIR=$WD
|
||||
break
|
||||
else
|
||||
rm $FILE
|
||||
cd ..
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
for FILE in $(find $DIR -type f); do
|
||||
if git ls-files $FILE --error-unmatch 2>/dev/null; then
|
||||
echo "skipping $FILE; it's under version control within this variant"
|
||||
else
|
||||
echo "removing $FILE"
|
||||
rm $FILE
|
||||
fi
|
||||
done
|
||||
|
|
Loading…
Reference in a new issue