Skip to content

Commit

Permalink
1.可以手动指定不编译的文件 2.update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
EVA-JianJun committed Nov 23, 2022
1 parent 98f68c6 commit 7cdf5ed
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
13 changes: 13 additions & 0 deletions AutoCython/AutoCython.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,19 @@ def compile_th(delete):
# 剔除不需要编译的路径
py_file_path_list = list(filter(lambda py_file_path : not any([exclude_path in py_file_path for exclude_path in self._exclude_path_list]), py_file_path_iter))

# 检查不编译的文件
tmp_py_file_path_list = []
for file_path in py_file_path_list:
with open(file_path, "r", encoding="utf-8") as fr:
line1 = fr.readline().strip()
line2 = fr.readline().strip()

if line1 == "# AucoCython No Compile" or line2 == "# AucoCython No Compile":
pass
else:
tmp_py_file_path_list.append(file_path)
py_file_path_list = tmp_py_file_path_list

self.compile_result = Container()
err_task_dict = dict()
task_index_dict = dict()
Expand Down
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,14 @@
import AutoCython
AutoCython().compile()

## 命令行

除了把 `AutoCython` 作为包导入外,`AutoCython` 也支持直接命令行进行编译:

与上面功能一样的命令行写法:

AutoCython -C D:/python_code/ProjectPath -E tmp.py;./ProjectPath/print_cy.py;./ProjectPath/data/tmp -M 8 -D bp

![AutoCython][2]

* **全自动**:自动编译当前目录下所有.py文件,支持指定目录编译或单文件编译;
Expand Down Expand Up @@ -136,16 +144,13 @@ AutoCython类接受4个参数,默认为:compile_path='.', exclude=[], mode='

所以错误处理你只需要按几个 `TAB` 就可以查看了,我觉得我这里已经写的够懒了!

## 命令行

除了把 `AutoCython` 作为包导入外,`AutoCython` 也支持直接命令行进行编译:
### 手动指定不编译

与上面功能一样的命令行写法:

AutoCython -C D:/python_code/ProjectPath -E tmp.py;./ProjectPath/print_cy.py;./ProjectPath/data/tmp -M 8 -D bp
在不需要编译的文件头两行任意一行写上 `# AucoCython No Compile` 则该文件会跳过编译.

## 更新记录
1.20220613 更新对Linux的支持,Linux下需要配置gcc&g++
2.20221123 可以通过文件头手动指定不编译的文件

![命令行][11]

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

setup(
name = 'AutoCython-jianjun',
version = '1.3.0',
version = '1.3.1',
author = 'jianjun',
author_email = '[email protected]',
url = 'https://github.com/EVA-JianJun/AutoCython',
Expand Down

0 comments on commit 7cdf5ed

Please sign in to comment.