This makes building GiNaC a bit easier for users of "old" distributions
where python 3 is not installed by default (Ubuntu 16.04), or even not
available (CentOS 7).
Scripts themselves work just fine with python 2.7 and python 3.x, so
only minor changes to CMakeLists.txt are required (autotools scripts
already handle python2/3)
find_program(MAKEINFO makeinfo)
find_program(FIG2DEV fig2dev)
find_program(MAKEINFO makeinfo)
find_program(FIG2DEV fig2dev)
+find_program(PYTHON python)
+if (NOT PYTHON)
+ find_program(PYTHON python3)
+endif()
+if (NOT PYTHON)
+ message(FATAL_ERROR "Python version 3 or 2 is required")
+endif()
+
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DHAVE_CONFIG_H)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)
add_definitions(-DHAVE_CONFIG_H)
- GCC < 4.6.0 due to missing C++-11 support
If you install from git, you also need GNU autoconf (>=2.59), automake (>=1.8),
- GCC < 4.6.0 due to missing C++-11 support
If you install from git, you also need GNU autoconf (>=2.59), automake (>=1.8),
-libtool (>= 1.5), python3, bison (>= 2.3), flex (>= 2.5.33) to be installed.
+libtool (>= 1.5), python (version 2.7 or 3.x), bison (>= 2.3), flex (>= 2.5.33)
+to be installed.
add_custom_command(
OUTPUT ${_ind}
COMMAND ${MAKEINDEX_COMPILER} ${_idx}
add_custom_command(
OUTPUT ${_ind}
COMMAND ${MAKEINDEX_COMPILER} ${_idx}
- COMMAND python3 ${_fixupind} ${_idx}
+ COMMAND ${PYTHON} ${_fixupind} ${_idx}
WORKING_DIRECTORY ${_dirname}
DEPENDS ${texfile} ${_idx}
COMMENT "MAKEINDEX ${_basename}.idx")
WORKING_DIRECTORY ${_dirname}
DEPENDS ${texfile} ${_idx}
COMMENT "MAKEINDEX ${_basename}.idx")
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.h
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.h
- COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/function.hppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/function.cpp
- COMMAND python3 ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/function.py -o ${CMAKE_CURRENT_BINARY_DIR}/function.cpp ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/function.h ${CMAKE_CURRENT_SOURCE_DIR}/function.cppy ${CMAKE_CURRENT_SOURCE_DIR}/function.py)
# encoding: utf-8
maxargs = 14
# encoding: utf-8
maxargs = 14
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_fcn_help.h
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_fcn_help.h
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py -o ginsh_fcn_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py -o ginsh_fcn_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_op_help.h
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_fcn_help.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/ginsh_op_help.h
- COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py -o ginsh_op_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in
+ COMMAND ${PYTHON} ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py -o ginsh_op_help.h ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/ginsh.1.in ${CMAKE_CURRENT_SOURCE_DIR}/ginsh_op_help.py
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
# encoding: utf-8
# Convert help for ginsh functions from man page to C source
import sys, re, optparse
# encoding: utf-8
# Convert help for ginsh functions from man page to C source
import sys, re, optparse
# encoding: utf-8
# Convert help for ginsh operators from man page to C source
import sys, re, optparse
# encoding: utf-8
# Convert help for ginsh operators from man page to C source
import sys, re, optparse
# encoding: utf-8
# TeX Live 2012 seems to dislike files produces by doxygen (1.8.x.y)
# In particular, makeindex(1) program creates invalid index entries like
# encoding: utf-8
# TeX Live 2012 seems to dislike files produces by doxygen (1.8.x.y)
# In particular, makeindex(1) program creates invalid index entries like
def fixupind(fname):
""" Fix \\hyperpage{NNN_} entries in the ind file @var{fname} """
def fixupind(fname):
""" Fix \\hyperpage{NNN_} entries in the ind file @var{fname} """
- tmpout = fname + '.tmp'
+ tmpout = fname + '.tmp'
inp = open(fname)
out = open(tmpout, 'wt')
rx = re.compile('(hyperpage)[{]([0-9]+)[_][}]')
inp = open(fname)
out = open(tmpout, 'wt')
rx = re.compile('(hyperpage)[{]([0-9]+)[_][}]')
"""
Yet Another Python Templating Utility, Version 1.2, by Alex Martelli.
Distributed under PSF license (http://docs.python.org/license.html).
"""
Yet Another Python Templating Utility, Version 1.2, by Alex Martelli.
Distributed under PSF license (http://docs.python.org/license.html).