Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/watchdog/utils/platform.py: 0%
26 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-09 06:08 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-09 06:08 +0000
1# Copyright 2011 Yesudeep Mangalapilly <yesudeep@gmail.com>
2# Copyright 2012 Google, Inc & contributors.
3#
4# Licensed under the Apache License, Version 2.0 (the "License");
5# you may not use this file except in compliance with the License.
6# You may obtain a copy of the License at
7#
8# http://www.apache.org/licenses/LICENSE-2.0
9#
10# Unless required by applicable law or agreed to in writing, software
11# distributed under the License is distributed on an "AS IS" BASIS,
12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13# See the License for the specific language governing permissions and
14# limitations under the License.
17from __future__ import annotations
19import sys
21PLATFORM_WINDOWS = "windows"
22PLATFORM_LINUX = "linux"
23PLATFORM_BSD = "bsd"
24PLATFORM_DARWIN = "darwin"
25PLATFORM_UNKNOWN = "unknown"
28def get_platform_name():
29 if sys.platform.startswith("win"):
30 return PLATFORM_WINDOWS
31 elif sys.platform.startswith("darwin"):
32 return PLATFORM_DARWIN
33 elif sys.platform.startswith("linux"):
34 return PLATFORM_LINUX
35 elif sys.platform.startswith(("dragonfly", "freebsd", "netbsd", "openbsd", "bsd")):
36 return PLATFORM_BSD
37 else:
38 return PLATFORM_UNKNOWN
41__platform__ = get_platform_name()
44def is_linux():
45 return __platform__ == PLATFORM_LINUX
48def is_bsd():
49 return __platform__ == PLATFORM_BSD
52def is_darwin():
53 return __platform__ == PLATFORM_DARWIN
56def is_windows():
57 return __platform__ == PLATFORM_WINDOWS