MCPcopy Create free account
hub / github.com/RT-Thread/env-windows / mkrealfile

Function mkrealfile

tools/python-3.11.9-amd64/Tools/scripts/mkreal.py:17–28  ·  view source on GitHub ↗
(name)

Source from the content-addressed store, hash-verified

15BUFSIZE = 32*1024
16
17def mkrealfile(name):
18 st = os.stat(name) # Get the mode
19 mode = S_IMODE(st[ST_MODE])
20 linkto = os.readlink(name) # Make sure again it's a symlink
21 with open(name, 'rb') as f_in: # This ensures it's a file
22 os.unlink(name)
23 with open(name, 'wb') as f_out:
24 while 1:
25 buf = f_in.read(BUFSIZE)
26 if not buf: break
27 f_out.write(buf)
28 os.chmod(name, mode)
29
30def mkrealdir(name):
31 st = os.stat(name) # Get the mode

Callers 1

mainFunction · 0.85

Calls 8

S_IMODEFunction · 0.85
readlinkMethod · 0.80
openFunction · 0.50
statMethod · 0.45
unlinkMethod · 0.45
readMethod · 0.45
writeMethod · 0.45
chmodMethod · 0.45

Tested by

no test coverage detected