Skip to content

Commit

Permalink
#624 look for credentials in HOME/.config
Browse files Browse the repository at this point in the history
  • Loading branch information
prjemian committed May 15, 2018
1 parent 8c1eeea commit 44362da
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions utils/create_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ def str2time(time_string):
return datetime.strptime(time_string, fmt)


def getCredentialsFile():
search_paths = [
os.path.dirname(__file__),
os.path.join(os.environ["HOME"], ".config"), # TODO: robust?
]
for path in search_paths:
full_name = os.path.join(path, CREDS_FILE_NAME)
if os.path.exists(full_name):
return full_name


class ReleaseNotes(object):

def __init__(self, base, head=None, milestone=None):
Expand All @@ -36,9 +47,7 @@ def __init__(self, base, head=None, milestone=None):

self.commit_db = {}
self.db = dict(tags={}, pulls={}, issues={}, commits={})
self.creds_file_name = os.path.join(
os.path.dirname(__file__),
CREDS_FILE_NAME)
self.creds_file_name = getCredentialsFile()
if not os.path.exists(self.creds_file_name):
raise ValueError('Missing file: ' + self.creds_file_name)

Expand Down

0 comments on commit 44362da

Please sign in to comment.