mirror of
https://github.com/GAM-team/GAM.git
synced 2025-07-08 21:53:36 +00:00
Fix doGamVersion (#311)
* Fix doGamVersion doGamVersion is called by showUsage with checkForArgs=False to keep doGamVersion from wandering through some other command’s arguments * Update documentation * Further doGamVersion cleanup Allow simple and check, keep pylint happy * gam version simple is script only option, not exposed to user
This commit is contained in:
40
src/gam.py
40
src/gam.py
@ -428,7 +428,7 @@ def indentMultiLineText(message, n=0):
|
|||||||
return message.replace(u'\n', u'\n{0}'.format(u' '*n)).rstrip()
|
return message.replace(u'\n', u'\n{0}'.format(u' '*n)).rstrip()
|
||||||
|
|
||||||
def showUsage():
|
def showUsage():
|
||||||
doGAMVersion(checkForCheck=False)
|
doGAMVersion(checkForArgs=False)
|
||||||
print u'''
|
print u'''
|
||||||
Usage: gam [OPTIONS]...
|
Usage: gam [OPTIONS]...
|
||||||
|
|
||||||
@ -818,32 +818,32 @@ def doGAMCheckForUpdates(forceCheck=False):
|
|||||||
except (urllib2.HTTPError, urllib2.URLError):
|
except (urllib2.HTTPError, urllib2.URLError):
|
||||||
return
|
return
|
||||||
|
|
||||||
def doGAMVersion(checkForCheck=True):
|
def doGAMVersion(checkForArgs=True):
|
||||||
force_check = False
|
force_check = False
|
||||||
simple = False
|
simple = False
|
||||||
i = 2
|
if checkForArgs:
|
||||||
while i < len(sys.argv):
|
i = 2
|
||||||
myarg = sys.argv[i].lower().replace(u'_', u'')
|
while i < len(sys.argv):
|
||||||
force_check = True
|
myarg = sys.argv[i].lower().replace(u'_', u'')
|
||||||
if myarg == u'check':
|
if myarg == u'check':
|
||||||
force_check = True
|
force_check = True
|
||||||
i += 1
|
i += 1
|
||||||
elif myarg == u'simple':
|
elif myarg == u'simple':
|
||||||
simple = True
|
simple = True
|
||||||
i += 1
|
i += 1
|
||||||
else:
|
else:
|
||||||
print u'ERROR: %s is not a valid argument for "gam version"' % sys.argv[i]
|
print u'ERROR: %s is not a valid argument for "gam version"' % sys.argv[i]
|
||||||
sys.exit(2)
|
sys.exit(2)
|
||||||
if simple:
|
if simple:
|
||||||
sys.stdout.write(__version__)
|
sys.stdout.write(__version__)
|
||||||
sys.exit(0)
|
return
|
||||||
import struct
|
import struct
|
||||||
version_data = u'GAM {0} - {1}\n{2}\nPython {3}.{4}.{5} {6}-bit {7}\ngoogle-api-python-client {8}\n{9} {10}\nPath: {11}'
|
version_data = u'GAM {0} - {1}\n{2}\nPython {3}.{4}.{5} {6}-bit {7}\ngoogle-api-python-client {8}\n{9} {10}\nPath: {11}'
|
||||||
print version_data.format(__version__, GAM_URL, __author__, sys.version_info[0],
|
print version_data.format(__version__, GAM_URL, __author__, sys.version_info[0],
|
||||||
sys.version_info[1], sys.version_info[2], struct.calcsize(u'P')*8,
|
sys.version_info[1], sys.version_info[2], struct.calcsize(u'P')*8,
|
||||||
sys.version_info[3], googleapiclient.__version__, platform.platform(),
|
sys.version_info[3], googleapiclient.__version__, platform.platform(),
|
||||||
platform.machine(), GM_Globals[GM_GAM_PATH])
|
platform.machine(), GM_Globals[GM_GAM_PATH])
|
||||||
if checkForCheck or force_check:
|
if force_check:
|
||||||
doGAMCheckForUpdates(forceCheck=True)
|
doGAMCheckForUpdates(forceCheck=True)
|
||||||
|
|
||||||
def handleOAuthTokenError(e, soft_errors):
|
def handleOAuthTokenError(e, soft_errors):
|
||||||
|
Reference in New Issue
Block a user