Skip to content

Commit e5a5c36

Browse files
committed
Merge pull request google#11 from tseaver/scrub-non_optional-gflags
Really make 'gflags' optional.
2 parents 3a7c440 + 9be5156 commit e5a5c36

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

apitools/base/py/credentials_lib.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@
1414
import oauth2client.multistore_file
1515
import oauth2client.tools
1616

17-
import gflags as flags
17+
try:
18+
from gflags import FLAGS
19+
except ImportError:
20+
FLAGS = None
21+
1822
import logging
1923

2024
from apitools.base.py import exceptions
@@ -192,8 +196,8 @@ def CredentialsFromFile(path, client_info):
192196
client_info['client_id'],
193197
client_info['user_agent'],
194198
client_info['scope'])
195-
if hasattr(flags.FLAGS, 'auth_local_webserver'):
196-
flags.FLAGS.auth_local_webserver = False
199+
if hasattr(FLAGS, 'auth_local_webserver'):
200+
FLAGS.auth_local_webserver = False
197201
credentials = credential_store.get()
198202
if credentials is None or credentials.invalid:
199203
print 'Generating new OAuth credentials ...'

0 commit comments

Comments
 (0)