Fix some bugs when dealing with non-existent or non-PEP files.
This commit is contained in:
parent
c91f1215e8
commit
34ec2ad36c
|
@ -340,7 +340,7 @@ def get_input_lines(inpath):
|
||||||
if e.errno <> errno.ENOENT: raise
|
if e.errno <> errno.ENOENT: raise
|
||||||
print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename
|
print >> sys.stderr, 'Error: Skipping missing PEP file:', e.filename
|
||||||
sys.stderr.flush()
|
sys.stderr.flush()
|
||||||
return None, None
|
return None
|
||||||
lines = infile.read().splitlines(1) # handles x-platform line endings
|
lines = infile.read().splitlines(1) # handles x-platform line endings
|
||||||
infile.close()
|
infile.close()
|
||||||
return lines
|
return lines
|
||||||
|
@ -355,6 +355,8 @@ def find_pep(pep_str):
|
||||||
|
|
||||||
def make_html(inpath, verbose=0):
|
def make_html(inpath, verbose=0):
|
||||||
input_lines = get_input_lines(inpath)
|
input_lines = get_input_lines(inpath)
|
||||||
|
if input_lines is None:
|
||||||
|
return None
|
||||||
pep_type = get_pep_type(input_lines)
|
pep_type = get_pep_type(input_lines)
|
||||||
if pep_type is None:
|
if pep_type is None:
|
||||||
print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath
|
print >> sys.stderr, 'Error: Input file %s is not a PEP.' % inpath
|
||||||
|
@ -507,8 +509,8 @@ def main(argv=None):
|
||||||
newfile = make_html(file, verbose=verbose)
|
newfile = make_html(file, verbose=verbose)
|
||||||
if newfile:
|
if newfile:
|
||||||
html.append(newfile)
|
html.append(newfile)
|
||||||
if browse and not update:
|
if browse and not update:
|
||||||
browse_file(pep)
|
browse_file(pep)
|
||||||
else:
|
else:
|
||||||
# do them all
|
# do them all
|
||||||
peptxt = []
|
peptxt = []
|
||||||
|
|
Loading…
Reference in New Issue