blob: 598723df548f8e76ab6d8d2a6e7d4bba857e31bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
# SPDX-License-Identifier: MIT
#
# Copyright The SCons Foundation
import os
import SCons
DefaultEnvironment(tools=[])
env = Environment()
drive = os.path.splitdrive(os.getcwd())[0]
drive_dir = env.fs.Dir(drive)
if not isinstance(drive_dir, SCons.Node.FS.RootDir):
raise Exception(
f'env.fs.Dir("{drive}") returned a {type(drive_dir)} instead of a RootDir'
)
drive_abspath1 = drive_dir._abspath
drive_abspath2 = drive_dir.abspath
if drive_abspath1 != drive_abspath2:
raise Exception(
f'Calculated _abspath {drive_abspath1} is not the same as abspath {drive_abspath2}'
)
elif not os.path.exists(drive_abspath1):
raise Exception(f'Calculated abspath {drive_abspath1} does not exist')
elif drive.rstrip(os.path.sep) != drive_abspath1.rstrip(os.path.sep):
raise Exception(
f'Real drive {drive} and calculated abspath {drive_abspath1} are not the same'
)
drive_path1 = drive_dir._path
drive_path2 = drive_dir.path
if drive_path1 != drive_path2:
raise Exception(
f'Calculated _path {drive_path1} is not the same as path {drive_path2}'
)
elif not os.path.exists(drive_path1):
raise Exception(f'Calculated path {drive_path1} does not exist')
elif drive.rstrip(os.path.sep) != drive_path1.rstrip(os.path.sep):
raise Exception(
f'Real drive {drive} and calculated abspath {drive_abs} are not the same'
)
|