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

Function check_enableusersite

tools/python-3.11.9-amd64/Lib/site.py:242–264  ·  view source on GitHub ↗

Check if user site directory is safe for inclusion The function tests for the command line flag (including environment var), process uid/gid equal to effective uid/gid. None: Disabled for security reasons False: Disabled by user (command line option) True: Safe and enabl

()

Source from the content-addressed store, hash-verified

240
241
242def check_enableusersite():
243 """Check if user site directory is safe for inclusion
244
245 The function tests for the command line flag (including environment var),
246 process uid/gid equal to effective uid/gid.
247
248 None: Disabled for security reasons
249 False: Disabled by user (command line option)
250 True: Safe and enabled
251 """
252 if sys.flags.no_user_site:
253 return False
254
255 if hasattr(os, "getuid") and hasattr(os, "geteuid"):
256 # check process uid == effective uid
257 if os.geteuid() != os.getuid():
258 return None
259 if hasattr(os, "getgid") and hasattr(os, "getegid"):
260 # check process gid == effective gid
261 if os.getegid() != os.getgid():
262 return None
263
264 return True
265
266
267# NOTE: sysconfig and it's dependencies are relatively large but site module

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected