]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/Common/LongFilePathOs.py
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / BaseTools / Source / Python / Common / LongFilePathOs.py
1 ## @file
2 # Override built in module os to provide support for long file path
3 #
4 # Copyright (c) 2014 - 2018, Intel Corporation. All rights reserved.<BR>
5 # SPDX-License-Identifier: BSD-2-Clause-Patent
6 #
7
8 from __future__ import absolute_import
9 import os
10 from . import LongFilePathOsPath
11 from Common.LongFilePathSupport import LongFilePath
12 import time
13
14 path = LongFilePathOsPath
15
16 def access(path, mode):
17 return os.access(LongFilePath(path), mode)
18
19 def remove(path):
20 Timeout = 0.0
21 while Timeout < 5.0:
22 try:
23 return os.remove(LongFilePath(path))
24 except:
25 time.sleep(0.1)
26 Timeout = Timeout + 0.1
27 return os.remove(LongFilePath(path))
28
29 def removedirs(name):
30 return os.removedirs(LongFilePath(name))
31
32 def rmdir(path):
33 return os.rmdir(LongFilePath(path))
34
35 def mkdir(path):
36 return os.mkdir(LongFilePath(path))
37
38 def makedirs(name, mode=0o777):
39 return os.makedirs(LongFilePath(name), mode)
40
41 def rename(old, new):
42 return os.rename(LongFilePath(old), LongFilePath(new))
43
44 def chdir(path):
45 return os.chdir(LongFilePath(path))
46
47 def chmod(path, mode):
48 return os.chmod(LongFilePath(path), mode)
49
50 def stat(path):
51 return os.stat(LongFilePath(path))
52
53 def utime(path, times):
54 return os.utime(LongFilePath(path), times)
55
56 def listdir(path):
57 List = []
58 uList = os.listdir(u"%s" % LongFilePath(path))
59 for Item in uList:
60 List.append(Item)
61 return List
62
63 if hasattr(os, 'replace'):
64 def replace(src, dst):
65 return os.replace(LongFilePath(src), LongFilePath(dst))
66
67 environ = os.environ
68 getcwd = os.getcwd
69 chdir = os.chdir
70 walk = os.walk
71 W_OK = os.W_OK
72 F_OK = os.F_OK
73 sep = os.sep
74 linesep = os.linesep
75 getenv = os.getenv
76 pathsep = os.pathsep
77 name = os.name
78 SEEK_SET = os.SEEK_SET
79 SEEK_END = os.SEEK_END