is-windows-system 0.0.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GGN_2015
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: is-windows-system
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: check if current system is windows.
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Author: GGN_2015
|
|
8
|
+
Author-email: neko@jlulug.org
|
|
9
|
+
Requires-Python: >=3.10
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
|
|
19
|
+
# is_windows_system
|
|
20
|
+
check if current system is windows.
|
|
21
|
+
|
|
22
|
+
## Install
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
pip install is_windows_system
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Usage
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from is_windows_system import is_windows_system
|
|
32
|
+
|
|
33
|
+
# True, False
|
|
34
|
+
print(is_windows_system())
|
|
35
|
+
```
|
|
36
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# is_windows_system
|
|
2
|
+
check if current system is windows.
|
|
3
|
+
|
|
4
|
+
## Install
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
pip install is_windows_system
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```python
|
|
13
|
+
from is_windows_system import is_windows_system
|
|
14
|
+
|
|
15
|
+
# True, False
|
|
16
|
+
print(is_windows_system())
|
|
17
|
+
```
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import sys
|
|
2
|
+
import platform
|
|
3
|
+
|
|
4
|
+
def is_windows_system() -> bool:
|
|
5
|
+
"""
|
|
6
|
+
判断当前运行的操作系统是否为 Windows 系统
|
|
7
|
+
|
|
8
|
+
Returns:
|
|
9
|
+
bool: True 表示是 Windows 系统,False 表示非 Windows 系统(Linux/macOS/其他)
|
|
10
|
+
|
|
11
|
+
Examples:
|
|
12
|
+
>>> is_windows_system()
|
|
13
|
+
True # Windows 系统下执行
|
|
14
|
+
>>> is_windows_system()
|
|
15
|
+
False # Linux/macOS 系统下执行
|
|
16
|
+
"""
|
|
17
|
+
try:
|
|
18
|
+
# 优先使用 sys.platform 判断(效率更高,结果稳定)
|
|
19
|
+
if sys.platform == "win32":
|
|
20
|
+
return True
|
|
21
|
+
# 兼容极少数特殊 Windows 环境(如 cygwin 可能返回 "cygwin")
|
|
22
|
+
elif platform.system().lower() == "windows":
|
|
23
|
+
return True
|
|
24
|
+
else:
|
|
25
|
+
return False
|
|
26
|
+
except Exception as e:
|
|
27
|
+
# 捕获极端情况下的异常(如模块加载失败),默认返回 False
|
|
28
|
+
print(f"判断系统类型时发生异常:{e}")
|
|
29
|
+
return False
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "is-windows-system"
|
|
3
|
+
version = "0.0.1"
|
|
4
|
+
description = "check if current system is windows."
|
|
5
|
+
authors = [
|
|
6
|
+
{name = "GGN_2015",email = "neko@jlulug.org"}
|
|
7
|
+
]
|
|
8
|
+
license = {text = "MIT"}
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
dependencies = [
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
[build-system]
|
|
16
|
+
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
|
17
|
+
build-backend = "poetry.core.masonry.api"
|