o b$@svgdZddlZddlZddlZddlmZddlmZdefddZ ddd d d d Z Gd d d Z e Z e ZdS))secondsshortPythonVersionPlatformplatform platformTypeN)time)OptionalreturncCsdtjddS)z? Returns the Python version as a dot-separated string. z%s.%s.%sN)sys version_infor r 8/usr/lib/python3/dist-packages/twisted/python/runtime.pyrsrwin32posixjava)ntcerrzorg.python.modules.osc@seZdZUdZeejZe e e d<e e Z ejZ d!de e de e ddfddZdefd d Zde e fd d Zdefd dZdefddZdefddZdefddZdefddZd"de defddZdefddZdefddZdefdd ZdS)#rzC Gives us information about the platform we're running on. typeNnamerr cCs*|dur t||_|dur||_dSdS)N)knownPlatformsgetr _platform)selfrrr r r__init__,s   zPlatform.__init__cCs |jdkS)z Do we know about this platform? @return: Boolean indicating whether this is a known platform or not. Nrrr r risKnown4 zPlatform.isKnowncCs|jS)zX Get platform type. @return: Either 'posix', 'win32' or 'java' rrr r rgetType<szPlatform.getTypecCs |jdkS)z Check if current platform is macOS. @return: C{True} if the current platform has been detected as macOS. darwin)rrr r risMacOSXDrzPlatform.isMacOSXcCstjdtdd|S)a  Are we running in Windows NT? This is deprecated and always returns C{True} on win32 because Twisted only supports Windows NT-derived platforms at this point. @return: C{True} if the current platform has been detected as Windows NT. zgtwisted.python.runtime.Platform.isWinNT was deprecated in Twisted 13.0. Use Platform.isWindows instead.) stacklevel)warningswarnDeprecationWarning isWindowsrr r risWinNTLs  zPlatform.isWinNTcCs |dkS)z Are we running in Windows? @return: C{True} if the current platform has been detected as Windows. r)rrr r rr'^s zPlatform.isWindowscCstjdko tjdkS)z Check if current platform is Windows Vista or Windows Server 2008. @return: C{True} if the current platform has been detected as Vista r)r rgetwindowsversionmajorrr r risVistagszPlatform.isVistacCs |jdS)z Check if current platform is Linux. @return: C{True} if the current platform has been detected as Linux. linux)r startswithrr r risLinuxos zPlatform.isLinux/proc/1/cgroup_initCGroupLocationcCsn|sdSddlm}||}|r5dd|dD}|D]}t|dkr4|dd r4d Sq"dS) z Check if the current platform is Linux in a Docker container. @return: C{True} if the current platform has been detected as Linux inside a Docker container. Fr)FilePathcSsg|]}|dqS):)split).0xr r r s z%Platform.isDocker.. r r"s/docker/T)r/twisted.python.filepathr2exists getContentr4lenr.)rr1r2 initCGroups controlGroupsgroupr r risDockerws  zPlatform.isDockercCs.|rdSztjWdStyYdSw)z Check for symlink support usable for Twisted's purposes. @return: C{True} if symlinks are supported on the current platform, otherwise C{False}. FT)r'ossymlinkAttributeErrorrr r r_supportsSymlinkss zPlatform._supportsSymlinkscCs(z ddl}|duWStyYdSw)zy Can threads be created? @return: C{True} if the threads are supported on the current platform. rNF) threading ImportError)rrEr r rsupportsThreadss   zPlatform.supportsThreadscCsRz ddlm}m}Wn tyYdSwz t|WdS|y(YdSw)zf Return C{True} if we can use the inotify API on this platform. @since: 10.1 r) INotifyErrorinitFT)twisted.python._inotifyrHrIrFrAclose)rrHrIr r rsupportsINotifys  zPlatform.supportsINotify)NN)r0)__name__ __module__ __qualname____doc__rrrArrrstr__annotations__ staticmethodrr rrrboolrrr!r(r'r,r/r@rDrGrLr r r rr#s0    r)__all__rAr r$rrtypingrrQrrrrrrr r r rs"   )