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 8from __future__ import absolute_import 9import os 10from . import LongFilePathOsPath 11from Common.LongFilePathSupport import LongFilePath 12import time 13 14path = LongFilePathOsPath 15 16def access(path, mode): 17 return os.access(LongFilePath(path), mode) 18 19def 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 29def removedirs(name): 30 return os.removedirs(LongFilePath(name)) 31 32def rmdir(path): 33 return os.rmdir(LongFilePath(path)) 34 35def mkdir(path): 36 return os.mkdir(LongFilePath(path)) 37 38def makedirs(name, mode=0o777): 39 return os.makedirs(LongFilePath(name), mode) 40 41def rename(old, new): 42 return os.rename(LongFilePath(old), LongFilePath(new)) 43 44def chdir(path): 45 return os.chdir(LongFilePath(path)) 46 47def chmod(path, mode): 48 return os.chmod(LongFilePath(path), mode) 49 50def stat(path): 51 return os.stat(LongFilePath(path)) 52 53def utime(path, times): 54 return os.utime(LongFilePath(path), times) 55 56def 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 63environ = os.environ 64getcwd = os.getcwd 65chdir = os.chdir 66walk = os.walk 67W_OK = os.W_OK 68F_OK = os.F_OK 69sep = os.sep 70linesep = os.linesep 71getenv = os.getenv 72pathsep = os.pathsep 73name = os.name 74SEEK_SET = os.SEEK_SET 75SEEK_END = os.SEEK_END 76