mirror of https://github.com/CGAL/cgal
Merge pull request #4858 from sloriot/Doc-fix_filter_script_for_python3
Python 3 doc build compatibility
This commit is contained in:
commit
88a3aab077
|
|
@ -1,9 +1,3 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
if which python2 2>/dev/null >/dev/null; then
|
exec ${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1"
|
||||||
exec python2 ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1"
|
|
||||||
elif which python2.7 2>/dev/null >/dev/null; then
|
|
||||||
exec python2.7 ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1"
|
|
||||||
elif which python2.6 2>/dev/null >/dev/null; then
|
|
||||||
exec python2.6 ${CMAKE_BINARY_DIR}/pkglist_filter.py "$1"
|
|
||||||
fi
|
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,6 @@
|
||||||
@echo off
|
@echo off
|
||||||
|
|
||||||
@where /q python
|
|
||||||
if not errorlevel 1 ( set python=python )
|
|
||||||
|
|
||||||
@where /q python2
|
|
||||||
if not errorlevel 1 ( set python=python2 )
|
|
||||||
|
|
||||||
@where /q python2.6
|
|
||||||
if not errorlevel 1 ( set python=python2.6 )
|
|
||||||
|
|
||||||
@where /q python2.7
|
|
||||||
if not errorlevel 1 ( set python=python2.7 )
|
|
||||||
|
|
||||||
:go
|
:go
|
||||||
%python% ${CMAKE_BINARY_DIR}/pkglist_filter.py %1
|
${PYTHON_EXECUTABLE} ${CMAKE_BINARY_DIR}/pkglist_filter.py %1
|
||||||
|
|
||||||
@echo on
|
@echo on
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#!/usr/bin/env python2
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import codecs
|
import codecs
|
||||||
import re
|
import re
|
||||||
|
|
@ -28,10 +28,16 @@ def main(argv):
|
||||||
for l in pkgdesc:
|
for l in pkgdesc:
|
||||||
do_print = do_print or re.match(".*cgalPkgDescriptionBegin.*", l)
|
do_print = do_print or re.match(".*cgalPkgDescriptionBegin.*", l)
|
||||||
if(do_print):
|
if(do_print):
|
||||||
sys.stdout.write(l.encode('utf-8'))
|
if hasattr(sys.stdout, 'buffer'):
|
||||||
|
sys.stdout.buffer.write(l.encode('utf-8')) #python3
|
||||||
|
else:
|
||||||
|
sys.stdout.write(l.encode('utf-8')) #python2
|
||||||
do_print = do_print and (not re.match(".*cgalPkgDescriptionEnd.*", l))
|
do_print = do_print and (not re.match(".*cgalPkgDescriptionEnd.*", l))
|
||||||
else:
|
else:
|
||||||
sys.stdout.write(line.encode('utf-8'))
|
if hasattr(sys.stdout, 'buffer'):
|
||||||
|
sys.stdout.buffer.write(line.encode('utf-8')) #python3
|
||||||
|
else:
|
||||||
|
sys.stdout.write(line.encode('utf-8')) #python2
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main(sys.argv)
|
main(sys.argv)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue