From aa1db89bd3d6957a2c6728d6edcfbeb989bf2597 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 3 Nov 2016 13:29:26 -0400 Subject: [PATCH 1/5] include gam-setup.bat in MSI and zip. Call it from MSI at end of install. --- src/gam-setup.bat | 5 +++-- src/gam.wxs | 11 ++++++++++- src/windows-build.bat | 4 ++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/gam-setup.bat b/src/gam-setup.bat index 9a52f300..52f220dc 100644 --- a/src/gam-setup.bat +++ b/src/gam-setup.bat @@ -68,5 +68,6 @@ @goto saauth :sadone -echo GAM installation and setup complete! -:alldone \ No newline at end of file +@echo GAM installation and setup complete! +:alldone +@pause \ No newline at end of file diff --git a/src/gam.wxs b/src/gam.wxs index 029534a6..2d59670e 100644 --- a/src/gam.wxs +++ b/src/gam.wxs @@ -52,6 +52,12 @@ + + + + + + @@ -59,7 +65,10 @@ - + + + NOT Installed + diff --git a/src/windows-build.bat b/src/windows-build.bat index b33e8f07..1971485c 100644 --- a/src/windows-build.bat +++ b/src/windows-build.bat @@ -11,12 +11,16 @@ del /q /f gam.wixpdb c:\python27-32\scripts\pyinstaller --clean -F --distpath=gam windows-gam.spec xcopy LICENSE gam\ xcopy whatsnew.txt gam\ +xcopy gam-setup.bat gam\ +xcopy gamcommands.txt gam\ del gam\w9xpopen.exe "%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows.zip gam\ -xr!.svn c:\python27-64\scripts\pyinstaller --clean -F --distpath=gam-64 windows-gam.spec xcopy LICENSE gam-64\ xcopy whatsnew.txt gam-64\ +xcopy gam-setup.bat gam-64\ +xcopy gamcommands.txt gam-64\ "%ProgramFiles%\7-Zip\7z.exe" a -tzip gam-%1-windows-x64.zip gam-64\ -xr!.svn set GAMVERSION=%1 From d9124f3ffaffeec9449b73b7ebcf95ce9a90205a Mon Sep 17 00:00:00 2001 From: Ross Scroggs Date: Thu, 3 Nov 2016 10:50:43 -0700 Subject: [PATCH 2/5] Fix doRequestOAuth to find proper client secrets JSON file (#313) The environment variables GAMUSERCONFIGDIR and CLIENTSECRETS are factored in to GC_Values[GC_CLIENT_SECRETS_JSON]. On a new installation, it will have the value os.path.join(GM_Globals[GM_GAM_PATH], FN_CLIENT_SECRETS_JSON) but on an existing installation the environment variables may have it located somewhere else. --- src/gam.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/gam.py b/src/gam.py index 1dc8b6ea..a2fcc0d2 100755 --- a/src/gam.py +++ b/src/gam.py @@ -9962,7 +9962,6 @@ def doRequestOAuth(login_hint=None): scopes.insert(0, u'email') # Email Display Scope, always included return (True, u'') - cs_file = os.path.join(GM_Globals[GM_GAM_PATH], FN_CLIENT_SECRETS_JSON) MISSING_CLIENT_SECRETS_MESSAGE = u"""Please configure OAuth 2.0 To make GAM run you will need to populate the {0} file found at: @@ -9976,7 +9975,7 @@ See this site for instructions: """.format(FN_CLIENT_SECRETS_JSON, GC_Values[GC_CLIENT_SECRETS_JSON], GAM_WIKI_CREATE_CLIENT_SECRETS) - cs_data = readFile(cs_file, mode=u'rb', continueOnError=True, displayError=True, encoding=None) + cs_data = readFile(GC_Values[GC_CLIENT_SECRETS_JSON], mode=u'rb', continueOnError=True, displayError=True, encoding=None) if not cs_data: systemErrorExit(14, MISSING_CLIENT_SECRETS_MESSAGE) try: From 26fbf9c5243ad73437c9fe8b433207c7401c40a3 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 3 Nov 2016 14:19:46 -0400 Subject: [PATCH 3/5] don't run setup on upgrades --- src/gam.wxs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gam.wxs b/src/gam.wxs index 2d59670e..081573cd 100644 --- a/src/gam.wxs +++ b/src/gam.wxs @@ -68,7 +68,7 @@ - NOT Installed + NOT Installed AND NOT UPGRADINGPRODUCTCODE AND NOT WIX_UPGRADE_DETECTED From 6becd08f3c0b145cd2221e986485b86e02b4131c Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 3 Nov 2016 14:30:14 -0400 Subject: [PATCH 4/5] fix login_hint issues --- src/gam.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/gam.py b/src/gam.py index a2fcc0d2..9639a1ad 100755 --- a/src/gam.py +++ b/src/gam.py @@ -9986,9 +9986,7 @@ See this site for instructions: print u'ERROR: the format of your client secrets file:\n\n%s\n\n is incorrect. Please recreate the file.' sys.exit(3) - try: - login_hint = sys.argv[3] - except IndexError: + if not login_hint: while True: login_hint = raw_input(u'\nWhat is your G Suite admin email address? ') if login_hint.find(u'@') == -1: @@ -10441,7 +10439,7 @@ def ProcessGAMCommand(args): elif command in [u'oauth', u'oauth2']: argument = sys.argv[2].lower() if argument in [u'request', u'create']: - doRequestOAuth() + doRequestOAuth(login_hint=sys.argv[3]) elif argument in [u'info', u'verify']: OAuthInfo() elif argument in [u'delete', u'revoke']: From 32e7932050c08a11cc85e1d6ecda73d260eb1116 Mon Sep 17 00:00:00 2001 From: Jay Lee Date: Thu, 3 Nov 2016 14:42:07 -0400 Subject: [PATCH 5/5] fix potential IndexError --- src/gam.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/gam.py b/src/gam.py index 9639a1ad..55ad0e2b 100755 --- a/src/gam.py +++ b/src/gam.py @@ -10439,7 +10439,11 @@ def ProcessGAMCommand(args): elif command in [u'oauth', u'oauth2']: argument = sys.argv[2].lower() if argument in [u'request', u'create']: - doRequestOAuth(login_hint=sys.argv[3]) + try: + login_hint = sys.argv[3] + except IndexError: + login_hint = None + doRequestOAuth(login_hint) elif argument in [u'info', u'verify']: OAuthInfo() elif argument in [u'delete', u'revoke']: