|
1 |
| -# ------------------------------------------------------------------ |
2 |
| -# Copyright (c) 2023 PyInstaller Development Team. |
3 |
| -# |
4 |
| -# This file is distributed under the terms of the GNU General Public |
5 |
| -# License (version 2.0 or later). |
6 |
| -# |
7 |
| -# The full license is available in LICENSE, distributed with |
8 |
| -# this software. |
9 |
| -# |
10 |
| -# SPDX-License-Identifier: GPL-2.0-or-later |
11 |
| -# ------------------------------------------------------------------ |
12 |
| -import os |
13 |
| -import sys |
14 |
| - |
15 |
| -# see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/_common.py#L82 |
16 |
| -WINDOWS = os.name == "nt" |
17 |
| -LINUX = sys.platform.startswith("linux") |
18 |
| -MACOS = sys.platform.startswith("darwin") |
19 |
| -FREEBSD = sys.platform.startswith(("freebsd", "midnightbsd")) |
20 |
| -OPENBSD = sys.platform.startswith("openbsd") |
21 |
| -NETBSD = sys.platform.startswith("netbsd") |
22 |
| -BSD = FREEBSD or OPENBSD or NETBSD |
23 |
| -SUNOS = sys.platform.startswith(("sunos", "solaris")) |
24 |
| -AIX = sys.platform.startswith("aix") |
25 |
| - |
26 |
| -excludedimports = [ |
27 |
| - "psutil._pslinux", |
28 |
| - "psutil._pswindows", |
29 |
| - "psutil._psosx", |
30 |
| - "psutil._psbsd", |
31 |
| - "psutil._pssunos", |
32 |
| - "psutil._psaix", |
33 |
| -] |
34 |
| - |
35 |
| -# see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/__init__.py#L97 |
36 |
| -if LINUX: |
37 |
| - excludedimports.remove("psutil._pslinux") |
38 |
| -elif WINDOWS: |
39 |
| - excludedimports.remove("psutil._pswindows") |
40 |
| - # see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/_common.py#L856 |
41 |
| - # This will exclude `curses` for windows |
42 |
| - excludedimports.append("curses") |
43 |
| -elif MACOS: |
44 |
| - excludedimports.remove("psutil._psosx") |
45 |
| -elif BSD: |
46 |
| - excludedimports.remove("psutil._psbsd") |
47 |
| -elif SUNOS: |
48 |
| - excludedimports.remove("psutil._pssunos") |
49 |
| -elif AIX: |
50 |
| - excludedimports.remove("psutil._psaix") |
| 1 | +# ------------------------------------------------------------------ |
| 2 | +# Copyright (c) 2023 PyInstaller Development Team. |
| 3 | +# |
| 4 | +# This file is distributed under the terms of the GNU General Public |
| 5 | +# License (version 2.0 or later). |
| 6 | +# |
| 7 | +# The full license is available in LICENSE, distributed with |
| 8 | +# this software. |
| 9 | +# |
| 10 | +# SPDX-License-Identifier: GPL-2.0-or-later |
| 11 | +# ------------------------------------------------------------------ |
| 12 | +import os |
| 13 | +import sys |
| 14 | + |
| 15 | +# see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/_common.py#L82 |
| 16 | +WINDOWS = os.name == "nt" |
| 17 | +LINUX = sys.platform.startswith("linux") |
| 18 | +MACOS = sys.platform.startswith("darwin") |
| 19 | +FREEBSD = sys.platform.startswith(("freebsd", "midnightbsd")) |
| 20 | +OPENBSD = sys.platform.startswith("openbsd") |
| 21 | +NETBSD = sys.platform.startswith("netbsd") |
| 22 | +BSD = FREEBSD or OPENBSD or NETBSD |
| 23 | +SUNOS = sys.platform.startswith(("sunos", "solaris")) |
| 24 | +AIX = sys.platform.startswith("aix") |
| 25 | + |
| 26 | +excludedimports = [ |
| 27 | + "psutil._pslinux", |
| 28 | + "psutil._pswindows", |
| 29 | + "psutil._psosx", |
| 30 | + "psutil._psbsd", |
| 31 | + "psutil._pssunos", |
| 32 | + "psutil._psaix", |
| 33 | +] |
| 34 | + |
| 35 | +# see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/__init__.py#L97 |
| 36 | +if LINUX: |
| 37 | + excludedimports.remove("psutil._pslinux") |
| 38 | +elif WINDOWS: |
| 39 | + excludedimports.remove("psutil._pswindows") |
| 40 | + # see https://github.com/giampaolo/psutil/blob/release-5.9.5/psutil/_common.py#L856 |
| 41 | + # This will exclude `curses` for windows |
| 42 | + excludedimports.append("curses") |
| 43 | +elif MACOS: |
| 44 | + excludedimports.remove("psutil._psosx") |
| 45 | +elif BSD: |
| 46 | + excludedimports.remove("psutil._psbsd") |
| 47 | +elif SUNOS: |
| 48 | + excludedimports.remove("psutil._pssunos") |
| 49 | +elif AIX: |
| 50 | + excludedimports.remove("psutil._psaix") |
0 commit comments