From 890be55de320532ed313fc8cd6b27038b8e56e4f Mon Sep 17 00:00:00 2001
From: Dilawar Singh <dilawars@ncbs.res.in>
Date: Thu, 1 Mar 2018 16:59:29 +0530
Subject: [PATCH] bdist_egg is more consistent on both RPM and DEB based
 systems.

---
 CMakeLists.txt            | 2 +-
 moose-core/CMakeLists.txt | 5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6968c32f..dbd13992 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -126,7 +126,7 @@ set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
 
 # Install pymoose. Use tar.gz in PYMOOSE_BUILD_DIR and unarchive it.
 # /usr is prefixed by bdist so we need to replace it.
-install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/usr/
+install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/egg/
     DESTINATION ${CMAKE_INSTALL_PREFIX}
     PATTERN ".git" EXCLUDE
     PATTERN "*.pyc" EXCLUDE
diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt
index 03c5542d..59bd2d49 100644
--- a/moose-core/CMakeLists.txt
+++ b/moose-core/CMakeLists.txt
@@ -460,9 +460,12 @@ if(NOT PYMOOSE_BDIST_DIR)
 endif( )
 
 # get platform and arch using python.
+# NOTE: creating bdist or bdist_dump uses /usr and /usr/local on rpm and deb
+# based unix respectively. Not a great situation to be in. We are using
+# bdist_egg and then copy everything from egg/. 
 find_package( PythonInterp REQUIRED)
 add_custom_target( bdist 
-    COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist -d ${PYMOOSE_BDIST_DIR}
+    COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_egg -d ${PYMOOSE_BDIST_DIR}
     WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
     COMMENT "Genearating bdist using setup.cmake.py." 
     VERBATIM
-- 
GitLab