@@ -70,39 +70,29 @@ def get_build_data(self):
7070 if is_windows ():
7171 path = os .path .normpath (path )
7272 try :
73- path = os .path .dirname (__file__ )
74- path = os .path .join (path , "print_build_data.build_data.txt" )
75- # Use utf-8-sig to handle Windows BOM
7673 with open (path , 'rb' ) as fp :
7774 data = fp .read ()
75+ # Use utf-8-sig to handle Windows BOM, just in case; it's easy
76+ # for it to sneak in on Windows.
7877 return data .decode ('utf-8-sig' )
7978 except Exception as exc :
8079 if hasattr (exc , "add_note" ):
81- exc .add_note (f"version: { sys .version } " )
82- exc .add_note (f"path: { path } " )
80+ exc .add_note (f"python version: { sys .version } " )
81+ exc .add_note (f"attempted path: { path } " )
8382 exc .add_note (f"runfiles lookup path: { rlocation_path } " )
8483 exc .add_note (f"exists: { os .path .exists (path )} " )
8584 exc .add_note (f"lexists: { os .path .lexists (path )} " )
8685 exc .add_note (f"islink: { os .path .islink (path )} " )
8786 exc .add_note (f"isfile: { os .path .isfile (path )} " )
8887 if hasattr (os .path , "isjunction" ):
89- exc .add_note (f"isjunction: { os .path .isjunction (path )} " )
88+ is_junction = os .path .isjunction (path )
89+ else :
90+ import stat
91+ st = os .lstat (path )
92+ is_junction = bool (st .st_reparse_tag == stat .IO_REPARSE_TAG_MOUNT_POINT )
93+ exc .add_note (f"isjunction: { is_junction } " )
9094 can_read = os .access (path , os .R_OK )
9195 exc .add_note (f"readable: { can_read } " )
92- try :
93- exc .add_note (f"stat: { os .stat (path )} " )
94- except Exception as e :
95- exc .add_note (f"stat error: { e } " )
96- try :
97- exc .add_note (f"lstat: { os .lstat (path )} " )
98- except Exception as e :
99- exc .add_note (f"lstat error: { e } " )
100- try :
101- import subprocess
102- out = subprocess .check_output (f'dir "{ os .path .dirname (path )} "' , shell = True )
103- exc .add_note (f"dir: { out .decode ('utf-8' , 'replace' )} " )
104- except Exception as e :
105- exc .add_note (f"dir error: { e } " )
10696 raise
10797
10898
0 commit comments