我有一个主要用c ++编写的项目,其中包括一些用python编写的帮助脚本.目前,脚本包含由autotools替换的变量:
#!@PYTHON@
# -*- coding: utf-8 -*-
...
try:
datapath = os.environ['DATA_PATH']
except KeyError:
datapath = '@pkgdatadir@'
Run Code Online (Sandbox Code Playgroud)
这是Makefile.am的摘录:
BUILT_SOURCES = script.py
nodist_python_PYTHON = script.py
CLEANFILES = $(python_PYTHON)
EXTRA_DIST = script.py.in
do_subst = sed -e 's,[@]PYTHON[@],$(PYTHON),g'\
-e 's,[@]pkgdatadir[@],$(pkgdatadir),g'
script.py: script.py.in
$(do_subst) < $< > $@
chmod +x $@
Run Code Online (Sandbox Code Playgroud)
这些脚本还有一些模块依赖项,这些依赖项可能会由setup.py脚本更好地处理.
那么混合autotools和python distutils工具的最佳方法是什么?我应该完全依赖autotools吗?否则我如何在Makefile.am中集成setup.py的启动?