diff options
Diffstat (limited to 'doc/helpers.py')
-rw-r--r-- | doc/helpers.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/doc/helpers.py b/doc/helpers.py index bd8d10ad4..f30e249dc 100644 --- a/doc/helpers.py +++ b/doc/helpers.py @@ -1,3 +1,6 @@ +from os.path import dirname, join +import json + # Try to load JSON data from a file. If not found, use the argument as a tag name and retrieve the data from GitHub. def getJSON(tag='all'): f = tag @@ -6,9 +9,8 @@ def getJSON(tag='all'): f = 'releases' tag = '' - import json try: - d = json.loads(open(f+'.json', 'r').read()) + d = json.loads(open(join(dirname(__file__), f+'.json'), 'r').read()) except: from urllib.request import urlopen d = json.loads(urlopen('https://api.github.com/repos/ghdl/ghdl/releases'+tag).read()) |