You are not logged in.
For a software project that relies on the numpy utility f2py, I want to have a Makefile that is compatible with both Arch Linux, where the default python is python3, and Ubuntu / Red Hat where the default python is python2.
This is a problem in case of the f2py utility, since f2py is for python3 or python2 depending on the Linux distribution.
The code below is usable, it looks for the command mkinitcpio, normally only available on Arch Linux.
But certainly there is a more fail safe and elegant way to detect the operating system.
Thanks for your help.
ARCH_LINUX := $(shell command -v mkinitcpio 2>/dev/null)
ifdef ARCH_LINUX
F2PY_py2 = f2py2
F2PY_py3 = f2py
else
F2PY_py2 = f2py
F2PY_py3 = f2py3
endifLast edited by PhilippD (2017-09-18 06:15:51)
Offline
I am not sure how to put it in a Makefile, but
grep -i "PRETTY_NAME=" /etc/os-release | cut -d'"' -f2Et voilà, elle arrive. La pièce, le sous, peut-être qu'il arrive avec vous!
Offline
Thanks!
ARCH_LINUX := $(shell grep "Arch Linux" /etc/os-release 2>/dev/null)Offline
Instead of trying to detect the OS, why not just try to detect what Python version is installed and act accordingly? That would make the most sense.
Matt
"It is very difficult to educate the educated."
Offline