Skip to content

Commit dfe7803

Browse files
author
黄佰荣
committed
window环境的构建脚本
1 parent aa9e508 commit dfe7803

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

qpython-docs/add-analytics-windown.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import sys, os
2+
3+
with open(sys.argv[1], 'r', encoding='gbk') as f, \
4+
open('./qpydoc.tmp', 'w', encoding='gbk') as g, \
5+
open(os.path.dirname(os.path.abspath(__file__)) + '/extra.txt', 'r', encoding='gbk') as e:
6+
pth = sys.argv[1][1:]
7+
extra = "".join(e.readlines()).replace("{{PTH}}", pth)
8+
g.write('\n'.join(
9+
filter(lambda s: len(s),
10+
map(lambda s:
11+
('', extra + "<hr/>")[s == '<div role="contentinfo">'] + s,
12+
map(str.strip, f.readlines())))))
13+
os.rename('./qpydoc.tmp', sys.argv[1])

qpython-docs/add-analytics.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
import sys,os
2-
with open(sys.argv[1], 'r') as f, open('./qpydoc.tmp', 'wb') as g, open(os.path.dirname(os.path.abspath(__file__))+'/extra.txt','r') as e:
1+
import sys, os
2+
3+
with open(sys.argv[1], 'r', encoding='gbk') as f, \
4+
open('./qpydoc.tmp', 'w', encoding='gbk') as g, \
5+
open(os.path.dirname(os.path.abspath(__file__)) + '/extra.txt', 'r', encoding='gbk') as e:
36
pth = sys.argv[1][1:]
4-
extra = "".join(e.readlines()).replace("{{PTH}}",pth)
7+
extra = "".join(e.readlines()).replace("{{PTH}}", pth)
58
g.write('\n'.join(
69
filter(lambda s: len(s),
710
map(lambda s:
8-
('',extra+"<hr/>")[s=='<div role="contentinfo">']+s,
11+
('', extra + "<hr/>")[s == '<div role="contentinfo">'] + s,
912
map(str.strip, f.readlines())))))
10-
os.rename('./qpydoc.tmp', sys.argv[1])
13+
os.rename('./qpydoc.tmp', sys.argv[1])

0 commit comments

Comments
 (0)