Close files before writing (#7101)

This commit is contained in:
Sebastien Loriot 2022-12-21 14:44:32 +01:00 committed by GitHub
commit e95a9d98df
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 1 deletions

View File

@ -74,7 +74,7 @@ jobs:
run: | run: |
set -x set -x
sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html sudo apt-get update && sudo apt-get install -y graphviz ssh bibtex2html
sudo pip install lxml sudo pip install lxml==4.6.3
sudo pip install pyquery sudo pip install pyquery
wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen wget --no-verbose -O doxygen_exe https://cgal.geometryfactory.com/~cgaltest/doxygen_1_8_13_patched/doxygen
sudo mv doxygen_exe /usr/bin/doxygen sudo mv doxygen_exe /usr/bin/doxygen

View File

@ -236,6 +236,7 @@ def automagically_number_figures():
d = pq(file_content.read(), parser="html") d = pq(file_content.read(), parser="html")
d('a.el').each( lambda i: update_figure_ref(i,global_anchor_map) ) d('a.el').each( lambda i: update_figure_ref(i,global_anchor_map) )
d('a.elRef').each( lambda i: update_figure_ref(i,global_anchor_map) ) d('a.elRef').each( lambda i: update_figure_ref(i,global_anchor_map) )
file_content.close()
write_out_html(d, fname) write_out_html(d, fname)
############################################################################### ###############################################################################
@ -278,6 +279,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
tr_tags.each(lambda i: rearrange_img(i, dir_name)) tr_tags.each(lambda i: rearrange_img(i, dir_name))
span_tags = d('table.directory tr span') span_tags = d('table.directory tr span')
span_tags.each(lambda i: rearrange_icon(i, dir_name)) span_tags.each(lambda i: rearrange_icon(i, dir_name))
file_content.close()
write_out_html(d,fn) write_out_html(d,fn)
class_files=list(package_glob('./*/class*.html')) class_files=list(package_glob('./*/class*.html'))
class_files.extend(package_glob('./*/struct*.html')) class_files.extend(package_glob('./*/struct*.html'))
@ -293,6 +295,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
ident = d('#nav-path .navelem').eq(0).children().eq(0) ident = d('#nav-path .navelem').eq(0).children().eq(0)
if ident and ident.attr('href') == 'namespaceCGAL.html': if ident and ident.attr('href') == 'namespaceCGAL.html':
ident.attr('href', '../Manual/namespaceCGAL.html') ident.attr('href', '../Manual/namespaceCGAL.html')
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
namespace_files=package_glob('./*/namespace*.html') namespace_files=package_glob('./*/namespace*.html')
@ -303,6 +306,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
if ident.size() == 1: if ident.size() == 1:
conceptify_ns(d); conceptify_ns(d);
d.remove("#CGALConceptNS") d.remove("#CGALConceptNS")
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
# in a group we only need to change the nested-classes # in a group we only need to change the nested-classes
@ -311,6 +315,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
file_content = codecs.open(fn, 'r', encoding='utf-8') file_content = codecs.open(fn, 'r', encoding='utf-8')
d = pq(file_content.read(), parser="html") d = pq(file_content.read(), parser="html")
conceptify_nested_classes(d) conceptify_nested_classes(d)
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
# fix up Files # fix up Files
@ -323,6 +328,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
if row_id != None: if row_id != None:
# figure out the rowid and then drop everything from the table that matches # figure out the rowid and then drop everything from the table that matches
table("tr").filter(lambda i: re.match(row_id + '*', pq(this).attr('id'))).remove() table("tr").filter(lambda i: re.match(row_id + '*', pq(this).attr('id'))).remove()
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
#Rewrite the code for index trees images #Rewrite the code for index trees images
@ -355,6 +361,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
# in hasModels.html, generalizes.html and refines.html, it is always Class. If this changes in # in hasModels.html, generalizes.html and refines.html, it is always Class. If this changes in
# future versions of doxygen, the regular expression will be ready # future versions of doxygen, the regular expression will be ready
dts.each(lambda i: pq(this).html(re.sub("((Class )|(Struct ))", "Concept ", pq(this).html()))) dts.each(lambda i: pq(this).html(re.sub("((Class )|(Struct ))", "Concept ", pq(this).html())))
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
# throw out nav-sync # throw out nav-sync
@ -364,6 +371,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
d = pq(file_content.read(), parser="html") d = pq(file_content.read(), parser="html")
d('#nav-sync').hide() d('#nav-sync').hide()
# TODO count figures # TODO count figures
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
# remove %CGAL in navtree: this should be a fix in doxygen but for now it does not worth it # remove %CGAL in navtree: this should be a fix in doxygen but for now it does not worth it
@ -390,6 +398,7 @@ removes some unneeded files, and performs minor repair on some glitches.''')
text = pq(el).text() text = pq(el).text()
if text[0:9]=="template<" and text.find('=')==-1: if text[0:9]=="template<" and text.find('=')==-1:
pq(el).remove() pq(el).remove()
file_content.close()
write_out_html(d, fn) write_out_html(d, fn)
#add a canonical link to all pages #add a canonical link to all pages