Skip to content

Commit 7cdf5ed

Browse files
committed
1.可以手动指定不编译的文件 2.update README.md
1 parent 98f68c6 commit 7cdf5ed

File tree

3 files changed

+25
-7
lines changed

3 files changed

+25
-7
lines changed

AutoCython/AutoCython.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,19 @@ def compile_th(delete):
282282
# 剔除不需要编译的路径
283283
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))
284284

285+
# 检查不编译的文件
286+
tmp_py_file_path_list = []
287+
for file_path in py_file_path_list:
288+
with open(file_path, "r", encoding="utf-8") as fr:
289+
line1 = fr.readline().strip()
290+
line2 = fr.readline().strip()
291+
292+
if line1 == "# AucoCython No Compile" or line2 == "# AucoCython No Compile":
293+
pass
294+
else:
295+
tmp_py_file_path_list.append(file_path)
296+
py_file_path_list = tmp_py_file_path_list
297+
285298
self.compile_result = Container()
286299
err_task_dict = dict()
287300
task_index_dict = dict()

README.md

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,14 @@
1414
import AutoCython
1515
AutoCython().compile()
1616

17+
## 命令行
18+
19+
除了把 `AutoCython` 作为包导入外,`AutoCython` 也支持直接命令行进行编译:
20+
21+
与上面功能一样的命令行写法:
22+
23+
AutoCython -C D:/python_code/ProjectPath -E tmp.py;./ProjectPath/print_cy.py;./ProjectPath/data/tmp -M 8 -D bp
24+
1725
![AutoCython][2]
1826

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

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

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

143-
与上面功能一样的命令行写法:
144-
145-
AutoCython -C D:/python_code/ProjectPath -E tmp.py;./ProjectPath/print_cy.py;./ProjectPath/data/tmp -M 8 -D bp
149+
在不需要编译的文件头两行任意一行写上 `# AucoCython No Compile` 则该文件会跳过编译.
146150

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

150155
![命令行][11]
151156

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
setup(
99
name = 'AutoCython-jianjun',
10-
version = '1.3.0',
10+
version = '1.3.1',
1111
author = 'jianjun',
1212
author_email = '910667956@qq.com',
1313
url = 'https://github.com/EVA-JianJun/AutoCython',

0 commit comments

Comments
 (0)