对我来说,规避所有命令行引用问题的最简单方法是使用GNUmake
$(file)函数将代码写入文件。您甚至可以
#在
defined变量中用作Python注释:
VERSION := $(shell bash --version)# With this, you can use any form of quotes inside your python predefine PYTHON_VERSION_CODE :=# -*- coding: iso-8859-15 -*-import re, sys;program_version = "${VERSION}"match = re.search("Copyright[^d]+(d+)", program_version);if match: if int( match.group(1) ) >= 2018: sys.stdout.write("1") else: sys.stdout.write( "match:" + match.group(1) )else: sys.stdout.write("0")endef$(file > test.py,$(PYTHON_VERSION_CODE))PYTHON_script_RESULTS := $(shell python test.py).PHONY: allall: @echo $(PYTHON_script_RESULTS)
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)