I created a Ncurses conan package for some projects where I use Ncurses. I use a conanfile.py for configuration. Now I have the problem that under Centos terminfo is in /usr/lib and under Debian-based system it is in /lib.
Therefor I have to set an argument in conanfile.py depending on the distribution:
.
.
.
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()
How can I implement the if statement # if debian-based
? What would be best practice in this case?
You can use the OSInfo helper, which is a wrapper around uname
and other OS functions. In your case you would like something like:
from conans.tools import OSInfo
info = OSInfo()
if info.is_linux and info.linux_distro in ("debian", "ubuntu"):
# your logic here