@@ -2182,18 +2182,20 @@ def check_ext_start_dir(expected_start_dir, unpack_src=True):
21822182 ext = eb .ext_instances [- 1 ]
21832183 ext .run (unpack_src = unpack_src )
21842184
2185- if unpack_src :
2186- self .assertTrue (ext .start_dir is None or os .path .isabs (ext .start_dir ))
2187-
21882185 if expected_start_dir is None :
21892186 self .assertIsNone (ext .start_dir )
21902187 else :
2188+ self .assertTrue (os .path .isabs (ext .start_dir ))
2189+ if ext .start_dir != os .sep :
2190+ self .assertFalse (ext .start_dir .endswith (os .sep ))
21912191 if os .path .isabs (expected_start_dir ):
21922192 abs_expected_start_dir = expected_start_dir
21932193 else :
21942194 abs_expected_start_dir = os .path .join (eb .builddir , expected_start_dir )
2195- self .assertTrue (os .path .samefile (ext .start_dir , abs_expected_start_dir ))
21962195 self .assertEqual (ext .start_dir , abs_expected_start_dir )
2196+ if not os .path .exists (eb .builddir ):
2197+ eb .make_builddir () # Required to exist for samefile
2198+ self .assertTrue (os .path .samefile (ext .start_dir , abs_expected_start_dir ))
21972199 if unpack_src :
21982200 self .assertTrue (os .path .samefile (os .getcwd (), abs_expected_start_dir ))
21992201 else :
@@ -2236,17 +2238,19 @@ def check_ext_start_dir(expected_start_dir, unpack_src=True):
22362238 # No error when using relative path in non-extracted source for some reason
22372239 ec ['ec' ]['exts_list' ] = [
22382240 ('barbar' , '0.0' , {
2239- 'start_dir' : '.' }), # The current path which does exist
2241+ 'start_dir' : '.' }), # The build directory which does exist
22402242 ]
22412243 with self .mocked_stdout_stderr ():
2242- check_ext_start_dir (os . path . join ( cwd , '.' ) , unpack_src = False )
2244+ check_ext_start_dir ('.' , unpack_src = False )
22432245 self .assertFalse (self .get_stderr ())
2246+
2247+ # Support / (absolute path) if explicitely requested
22442248 ec ['ec' ]['exts_list' ] = [
22452249 ('barbar' , '0.0' , {
2246- 'start_dir' : '..' }), # The parent path which also exists
2250+ 'start_dir' : os . sep }),
22472251 ]
22482252 with self .mocked_stdout_stderr ():
2249- check_ext_start_dir (os .path . join ( cwd , '..' ) , unpack_src = False )
2253+ check_ext_start_dir (os .sep , unpack_src = False )
22502254 self .assertFalse (self .get_stderr ())
22512255
22522256 def test_prepare_step (self ):
0 commit comments