Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit55ec85a

Browse files
vbwagnerVictorSpirin
authored andcommitted
Make genlist.py compatible with both 2 and 3 python and pylint-clean
1 parentea292b2 commit55ec85a

File tree

1 file changed

+37
-33
lines changed

1 file changed

+37
-33
lines changed

‎build/helpers/genlists.py

Lines changed: 37 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,58 @@
44
This script reads list of glob patterns from files, specified in the
55
command-line and generates lists of files for each pattern
66
"""
7-
importsys,fnmatch,os,os.path
7+
from __future__importprint_function
8+
importsys
9+
importfnmatch
10+
importos
11+
importos.path
812

13+
#pylint: disable=invalid-name
914
filelist_name=sys.argv.pop(1)
1015
ifos.path.isdir(filelist_name):
1116
# Generate filelist ourselves
1217
pwd=os.getcwd()
1318
os.chdir(filelist_name)
14-
filelist=set()
15-
fordirname,subdirlist,filesinos.walk("."):
16-
dirname=dirname.replace("\\","/")
19+
filelist=set()
20+
fordirname,subdirlist,filesinos.walk("."):
21+
dirname=dirname.replace("\\","/")
1722
forfinfiles:
18-
filelist.add(dirname+"/"+f)
23+
filelist.add(dirname+"/"+f)
1924
os.chdir(pwd)
2025
else:
21-
withopen(filelist_name,"r")asf:
22-
filelist=set(map(lambdax:x.strip(),f.readlines()))
23-
24-
formoduleinsys.argv[1:]:
25-
modname=module[:module.find(".")]
26-
print>>sys.stderr,"Processing module ",modname
27-
withopen(module,"r")asf:
28-
patterns=map(lambdax:x.strip(),f.readlines())
29-
forpinpatterns:
30-
ifp.startswith("./bin/")andnotp.endswith(".dll"):
31-
patterns.append("./share/locale/*/LC_MESSAGES/"+p[6:p.rfind(".")]+"*.mo")
32-
found=set()
33-
forpinpatterns:
26+
withopen(filelist_name,"r")asf:
27+
filelist=set(map(lambdax:x.strip(),f.readlines()))
28+
29+
formoduleinsys.argv[1:]:
30+
modname=module[:module.find(".")]
31+
print("Processing module ",modname,file=sys.stderr)
32+
withopen(module,"r")asf:
33+
patterns= [x.strip()forxinf.readlines()]
34+
forpinpatterns:
35+
ifp.startswith("./bin/")andnotp.endswith(".dll"):
36+
patterns.append("./share/locale/*/LC_MESSAGES/"+
37+
p[6:p.rfind(".")]+"*.mo")
38+
found=set()
39+
forpinpatterns:
3440
ifp.startswith("#"):
3541
continue
3642
forfinfilelist:
37-
iffnmatch.fnmatch(f,p):
43+
iffnmatch.fnmatch(f,p):
3844
found.add(f)
3945
filelist-=found
40-
withopen(modname+"_list.nsi","w")asout:
41-
curdir=""
46+
withopen(modname+"_list.nsi","w")asout:
47+
curdir=""
4248
forfinsorted(found):
43-
filedir=os.path.dirname(f)
44-
iffiledir!=curdir:
45-
print>>out,"SetOutPath $INSTDIR"+filedir[1:].replace("/","\\")
46-
curdir=filedir
47-
print>>out,"File ${PG_INS_SOURCE_DIR}"+f[1:].replace("/","\\")
49+
filedir=os.path.dirname(f)
50+
iffiledir!=curdir:
51+
print("SetOutPath $INSTDIR"+filedir[1:].replace("/","\\"),
52+
file=out)
53+
curdir=filedir
54+
print("File ${PG_INS_SOURCE_DIR}"+f[1:].replace("/","\\"),
55+
file=out)
4856

4957
# When all module files are processed:
50-
iflen(filelist):
51-
print>>sys.stderr,"Following unprocessed files found:\n",", ".join(sorted(filelist))
58+
iffilelist:
59+
print("Following unprocessed files found:\n",", ".join(sorted(filelist)),
60+
file=sys.stderr)
5261
sys.exit(1)
53-
54-
55-
56-
57-

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp