如何将stdin上的输入发送到Makefile中定义的python脚本?

如何将stdin上的输入发送到Makefile中定义的python脚本?,第1张

如何将stdin上的输入发送到Makefile中定义的python脚本?

对我来说,规避所有命令行引用问题的最简单方法是使用GNUmake

$(file)
函数将代码写入文件。您甚至可以
#
define
d变量中用作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)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5667614.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-16
下一篇 2022-12-16

发表评论

登录后才能评论

评论列表(0条)

保存