MCPcopy Index your code
hub / github.com/python/cpython / makedev

Method makedev

Lib/tarfile.py:2704–2720  ·  view source on GitHub ↗

Make a character or block device called targetpath.

(self, tarinfo, targetpath)

Source from the content-addressed store, hash-verified

2702 raise ExtractError("fifo not supported by system")
2703
2704 def makedev(self, tarinfo, targetpath):
2705 """Make a character or block device called targetpath.
2706 """
2707 if not hasattr(os, "mknod") or not hasattr(os, "makedev"):
2708 raise ExtractError("special devices not supported by system")
2709
2710 mode = tarinfo.mode
2711 if mode is None:
2712 # Use mknod's default
2713 mode = 0o600
2714 if tarinfo.isblk():
2715 mode |= stat.S_IFBLK
2716 else:
2717 mode |= stat.S_IFCHR
2718
2719 os.mknod(targetpath, mode,
2720 os.makedev(tarinfo.devmajor, tarinfo.devminor))
2721
2722 def makelink(self, tarinfo, targetpath):
2723 return self.makelink_with_filter(tarinfo, targetpath, None, None)

Callers 3

_extract_memberMethod · 0.95
initializeStreamsFunction · 0.80
test_makedevMethod · 0.80

Calls 2

ExtractErrorClass · 0.85
isblkMethod · 0.80

Tested by 1

test_makedevMethod · 0.64