[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [depictor/master] Use absolute directory paths instead of relative ones, and handle the case where 'stem' is not defined.



commit cd08f47ce1a10e478297705e8781797fa6d7d29c
Author: Tom Ritter <tom@xxxxxxxxx>
Date:   Thu Feb 15 12:30:56 2018 -0600

    Use absolute directory paths instead of relative ones, and handle the case where 'stem' is not defined.
    
    Resolves #25158
---
 website.py | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/website.py b/website.py
index a61a5c3..a80ee58 100755
--- a/website.py
+++ b/website.py
@@ -1475,9 +1475,14 @@ class WebsiteWriter:
    		"""
 		depictor_version = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
 
-		os.chdir(os.path.join(os.path.dirname(__file__), 'stem'))
-		stem_version = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
-		os.chdir('../../')
+		original_path = os.path.abspath(os.path.dirname(__file__))
+		stem_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'stem'))
+		if os.path.exists(stem_path):
+			os.chdir(stem_path)
+			stem_version = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'])
+			os.chdir(original_path)
+		else:
+			stem_version = "(unavailable)"
 
 		self.site.write("</div>\n"
 		+ "</div>\n"



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits