ukoethe / vigra

a generic C++ library for image analysis
http://ukoethe.github.io/vigra/
Other
407 stars 191 forks source link

doc build error with python 3 - bad escape \i #472

Closed ametzler closed 4 years ago

ametzler commented 4 years ago

Hello,

1.11.1 fails to build with python3.7

Postprocessing html files
[...]
cd /tmp/VIGRA/libvigraimpex-1.11.1/obj/docsrc && /usr/bin/python3 /tmp/VIGRA/libvigraimpex-1.11.1/docsrc/post.py /tmp/VIGRA/libvigraimpex-1.11.1/doc/vigra 1.11.1
[...]
/tmp/VIGRA/libvigraimpex-1.11.1/doc/vigra/affine__registration__fft_8hxx_source.html
Traceback (most recent call last):
  File "/tmp/VIGRA/libvigraimpex-1.11.1/docsrc/post.py", line 186, in <module>
    processFile(file)
  File "/tmp/VIGRA/libvigraimpex-1.11.1/docsrc/post.py", line 170, in processFile
    if re.search('.*/index.html', fileName) or re.search('.*\\index.html', fileName):
  File "/usr/lib/python3.7/re.py", line 183, in search
    return _compile(pattern, flags).search(string)
  File "/usr/lib/python3.7/re.py", line 286, in _compile
    p = sre_compile.compile(pattern, flags)
  File "/usr/lib/python3.7/sre_compile.py", line 764, in compile
    p = sre_parse.parse(p, flags)
  File "/usr/lib/python3.7/sre_parse.py", line 924, in parse
    p = _parse_sub(source, pattern, flags & SRE_FLAG_VERBOSE, 0)
  File "/usr/lib/python3.7/sre_parse.py", line 420, in _parse_sub
    not nested and not items))
  File "/usr/lib/python3.7/sre_parse.py", line 501, in _parse
    code = _escape(source, this, state)
  File "/usr/lib/python3.7/sre_parse.py", line 402, in _escape
    raise source.error("bad escape %s" % escape, len(escape))
re.error: bad escape \i at position 2
make[5]: *** [docsrc/CMakeFiles/doc_cpp.dir/build.make:69: doc_cpp] Error 1

I am not a python guru but I think this one liner should fix the issue:

--- libvigraimpex-1.11.1+dfsg.orig/docsrc/post.py
+++ libvigraimpex-1.11.1+dfsg/docsrc/post.py
@@ -167,7 +167,7 @@ def processFile(fileName):

     text = insertVersion.sub(sys.argv[2], text)
     text = insertSTLLink.sub(r'http://www.sgi.com/tech/stl/', text)
-    if re.search('.*/index.html', fileName) or re.search('.*\\index.html', fileName):
+    if re.search('.*/index.html', fileName) or re.search(r'.*\\index.html', fileName):
         text = re.sub(r'<h3 (align="center"|class="version")>\d+\.\d+\.\d+ </h3>', '', text)
         text = indexPageHeading.sub(indexPageHeadingReplacement, text)

cu Andreas

hmeine commented 4 years ago

Thanks