mirror of
https://gitee.com/gfdgd-xi/deep-wine-runner
synced 2025-01-13 01:58:27 +08:00
Python
This commit is contained in:
parent
aa6743cd3e
commit
7a56a66f6c
54
API/Python/__init__.py
Normal file
54
API/Python/__init__.py
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/usr/bin/env python3
|
||||||
|
# 使用系统默认的 python3 运行
|
||||||
|
###########################################################################################
|
||||||
|
# 作者:gfdgd xi、为什么您不喜欢熊出没和阿布呢
|
||||||
|
# 版本:2.4.0
|
||||||
|
# 更新时间:2022年10月15日
|
||||||
|
# 感谢:感谢 wine 以及 deepin-wine 团队,提供了 wine 和 deepin-wine 给大家使用,让我能做这个程序
|
||||||
|
# 基于 Python3 构建
|
||||||
|
###########################################################################################
|
||||||
|
#################
|
||||||
|
# 加入路径
|
||||||
|
#################
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
programPath = os.path.split(os.path.realpath(__file__))[0] # 返回 string
|
||||||
|
sys.path.append(f"{programPath}/../../")
|
||||||
|
#################
|
||||||
|
# 引入所需的库(正式内容)
|
||||||
|
#################
|
||||||
|
import os
|
||||||
|
import sys
|
||||||
|
import ConfigLanguareRunner
|
||||||
|
class Old:
|
||||||
|
wine = ""
|
||||||
|
wineprefix = ""
|
||||||
|
def __init__(self, wine = "", wineprefix = "") -> None:
|
||||||
|
self.wine = os.getenv("WINE") if wine == "" else wine
|
||||||
|
self.wineprefix = os.getenv("WINEPREFIX") if wine == "" else wineprefix
|
||||||
|
|
||||||
|
def runCommand(self, command: str) -> None:
|
||||||
|
com = ConfigLanguareRunner.Command(command)
|
||||||
|
print(com.GetCommandList())
|
||||||
|
return com.Run(com.GetCommandList(), self.wineprefix, self.wine)
|
||||||
|
|
||||||
|
def runList(self, command: list) -> None:
|
||||||
|
return ConfigLanguareRunner.Command("").Run(command, self.wineprefix, self.wine)
|
||||||
|
|
||||||
|
class Bash:
|
||||||
|
wine = ""
|
||||||
|
wineprefix = ""
|
||||||
|
def __init__(self, wine = "", wineprefix = "") -> None:
|
||||||
|
self.wine = os.getenv("WINE") if wine == "" else wine
|
||||||
|
self.wineprefix = os.getenv("WINEPREFIX") if wine == "" else wineprefix
|
||||||
|
|
||||||
|
def runCommand(self, command: str) -> int:
|
||||||
|
return os.system(f"'{programPath}/../../AutoShell/main.py' -c \"{command}\"")
|
||||||
|
|
||||||
|
def runList(self, command: list) -> int:
|
||||||
|
commandStr = ""
|
||||||
|
for k in command:
|
||||||
|
for i in k:
|
||||||
|
commandStr += f"'{i}' "
|
||||||
|
commandStr += ";"
|
||||||
|
return os.system(f"'{programPath}/../../AutoShell/main.py' -c \"{commandStr}\"")
|
BIN
API/Python/__pycache__/__init__.cpython-37.pyc
Normal file
BIN
API/Python/__pycache__/__init__.cpython-37.pyc
Normal file
Binary file not shown.
3
API/demo/a.py
Normal file
3
API/demo/a.py
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
import WineRunner
|
||||||
|
WineRunner.Bash("a").runList([["thank"], ["version"]])
|
||||||
|
#WineRunner.Bash("a").runCommand("thank")
|
Loading…
Reference in New Issue
Block a user