Skip to content

Commit

Permalink
Merge pull request #125 from martinholmer/cli-token-check
Browse files Browse the repository at this point in the history
Add CLI check for existence of Anaconda token file
  • Loading branch information
martinholmer authored Nov 14, 2018
2 parents b7d5349 + 76425cd commit a5725a4
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pkgbld/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
# pycodestyle cli.py
# pylint --disable=locally-disabled cli.py

import sys
import argparse
import re
import os
import pkgbld


Expand Down Expand Up @@ -51,7 +51,7 @@ def main():
args = parser.parse_args()
# show Package-Builder version and quit if --version option specified
if args.version:
sys.stdout.write('Package-Builder {}\n'.format(pkgbld.__version__))
print('Package-Builder {}'.format(pkgbld.__version__))
return 0
# check command-line arguments
repo_name = args.REPOSITORY_NAME
Expand All @@ -69,6 +69,9 @@ def main():
if re.match(pattern, version) is None:
emsg += ('ERROR: MODEL_VERSION does have X.Y.Z '
'semantic-versioning pattern\n')
if not os.path.isfile(pkgbld.ANACONDA_TOKEN_FILE):
emsg += ('ERROR: Anaconda token file '
'{} does not exist'.format(pkgbld.ANACONDA_TOKEN_FILE))
if emsg:
print(emsg)
print('USAGE:', usage_str)
Expand Down

0 comments on commit a5725a4

Please sign in to comment.