Compare commits
No commits in common. "8df3458b2a4b4611749321208be83be78da7315f" and "249b77ba80223350ea10c3cfbf995d4f49b01321" have entirely different histories.
8df3458b2a
...
249b77ba80
13
README.md
13
README.md
@ -6,7 +6,7 @@ A python lib came from [Difficult Rocket](https://github.com/shenjackyuanjie/Dif
|
|||||||
|
|
||||||
## Information/信息
|
## Information/信息
|
||||||
|
|
||||||
- Version / 版本: 0.2.0-rc.9
|
- Version / 版本: 0.2.0-rc.1
|
||||||
- Author / 作者: shenjackyuanjie <3695888@qq.com>
|
- Author / 作者: shenjackyuanjie <3695888@qq.com>
|
||||||
|
|
||||||
> [shenjackyuanjie](https://github.com/shenjackyuanjie)
|
> [shenjackyuanjie](https://github.com/shenjackyuanjie)
|
||||||
@ -75,17 +75,6 @@ lndl_nuitka . -y
|
|||||||
# run without confirmation
|
# run without confirmation
|
||||||
lndl_nuitka . -n
|
lndl_nuitka . -n
|
||||||
# do not run
|
# do not run
|
||||||
```
|
|
||||||
|
|
||||||
```python
|
|
||||||
from tomli import loads
|
|
||||||
from lib_not_dr.nuitka.reader import main, run_nuitka
|
|
||||||
|
|
||||||
pyproject_toml = loads(open("pyproject.toml", "r").read())
|
|
||||||
nuitka_config = pyproject_toml["tool"]["lndl"]["nuitka"]
|
|
||||||
nuitka_config["product_version"] = "0.1.0"
|
|
||||||
command = main(nuitka_config)
|
|
||||||
run_nuitka(command)
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Nuitka Compiler Helper
|
### Nuitka Compiler Helper
|
||||||
|
@ -1,36 +1,5 @@
|
|||||||
# Change log / 更新日志
|
# Change log / 更新日志
|
||||||
|
|
||||||
## 0.2.0-rc.9
|
|
||||||
|
|
||||||
### lndl-nuitka
|
|
||||||
|
|
||||||
- 将运行方法修改为 `subprocess.run(shell=False)`
|
|
||||||
|
|
||||||
## 0.2.0-rc.4
|
|
||||||
|
|
||||||
### lndl-nuitka
|
|
||||||
|
|
||||||
- 在 `lndl-nuitka` 中使用新添加的 `subprocess_to_bash` 函数展示命令
|
|
||||||
- 保证展示的命令可以直接运行
|
|
||||||
|
|
||||||
> 真的就是在刷版本号啊
|
|
||||||
|
|
||||||
## 0.2.0-rc.3
|
|
||||||
|
|
||||||
### lndl-nuitka
|
|
||||||
|
|
||||||
- 在 `arg_parser` 中添加了函数 `subprocess_to_bash`
|
|
||||||
- 用于将 `arg_parser` 中的参数转换为 `bash` 命令
|
|
||||||
- 理论上可以直接运行
|
|
||||||
|
|
||||||
## 0.2.0-rc.1/2
|
|
||||||
|
|
||||||
### lndl-nuitka
|
|
||||||
|
|
||||||
- 修复了一些细节问题 (反正我懒得统计具体内容了)
|
|
||||||
- 现在不会在没有给定附加参数的时候报 `invalid args:` 了
|
|
||||||
- 似乎没有别的细节了?
|
|
||||||
|
|
||||||
## 0.2.0-beta.2
|
## 0.2.0-beta.2
|
||||||
|
|
||||||
### lndl-nuitka
|
### lndl-nuitka
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
__version__ = '0.2.0-rc.9'
|
__version__ = '0.2.0-rc.1'
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
@ -10,10 +10,7 @@ import subprocess
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Dict, Union, List
|
from typing import Dict, Union, List
|
||||||
|
|
||||||
from lib_not_dr.nuitka.reader.arg_parser import (pyproject_toml,
|
from lib_not_dr.nuitka.reader.arg_parser import pyproject_toml, toml_path_cli, gen_subprocess_args
|
||||||
toml_path_cli,
|
|
||||||
gen_subprocess_args,
|
|
||||||
subprocess_to_bash)
|
|
||||||
|
|
||||||
support_config_dict = Dict[str, Union[str, bool, List[Union[str, tuple]]]]
|
support_config_dict = Dict[str, Union[str, bool, List[Union[str, tuple]]]]
|
||||||
|
|
||||||
@ -86,18 +83,18 @@ toml_loads = get_toml_reader()
|
|||||||
def display_config(subprocess_command: list) -> None:
|
def display_config(subprocess_command: list) -> None:
|
||||||
print(f"The config is:\n\033[34m{subprocess_command} \033[0m")
|
print(f"The config is:\n\033[34m{subprocess_command} \033[0m")
|
||||||
print("shell command is:\n\033[34m", end="")
|
print("shell command is:\n\033[34m", end="")
|
||||||
print(subprocess_to_bash(subprocess_command), '\033[0m')
|
print(" ".join(subprocess_command), '\033[0m')
|
||||||
print(f"Working Dir: \033[32m {Path().cwd().absolute()} \033[0m")
|
print(f"Working Dir: \033[32m {Path().cwd().absolute()} \033[0m")
|
||||||
|
|
||||||
|
|
||||||
def run_nuitka(subprocess_command: list) -> None:
|
def run_nuitka(subprocess_command: list) -> None:
|
||||||
start_time = time.time()
|
start_time = time.time()
|
||||||
subprocess.run(subprocess_command, shell=False, check=True)
|
subprocess.run(subprocess_command, shell=True)
|
||||||
end_time = time.time()
|
end_time = time.time()
|
||||||
print(f"Time Elapsed: {end_time - start_time} seconds")
|
print(f"Time Elapsed: {end_time - start_time} seconds")
|
||||||
|
|
||||||
|
|
||||||
def main(config: support_config_dict) -> list:
|
def main(config: support_config_dict) -> None:
|
||||||
"""
|
"""
|
||||||
enter point for python direct call
|
enter point for python direct call
|
||||||
:param config: nuitka config dict
|
:param config: nuitka config dict
|
||||||
@ -105,7 +102,7 @@ def main(config: support_config_dict) -> list:
|
|||||||
"""
|
"""
|
||||||
subprocess_command = gen_subprocess_args(config)
|
subprocess_command = gen_subprocess_args(config)
|
||||||
display_config(subprocess_command)
|
display_config(subprocess_command)
|
||||||
return subprocess_command
|
run_nuitka(subprocess_command)
|
||||||
|
|
||||||
|
|
||||||
def cli_main() -> None:
|
def cli_main() -> None:
|
||||||
|
@ -65,6 +65,7 @@ def get_cli_nuitka_args() -> dict:
|
|||||||
if len(sys.argv) < 2:
|
if len(sys.argv) < 2:
|
||||||
return {}
|
return {}
|
||||||
if '--' not in sys.argv:
|
if '--' not in sys.argv:
|
||||||
|
print(f"invalid args: {sys.argv}")
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
# start from --
|
# start from --
|
||||||
@ -165,12 +166,3 @@ def gen_subprocess_args(nuitka_config:
|
|||||||
continue
|
continue
|
||||||
|
|
||||||
return cmd_list
|
return cmd_list
|
||||||
|
|
||||||
|
|
||||||
def subprocess_to_bash(cmd_list: List[str]) -> str:
|
|
||||||
"""
|
|
||||||
:param cmd_list: list
|
|
||||||
:return: str
|
|
||||||
"""
|
|
||||||
cmd_list = [item if ' ' not in item else f'"{item}"' for item in cmd_list]
|
|
||||||
return " ".join(cmd_list)
|
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
"""
|
from lib_not_dr.nuitka.reader import cli_main
|
||||||
TMD 啊啊啊啊啊啊啊啊啊
|
|
||||||
这里不是用来直接调用的啊啊啊啊啊
|
if __name__ == '__main__':
|
||||||
"""
|
cli_main()
|
||||||
|
|
||||||
|
main = cli_main
|
||||||
|
@ -1,12 +0,0 @@
|
|||||||
# -------------------------------
|
|
||||||
# Difficult Rocket
|
|
||||||
# Copyright © 2020-2023 by shenjackyuanjie 3695888@qq.com
|
|
||||||
# All rights reserved
|
|
||||||
# -------------------------------
|
|
||||||
|
|
||||||
from lib_not_dr.nuitka.reader import cli_main
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
cli_main()
|
|
||||||
|
|
||||||
main = cli_main
|
|
Loading…
Reference in New Issue
Block a user