Compare commits

...

8 Commits

Author SHA1 Message Date
8df3458b2a
rc9 2023-11-25 23:43:20 +08:00
ef09e016a4
应该能行了? 2023-11-25 23:41:29 +08:00
277b018662
破防了啊啊啊啊啊 2023-11-25 22:19:29 +08:00
8c05e04f4a
bump rc4
aaaaaaaaaaaaaaa
2023-11-25 20:44:35 +08:00
43e02370d9
bump rc3
简直刷版本号
2023-11-25 20:40:22 +08:00
56cd9666b7
rc 2 readme 2023-11-25 20:29:37 +08:00
71a0945e0c
ready for rc2 2023-11-25 20:05:03 +08:00
76b6a8d0ab
add more bump 2023-11-25 19:02:11 +08:00
7 changed files with 77 additions and 14 deletions

View File

@ -6,7 +6,7 @@ A python lib came from [Difficult Rocket](https://github.com/shenjackyuanjie/Dif
## Information/信息
- Version / 版本: 0.2.0-rc.1
- Version / 版本: 0.2.0-rc.9
- Author / 作者: shenjackyuanjie <3695888@qq.com>
> [shenjackyuanjie](https://github.com/shenjackyuanjie)
@ -75,6 +75,17 @@ lndl_nuitka . -y
# run without confirmation
lndl_nuitka . -n
# 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

View File

@ -1,5 +1,36 @@
# 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
### lndl-nuitka

View File

@ -4,7 +4,7 @@
# All rights reserved
# -------------------------------
__version__ = '0.2.0-rc.1'
__version__ = '0.2.0-rc.9'
from typing import TYPE_CHECKING

View File

@ -10,7 +10,10 @@ import subprocess
from pathlib import Path
from typing import Dict, Union, List
from lib_not_dr.nuitka.reader.arg_parser import pyproject_toml, toml_path_cli, gen_subprocess_args
from lib_not_dr.nuitka.reader.arg_parser import (pyproject_toml,
toml_path_cli,
gen_subprocess_args,
subprocess_to_bash)
support_config_dict = Dict[str, Union[str, bool, List[Union[str, tuple]]]]
@ -83,18 +86,18 @@ toml_loads = get_toml_reader()
def display_config(subprocess_command: list) -> None:
print(f"The config is:\n\033[34m{subprocess_command} \033[0m")
print("shell command is:\n\033[34m", end="")
print(" ".join(subprocess_command), '\033[0m')
print(subprocess_to_bash(subprocess_command), '\033[0m')
print(f"Working Dir: \033[32m {Path().cwd().absolute()} \033[0m")
def run_nuitka(subprocess_command: list) -> None:
start_time = time.time()
subprocess.run(subprocess_command, shell=True)
subprocess.run(subprocess_command, shell=False, check=True)
end_time = time.time()
print(f"Time Elapsed: {end_time - start_time} seconds")
def main(config: support_config_dict) -> None:
def main(config: support_config_dict) -> list:
"""
enter point for python direct call
:param config: nuitka config dict
@ -102,7 +105,7 @@ def main(config: support_config_dict) -> None:
"""
subprocess_command = gen_subprocess_args(config)
display_config(subprocess_command)
run_nuitka(subprocess_command)
return subprocess_command
def cli_main() -> None:

View File

@ -65,7 +65,6 @@ def get_cli_nuitka_args() -> dict:
if len(sys.argv) < 2:
return {}
if '--' not in sys.argv:
print(f"invalid args: {sys.argv}")
return {}
# start from --
@ -166,3 +165,12 @@ def gen_subprocess_args(nuitka_config:
continue
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)

View File

@ -4,9 +4,7 @@
# All rights reserved
# -------------------------------
from lib_not_dr.nuitka.reader import cli_main
if __name__ == '__main__':
cli_main()
main = cli_main
"""
TMD 啊啊啊啊啊啊啊啊啊
这里不是用来直接调用的啊啊啊啊啊
"""

View File

@ -0,0 +1,12 @@
# -------------------------------
# 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