mirror of
https://github.com/GAM-team/GAM.git
synced 2026-07-03 20:31:35 +00:00
Make cloudprint. and admin-settings JSON files part of Windows binary
This commit is contained in:
@@ -8,14 +8,10 @@ del /q /f gam-%1-windows-x64.zip
|
|||||||
c:\python27-32\scripts\pyinstaller -F --distpath=gam gam.spec
|
c:\python27-32\scripts\pyinstaller -F --distpath=gam gam.spec
|
||||||
xcopy LICENSE gam\
|
xcopy LICENSE gam\
|
||||||
xcopy whatsnew.txt gam\
|
xcopy whatsnew.txt gam\
|
||||||
xcopy admin-settings-v1.json gam\
|
|
||||||
xcopy cloudprint-v2.json gam\
|
|
||||||
del gam\w9xpopen.exe
|
del gam\w9xpopen.exe
|
||||||
"%ProgramFiles(x86)%\7-Zip\7z.exe" a -tzip gam-%1-windows.zip gam\ -xr!.svn
|
"%ProgramFiles(x86)%\7-Zip\7z.exe" a -tzip gam-%1-windows.zip gam\ -xr!.svn
|
||||||
|
|
||||||
c:\python27\scripts\pyinstaller -F --distpath=gam-64 gam.spec
|
c:\python27\scripts\pyinstaller -F --distpath=gam-64 gam.spec
|
||||||
xcopy LICENSE gam-64\
|
xcopy LICENSE gam-64\
|
||||||
xcopy whatsnew.txt gam-64\
|
xcopy whatsnew.txt gam-64\
|
||||||
xcopy admin-settings-v1.json gam-64\
|
|
||||||
xcopy cloudprint-v2.json gam-64\
|
|
||||||
"%ProgramFiles(x86)%\7-Zip\7z.exe" a -tzip gam-%1-windows-x64.zip gam-64\ -xr!.svn
|
"%ProgramFiles(x86)%\7-Zip\7z.exe" a -tzip gam-%1-windows-x64.zip gam-64\ -xr!.svn
|
||||||
|
|||||||
34
src/gam.py
34
src/gam.py
@@ -588,15 +588,23 @@ def buildGAPIObject(api):
|
|||||||
try:
|
try:
|
||||||
service = googleapiclient.discovery.build(api, version, http=http)
|
service = googleapiclient.discovery.build(api, version, http=http)
|
||||||
except googleapiclient.errors.UnknownApiNameOrVersion:
|
except googleapiclient.errors.UnknownApiNameOrVersion:
|
||||||
disc_file = os.path.join(gamSiteConfigDir, u'%s-%s.json' % (api, version))
|
disc_filename = u'%s-%s.json' % (api, version)
|
||||||
|
disc_file = os.path.join(gamSiteConfigDir, disc_filename)
|
||||||
|
pyinstaller_disc_file = None
|
||||||
|
try:
|
||||||
|
pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
if os.path.isfile(disc_file):
|
if os.path.isfile(disc_file):
|
||||||
f = file(disc_file, 'rb')
|
f = file(disc_file, 'rb')
|
||||||
discovery = f.read()
|
elif pyinstaller_disc_file:
|
||||||
f.close()
|
f = file(pyinstaller_disc_file, 'rb')
|
||||||
service = googleapiclient.discovery.build_from_document(discovery, base=u'https://www.googleapis.com', http=http)
|
|
||||||
else:
|
else:
|
||||||
print 'No online discovery doc and %s does not exist locally' % disc_file
|
print 'No online discovery doc and %s does not exist locally' % disc_file
|
||||||
raise
|
raise
|
||||||
|
discovery = f.read()
|
||||||
|
f.close()
|
||||||
|
service = googleapiclient.discovery.build_from_document(discovery, base=u'https://www.googleapis.com', http=http)
|
||||||
except httplib2.CertificateValidationUnsupported:
|
except httplib2.CertificateValidationUnsupported:
|
||||||
print u'Error: You don\'t have the Python ssl module installed so we can\'t verify SSL Certificates. You can fix this by installing the Python SSL module or you can live on the edge and turn SSL validation off by creating a file called noverifyssl.txt in the same location as gam.exe / gam.py'
|
print u'Error: You don\'t have the Python ssl module installed so we can\'t verify SSL Certificates. You can fix this by installing the Python SSL module or you can live on the edge and turn SSL validation off by creating a file called noverifyssl.txt in the same location as gam.exe / gam.py'
|
||||||
sys.exit(8)
|
sys.exit(8)
|
||||||
@@ -673,6 +681,24 @@ def buildGAPIServiceObject(api, act_as=None, soft_errors=False):
|
|||||||
if soft_errors:
|
if soft_errors:
|
||||||
return False
|
return False
|
||||||
sys.exit(4)
|
sys.exit(4)
|
||||||
|
except googleapiclient.errors.UnknownApiNameOrVersion:
|
||||||
|
disc_filename = u'%s-%s.json' % (api, version)
|
||||||
|
disc_file = os.path.join(gamSiteConfigDir, disc_filename)
|
||||||
|
pyinstaller_disc_file = None
|
||||||
|
try:
|
||||||
|
pyinstaller_disc_file = os.path.join(sys._MEIPASS, disc_filename)
|
||||||
|
except NameError:
|
||||||
|
pass
|
||||||
|
if os.path.isfile(disc_file):
|
||||||
|
f = file(disc_file, 'rb')
|
||||||
|
elif pyinstaller_disc_file:
|
||||||
|
f = file(pyinstaller_disc_file, 'rb')
|
||||||
|
else:
|
||||||
|
print 'No online discovery doc and %s does not exist locally' % disc_file
|
||||||
|
raise
|
||||||
|
discovery = f.read()
|
||||||
|
f.close()
|
||||||
|
return googleapiclient.discovery.build_from_document(discovery, base=u'https://www.googleapis.com', http=http)
|
||||||
|
|
||||||
def buildDiscoveryObject(api):
|
def buildDiscoveryObject(api):
|
||||||
import uritemplate
|
import uritemplate
|
||||||
|
|||||||
Reference in New Issue
Block a user