Compare commits
8 Commits
249b77ba80
...
8df3458b2a
Author | SHA1 | Date | |
---|---|---|---|
8df3458b2a | |||
ef09e016a4 | |||
277b018662 | |||
8c05e04f4a | |||
43e02370d9 | |||
56cd9666b7 | |||
71a0945e0c | |||
76b6a8d0ab |
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.1
|
- Version / 版本: 0.2.0-rc.9
|
||||||
- Author / 作者: shenjackyuanjie <3695888@qq.com>
|
- Author / 作者: shenjackyuanjie <3695888@qq.com>
|
||||||
|
|
||||||
> [shenjackyuanjie](https://github.com/shenjackyuanjie)
|
> [shenjackyuanjie](https://github.com/shenjackyuanjie)
|
||||||
@ -75,6 +75,17 @@ 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,5 +1,36 @@
|
|||||||
# 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.1'
|
__version__ = '0.2.0-rc.9'
|
||||||
|
|
||||||
from typing import TYPE_CHECKING
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
@ -10,7 +10,10 @@ 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, 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]]]]
|
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:
|
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(" ".join(subprocess_command), '\033[0m')
|
print(subprocess_to_bash(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=True)
|
subprocess.run(subprocess_command, shell=False, check=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) -> None:
|
def main(config: support_config_dict) -> list:
|
||||||
"""
|
"""
|
||||||
enter point for python direct call
|
enter point for python direct call
|
||||||
:param config: nuitka config dict
|
:param config: nuitka config dict
|
||||||
@ -102,7 +105,7 @@ def main(config: support_config_dict) -> None:
|
|||||||
"""
|
"""
|
||||||
subprocess_command = gen_subprocess_args(config)
|
subprocess_command = gen_subprocess_args(config)
|
||||||
display_config(subprocess_command)
|
display_config(subprocess_command)
|
||||||
run_nuitka(subprocess_command)
|
return subprocess_command
|
||||||
|
|
||||||
|
|
||||||
def cli_main() -> None:
|
def cli_main() -> None:
|
||||||
|
@ -65,7 +65,6 @@ 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 --
|
||||||
@ -166,3 +165,12 @@ 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,9 +4,7 @@
|
|||||||
# All rights reserved
|
# All rights reserved
|
||||||
# -------------------------------
|
# -------------------------------
|
||||||
|
|
||||||
from lib_not_dr.nuitka.reader import cli_main
|
"""
|
||||||
|
TMD 啊啊啊啊啊啊啊啊啊
|
||||||
if __name__ == '__main__':
|
这里不是用来直接调用的啊啊啊啊啊
|
||||||
cli_main()
|
"""
|
||||||
|
|
||||||
main = cli_main
|
|
12
src/lndl_nuitka/__main__.py
Normal file
12
src/lndl_nuitka/__main__.py
Normal 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
|
Loading…
Reference in New Issue
Block a user