Skip to content

Commit 1496230

Browse files
committed
culebra: added more auto-regexps
- Version 5.4.0 - Added auto-regexps help - Added auto-regexps all
1 parent bb7700a commit 1496230

2 files changed

Lines changed: 29 additions & 5 deletions

File tree

AndroidViewClient/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from setuptools import setup, find_packages
44

55
setup(name='androidviewclient',
6-
version='5.3.2',
6+
version='5.4.0',
77
description='''AndroidViewClient is a 100% pure python tool that
88
simplifies test script creation providing higher level operations and the ability of
99
obtaining the tree of Views present at any given moment on the device or emulator screen.

AndroidViewClient/tools/culebra

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ ___________________/ /__/ /__/ /__/ /________________________________
1919
2020
'''
2121

22-
__version__ = '5.3.2'
22+
__version__ = '5.4.0'
2323

2424
import re
2525
import sys
@@ -28,6 +28,7 @@ import getopt
2828
import warnings
2929
import subprocess
3030
import codecs
31+
import calendar
3132
from datetime import date
3233

3334
try:
@@ -94,7 +95,25 @@ OPTS_HELP = {
9495
'p': 'append environment variables values to sys.path'
9596
}
9697

97-
AUTO_REGEXPS_RES = {'clock': re.compile('[012]\d:[0-5]\d')}
98+
def fillAutoRegexpsRes():
99+
are = {}
100+
are['clock'] = re.compile('[012]\d:[0-5]\d')
101+
d = "("
102+
for i in range(7):
103+
d += calendar.day_abbr[i]
104+
if i != 6:
105+
d += '|'
106+
d += '), ('
107+
for i in range(1, 13):
108+
d += calendar.month_name[i]
109+
if i != 12:
110+
d += '|'
111+
d += ') [0123]\d'
112+
are['date'] = re.compile(d, re.IGNORECASE)
113+
are['battery'] = re.compile('Charging, \d\d%')
114+
return are
115+
116+
AUTO_REGEXPS_RES = fillAutoRegexpsRes()
98117
SB_NO_JAR = 'no-jar'
99118
SB_JAR = 'jar'
100119
SB_JAR_LINUX = 'jar-linux'
@@ -144,6 +163,8 @@ def help():
144163

145164
def autoRegexpsHelp():
146165
print >> sys.stderr, "Available %s options:" % AUTO_REGEXPS
166+
print >> sys.stderr, "\thelp: prints this help"
167+
print >> sys.stderr, "\tall: includes all the available regexps"
147168
for r in AUTO_REGEXPS_RES:
148169
print >> sys.stderr, "\t%s: %s" % (r, AUTO_REGEXPS_RES[r].pattern)
149170
print >> sys.stderr
@@ -379,11 +400,14 @@ for o, a in optlist:
379400
for r in options[AUTO_REGEXPS]:
380401
if r == 'help':
381402
autoRegexpsHelp()
403+
if r == 'all':
404+
options[AUTO_REGEXPS] = AUTO_REGEXPS_RES.keys()
405+
break
382406
if r not in AUTO_REGEXPS_RES:
383407
error("invalid auto regexp: %s\n" % (r))
384408
usage()
385-
# AUTO_REGEPXS implies USE_REGEXPS
386-
options[USE_REGEXPS] = True
409+
# AUTO_REGEPXS implies USE_REGEXPS
410+
options[USE_REGEXPS] = True
387411
elif o in ['a', START_ACTIVITY]:
388412
options[START_ACTIVITY] = a
389413
elif o in ['o', OUTPUT]:

0 commit comments

Comments
 (0)