From 060bb15faaa68a6a60c7cb2d9992583b6153f74a Mon Sep 17 00:00:00 2001
From: Alexander van Amesfoort <amesfoort@astron.nl>
Date: Fri, 23 Oct 2015 22:16:07 +0000
Subject: [PATCH] Task #8651: ObservationStartListener: fix 'make install'
 error on systems with python 2.4. Ugly hack is deliberate: 1. I cannot afford
 to waste even more time on compat w/ ancient software installs and broken
 python version detection logic, and 2. as a protest against this terrible
 practice; let's fix the right problem.

---
 .../ObservationStartListener/CMakeLists.txt   | 20 ++++++++++++++-----
 1 file changed, 15 insertions(+), 5 deletions(-)

diff --git a/LCS/MessageDaemons/ObservationStartListener/CMakeLists.txt b/LCS/MessageDaemons/ObservationStartListener/CMakeLists.txt
index c0774c7b52b..9ab8da40832 100644
--- a/LCS/MessageDaemons/ObservationStartListener/CMakeLists.txt
+++ b/LCS/MessageDaemons/ObservationStartListener/CMakeLists.txt
@@ -3,9 +3,19 @@
 lofar_package(ObservationStartListener 1.0 DEPENDS MessageBus pyparameterset)
 
 include(LofarFindPackage)
-lofar_find_package(QPID)
-lofar_find_package(LibXMLxx)
+lofar_find_package(Python 2.6 REQUIRED)
 
-add_subdirectory(etc)
-add_subdirectory(src)
-add_subdirectory(test)
+# ! Python version detection fails on not so new systems. Best solution is an
+# ! ugly hack: No use wasting more of our time on compat w/ ancient software.
+# ! Python 2.4 is 10+ yrs old. Stop wasting time! Fix the real problem!!!
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import sys; sys.exit(not(sys.version_info[0] >= 2 and sys.version_info[1] >= 6 and sys.version_info[2] >= 0))" RESULT_VARIABLE py260_not_supp)
+if(NOT py260_not_supp)  # double negation also skips pkg if command fails
+  lofar_find_package(QPID)
+  lofar_find_package(LibXMLxx)
+
+  add_subdirectory(etc)
+  add_subdirectory(src)
+  add_subdirectory(test)
+else(NOT py260_not_supp)
+  message(WARNING "package ObservationStartListener skipped: found python is too old (or detection cmd failed)")
+endif(NOT py260_not_supp)
-- 
GitLab