mirror of
https://github.com/python/cpython.git
synced 2024-11-28 04:15:11 +08:00
use wfile api
This commit is contained in:
parent
cfc1cc2996
commit
0e1a5b49cf
@ -7,15 +7,19 @@ syntax of make rules.
|
||||
|
||||
In addition to the dependency syntax, #-comments are supported.
|
||||
"""
|
||||
import errno
|
||||
import os
|
||||
|
||||
def parse_config(repo):
|
||||
configfile = repo.wjoin(".hgtouch")
|
||||
if not os.path.exists(configfile):
|
||||
try:
|
||||
fp = repo.wfile(".hgtouch")
|
||||
except IOError, e:
|
||||
if e.errno != errno.ENOENT:
|
||||
raise
|
||||
return {}
|
||||
result = {}
|
||||
with open(configfile) as f:
|
||||
for line in f:
|
||||
with fp:
|
||||
for line in fp:
|
||||
# strip comments
|
||||
line = line.split('#')[0].strip()
|
||||
if ':' not in line:
|
||||
|
Loading…
Reference in New Issue
Block a user