我为一些使用Ncurses的项目创建了Ncurses包。我使用conanfile.py进行配置。现在,我遇到的问题是,在Centos终端下是在/usr/lib中,而在基于Debian的系统中是在/lib中。
为此,我必须根据发行版的不同,在conanfile.py中设置一个参数:
.
.
.
settings = "os", "compiler", "build_type", "arch"
.
.
.
def build(self):
env_build = AutoToolsBuildEnvironment(self)
env_build.configure(configure_dir="src", build=False, host=False, target=False)
args = ["--without-debug"]
# if debian-based
args += ["--datadir=/lib"]
if self.options.shared:
args += ["--with-shared", "--without-normal"]
env_build.configure(configure_dir="src", args=args, build=False, host=False, target=False)
env_build.make()如何实现if语句# if debian-based?在这种情况下,最好的做法是什么?
发布于 2018-04-11 22:28:16
您可以使用OSInfo助手,它是uname和其他OS函数的包装器。在你的例子中,你会喜欢这样的东西:
from conans.tools import OSInfo
info = OSInfo()
if info.is_linux and info.linux_distro in ("debian", "ubuntu"):
# your logic herehttps://stackoverflow.com/questions/49780681
复制相似问题