Skip to content

Commit 626848e

Browse files
committed
Use absolute paths in git_version.py
This should fix build failures on readthedocs
1 parent 86c1bbf commit 626848e

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

git_version.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,21 +26,15 @@ def call_git_describe(abbrev=4):
2626

2727
def read_release_version():
2828
try:
29-
f = open("RELEASE-VERSION", "r")
30-
31-
try:
29+
with open('{}/RELEASE-VERSION'.format(os.path.dirname(__file__)), 'r') as f:
3230
version = f.readlines()[0]
3331
return version.strip()
34-
35-
finally:
36-
f.close()
37-
3832
except:
3933
return None
4034

4135

4236
def write_release_version(version):
43-
with open("RELEASE-VERSION", "w") as f:
37+
with open('{}/RELEASE-VERSION'.format(os.path.dirname(__file__)), 'w') as f:
4438
f.write("%s\n" % version)
4539

4640

@@ -77,8 +71,8 @@ def git_version(abbrev=4):
7771
if version != release_version:
7872
write_release_version(version)
7973

80-
# Update the ev3dev/__version__.py
81-
with open('ev3dev/version.py', 'w') as f:
74+
# Update the ev3dev/version.py
75+
with open('{}/ev3dev/version.py'.format(os.path.dirname(__file__)), 'w') as f:
8276
f.write("__version__ = '{}'".format(version))
8377

8478
# Finally, return the current version.

0 commit comments

Comments
 (0)