diff --git a/.travis.yml b/.travis.yml
index 1a6d6efdb4424b0f968eec02155ea2adb15f7178..2f51ab7adc2766858e3019cd18ab902e1b066dee 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,23 +1,19 @@
-sudo : required
-
+sudo: required
+dist: trusty
+language: cpp
 compiler:
     - gcc
     - clang
+
 os:
     - linux
-    - osx
-
-allow_failure:
-    - osx
-
-osx_image : xcode8
 
 branches:
     only:
         - master
+        - chamcham
         - chennapoda
 
-
 notifications:
     email:
         recipients:
@@ -31,11 +27,27 @@ notifications:
 env:
     - CTEST_MODEL=Nightly
 
+cache: apt
 before_script:
-    - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./_travis/prepare_linux.sh ; fi
-    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./_travis/prepare_osx.sh ; fi
-
+    - sudo apt-get update -qq
+    - sudo apt-get install libxml2-dev libbz2-dev wget
+    - sudo apt-get install libhdf5-serial-dev
+    - sudo apt-get install python-numpy python-setuptools python-networkx python-pip
+    - sudo apt-get install cmake cdbs
+    - sudo apt-get install python-suds python-matplotlib python-nose
+    - sudo apt-get install python-qt4-dev python-qt4-gl python-sip-dev libqt4-dev libopenscenegraph-dev
+    - sudo apt-get install doxygen python-sphinx python-lxml
+    - sudo apt-get install git-buildpackage
+
+install:
+    - wget http://ftp.debian.org/debian/pool/main/g/gsl/libgsl0ldbl_1.16+dfsg-2_amd64.deb -O gsl_1.16.deb
+    - sudo dpkg -i gsl_1.16.deb
+    - wget http://ftp.debian.org/debian/pool/main/g/gsl/libgsl0-dev_1.16+dfsg-2_amd64.deb -O gsl_1.16-dev.deb
+    - sudo dpkg -i gsl_1.16-dev.deb
+    - sudo apt-get install -f
+    - sudo ldconfig /usr/lib64
 
 script:
-    - if [ "$TRAVIS_OS_NAME" == "linux" ]; then ./_travis/build_on_linux.sh ; fi
-    - if [ "$TRAVIS_OS_NAME" == "osx" ]; then ./_travis/build_on_osx.sh ; fi
+    - ./.travis_build.sh
+    - sudo dpkg -i ../moose*.deb 
+    - python -c 'import moose;print(moose.version());print(moose.__file__)'
diff --git a/.travis_build.sh b/.travis_build.sh
new file mode 100755
index 0000000000000000000000000000000000000000..8d92cd1fa250ecd35699aa86aef02bfce8b72c54
--- /dev/null
+++ b/.travis_build.sh
@@ -0,0 +1,24 @@
+#!/bin/bash -
+#===============================================================================
+#
+#          FILE: .travis_build.sh
+#
+#         USAGE: ./.travis_build.sh
+#
+#   DESCRIPTION: 
+#
+#       OPTIONS: ---
+#  REQUIREMENTS: ---
+#          BUGS: ---
+#         NOTES: ---
+#        AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in
+#  ORGANIZATION: NCBS Bangalore
+#       CREATED: 03/05/2018 03:49:35 PM
+#      REVISION:  ---
+#===============================================================================
+
+set -o nounset                                  # Treat unset variables as an error
+set -e -x
+PATH=/usr/bin:/usr/local/bin:$PATH
+gbp buildpackage  --git-ignore-branch --git-ignore-new -uc -us -d | tee _gbp.log
+pwd 
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6968c32f41fe9b6cad0f3944aba695070c6cf49b..8aa3696c931fe7e084ef721f81ae86852c3aa7e1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,7 +1,6 @@
-CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+cmake_minimum_required(VERSION 2.8)
 
 project(moose)
-
 if(POLICY CMP0048)
     cmake_policy(SET CMP0048 OLD )
 endif(POLICY CMP0048)
@@ -10,64 +9,44 @@ endif(POLICY CMP0048)
 # version file. If GIT fails, use the previous known version.
 find_program(GIT_EXEC "git")
 message( STATUS "Looking for git ${GIT_EXEC}" )
-if( (NOT MOOSE_VERSION) AND GIT_EXEC)
+if(VERSION_MOOSE)
+    message( STATUS "MOOSE version is set to ${VERSION_MOOSE} at build time" )
+elseif(GIT_EXEC)
+    message( STATUS "Getting version by reading git tags" )
     execute_process( 
         COMMAND ${GIT_EXEC} describe --tags --long
         WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
-        OUTPUT_VARIABLE MOOSE_VERSION
+        OUTPUT_VARIABLE VERSION_MOOSE
         OUTPUT_STRIP_TRAILING_WHITESPACE
     )
 endif( )
-message( STATUS "Building version ${MOOSE_VERSION}" )
-
-# Options to pass down to moose-core
-option(WITH_DOC "Build documentation" OFF)
-option(DEBUG "Build with DEBUG support" OFF)
-option(WITH_BOOST "Use Boost libraries instead of GSL" OFF)
-option(WITH_CUDA "Use CUDA/GPU" OFF)
-option(WITH_MPI "Use MPI (experimental)" OFF)
-option(WITH_GUI "Install moose-gui. Works only with python2." ON )
+message( STATUS "Building version ${VERSION_MOOSE}" )
 
+# Prefix
+message( STATUS "CMAKE_INSTALL_PREFIX= ${CMAKE_INSTALL_PREFIX}" )
 
-# On python3. Do not install GUI. 
+# Options to pass down to moose-core
+option(WITH_DOC   "Build documentation"                         OFF)
+option(DEBUG      "Build with DEBUG support"                    OFF)
+option(WITH_BOOST "Use Boost libraries instead of GSL"          OFF)
+option(WITH_CUDA  "Use CUDA/GPU"                                OFF)
+option(WITH_MPI   "Use MPI (experimental)"                      OFF)
+option(WITH_GUI   "Install moose-gui. Works only with python2." ON )
+
+# Required packages.
 find_package(PythonInterp REQUIRED)
 if(PYTHON_VERSION_MAJOR VERSION_EQUAL 3)
-    message(STATUS "moose-gui does not support python3 yet. Disabling" )
     set(WITH_GUI OFF)
 endif( )
 
-# On debian or ubuntu, --install-layout=deb needs to be passed.
-if(UNIX AND NOT APPLE)
-    find_program(LSB_RELEASE lsb_release)
-    if(LSB_RELEASE)
-        execute_process(COMMAND ${LSB_RELEASE} -is
-            OUTPUT_VARIABLE LSB_RELEASE_ID_SHORT
-            OUTPUT_STRIP_TRAILING_WHITESPACE
-            )
-        if(${LSB_RELEASE_ID_SHORT} STREQUAL "Ubuntu" 
-                OR ${LSB_RELEASE_ID_SHORT} STREQUAL "Debian" )
-            message(STATUS "Debian based LINUX: ${LSB_RELEASE_ID_SHORT}" )
-            set(CMAKE_PYMOOSE_ARGS "-DDISTUTILS_EXTRA_ARGS=\"--install-layout=deb\"" )
-        endif( )
-    endif( )
-endif( )
-
-
 add_custom_target(moose ALL)
 
-
+## intialize paths
 set(PYMOOSE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/moose-core")
 set(PYMOOSE_BUILD_DIR ${CMAKE_BINARY_DIR}/__moose-core_build)
-
-# NOTE: new setuptools does not install python module to this directory unless
-# installing into user_specified path, set PYTHONPATH to this directory. We now
-# create a bdist to this directory.
 set(PYMOOSE_INSTALL_DIR ${CMAKE_BINARY_DIR}/__moose-core_install)
 file(MAKE_DIRECTORY ${PYMOOSE_INSTALL_DIR})
 
-set(PYMOOSE_BDIST_DIR ${PYMOOSE_BUILD_DIR})
-message( STATUS "bdist directory PYMOOSE_BDIST_DIR ${PYMOOSE_BDIST_DIR}" )
-
 if(WITH_GUI)
     set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
     set(MOOSE_GUI_INSTALL_DIR ${CMAKE_BINARY_DIR}/__moose-gui_install)
@@ -82,23 +61,31 @@ file(MAKE_DIRECTORY ${PYMOOSE_BUILD_DIR})
 # different platform.
 set(OUTPUT_MOOSEBIN ${PYMOOSE_BUILD_DIR}/moose.bin)
 
-configure_file( ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in 
-    ${CMAKE_BINARY_DIR}/build_moose-core.sh )
-
-# Build pymoose module.
-add_custom_target( moose-core ALL DEPENDS ${OUTPUT_MOOSEBIN} )
+# NOTE: Do not use ExternalProject to build moose-core. There is no simple way
+# to export environment variable in ExrernalProject command  to subshell.
+# HDF_ROOT and GSL_ROOT etc variable are used by cmake of moose-core repo to
+# find appropriate libraries. Using ExternalProject is *most* likely to cause
+# build failure on OBS.
+configure_file( 
+    ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in 
+    ${PYMOOSE_BUILD_DIR}/build_moose-core.sh 
+    )
 
+# Build pymoose module, create bdist and  and unarchive the bdist to
+# PYMOOSE_INSTALL_DIR.
+add_custom_target( moose-core DEPENDS ${OUTPUT_MOOSEBIN} )
 add_custom_command( OUTPUT ${OUTPUT_MOOSEBIN}
-    COMMAND MAKE=$(MAKE) bash -c ${CMAKE_BINARY_DIR}/build_moose-core.sh
-    # Note that this command requires us to be in the same directory where we
-    # want to extract the tar file.
-    COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_INSTALL_DIR}
-        tar xvf ${PYMOOSE_BUILD_DIR}/pymoose-${MOOSE_VERSION}.*.tar.gz 
-    COMMENT "Building bdist and unarchiving it"
-    # VERBATIM ## WARN: Don't use VERBATIM here. The glob * in tar xvf will not
-    # work
+    COMMAND ${PYMOOSE_BUILD_DIR}/build_moose-core.sh
+    WORKING_DIRECTORY ${PYMOOSE_BUILD_DIR}
+    COMMENT "Building pymoose in ${PYMOOSE_BUILD_DIR}"
+    VERBATIM
+    )
+add_custom_command( TARGET moose-core POST_BUILD 
+    COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_INSTALL_DIR} tar xvf
+        ${PYMOOSE_BUILD_DIR}/bdist/pymoose-${VERSION}.CMAKE.tar.gz
+    COMMENT "Unarchiving pymoose bdist"
+    VERBATIM
     )
-add_dependencies(moose moose-core)
 
 if(WITH_GUI)
     # Now build moose-gui and moose-examples.
@@ -115,17 +102,17 @@ if(WITH_GUI)
         COMMAND ${PYTHON_EXECUTABLE} -m compileall -q ${MOOSE_EXAMPLE_INSTALL_DIR}
         VERBATIM
         )
+endif()
+
+add_dependencies(moose moose-core)
+
+if(WITH_GUI)
     add_dependencies(moose gui examples)
     add_dependencies(examples  gui)
 endif()
 
 
-# moose-gui
-# TODO: moose-gui should be a python module.
-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/
     DESTINATION ${CMAKE_INSTALL_PREFIX}
     PATTERN ".git" EXCLUDE
@@ -133,6 +120,8 @@ install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/usr/
     )
 
 if(WITH_GUI)
+    # moose-gui
+    set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
     install(DIRECTORY ${MOOSE_GUI_INSTALL_DIR}/
         DESTINATION lib/moose/gui
         PATTERN ".git*" EXCLUDE
@@ -146,49 +135,27 @@ if(WITH_GUI)
         PATTERN ".travis*" EXCLUDE
         PATTERN "*.pyc" EXCLUDE
         )
+
+    configure_file( ${CMAKE_SOURCE_DIR}/cmake/moosegui.in ${CMAKE_BINARY_DIR}/moosegui )
+
+    install(PROGRAMS ${CMAKE_BINARY_DIR}/moosegui DESTINATION bin)
 endif()
 
-configure_file( 
-    ${CMAKE_SOURCE_DIR}/cmake/moosegui.in
-    ${CMAKE_BINARY_DIR}/moosegui 
-    )
-install(PROGRAMS ${CMAKE_BINARY_DIR}/moosegui DESTINATION bin)
+## UNINSTALL
+add_custom_target(uninstall DEPENDS __uninstall_moose-core__ )
 
-# UNINSTALL
 add_custom_command(OUTPUT __uninstall_moose-core__
     COMMAND xargs rm -rf < install_manifest.txt
     COMMAND pip uninstall -y moose 
-    COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moose.bin
+    COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moosegui
     )
-add_custom_target(uninstall DEPENDS __uninstall_moose-core__ )
 
 if(WITH_GUI)
-    add_custom_command(OUTPUT  __uninstall_moose-gui__
+    add_custom_target( __uninstall_moose-gui__ )
+    add_custom_command(TARGET __uninstall_moose-gui__ 
         COMMAND ${CMAKE_COMMAND} -E remove_directory
         ${CMAKE_INSTALL_PREFIX}/lib/moose/gui
-        COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moose
+        COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_INSTALL_PREFIX}/bin/moosegui
         )
-    #add_dependencies( uninstall __uninstall_moose-gui__ )
+    add_dependencies( uninstall __uninstall_moose-gui__ )
 endif()
-
-################################################################################
-# CTEST 
-#################################################################################
-enable_testing( )
-add_test( NAME test_pymoose_sanity 
-    COMMAND ${PYTHON_EXECUTABLE} -c "import moose"
-    )
-
-set_tests_properties( test_pymoose_sanity 
-    PROPERTIES ENVIRONMENT "PYTHONPATH=${PYMOOSE_BUILD_DIR}/python"
-    )
-
-# # This test always fails when -X is not working which is usually the case on
-# # Travis and OBS.
-# if(WITH_GUI)
-#     add_test( NAME test_gui_sanity 
-#         COMMAND ${PYTHON_EXECUTABLE} ${MOOSE_GUI_INSTALL_DIR}/mgui.py 
-#         WORKING_DIRECTORY ${MOOSE_GUI_INSTALL_DIR}
-#         )
-# endif()
-
diff --git a/README.md b/README.md
index 6bba8cc1e06fcc534ca4c8041f1e7c731ec985fe..e3ccdefd2418ac04f3e36484554a38b0127f0ebf 100644
--- a/README.md
+++ b/README.md
@@ -3,8 +3,8 @@
 [__Document__](http://moose.readthedocs.io/en/latest/)
 
 This is the parent repository of [MOOSE simulator](https://moose.ncbs.res.in).
-It keeps the snanshots of its components: core (written in C++) and python 
-scripting interface, MOOSE's Graphical User Interface (GUI). This should be the 
+It keeps the snanshots of its components: c++ core and its Python 
+interface (pymoose), MOOSE's Graphical User Interface (GUI). This should be the 
 source of stable MOOSE code.
 
 # About
@@ -39,10 +39,10 @@ MOOSE Documentation can be found at https://moose.ncbs.res.in/?q=documentation .
 
 # VERSION
 
-## Chamcham 3.1.2
+## Chamcham Series
 
-MOOSE 3.1 (current version 3.1.2) is an evolutionary update. It has a new
-Python-based SBML reader , improved handling of reaction-diffusion systems, and
+Chamcham series (current version 3.1.3) is an evolutionary update. It has a new
+Python-based SBML reader, improved handling of reaction-diffusion systems, and
 substantial refinements to the rdesigneur interface for setting up multiscale
 models.  Several additional rdesigneur tutorials have been implemented. 
 
diff --git a/build_deb.sh b/build_deb.sh
new file mode 100755
index 0000000000000000000000000000000000000000..89734758a35e3ff32fad1cf4cff68e7db5ee93ab
--- /dev/null
+++ b/build_deb.sh
@@ -0,0 +1,21 @@
+#!/bin/bash -
+#===============================================================================
+#
+#          FILE: build_deb.sh
+#
+#         USAGE: ./build_deb.sh
+#
+#   DESCRIPTION: Generate DEBIAN package.
+#
+#       OPTIONS: ---
+#  REQUIREMENTS: ---
+#          BUGS: ---
+#         NOTES: ---
+#        AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in
+#  ORGANIZATION: NCBS Bangalore
+#       CREATED: Wednesday 07 March 2018 10:02:28  IST
+#      REVISION:  ---
+#===============================================================================
+
+set -o nounset                                  # Treat unset variables as an error
+gbp buildpackage  --git-ignore-branch --git-ignore-new -uc -us -d | tee _gbp.log
diff --git a/build_rpm.sh b/build_rpm.sh
new file mode 100755
index 0000000000000000000000000000000000000000..a5e826649d3cd0ffbacc31231fc041dd25f04be8
--- /dev/null
+++ b/build_rpm.sh
@@ -0,0 +1,22 @@
+#!/bin/bash -
+#===============================================================================
+#
+#          FILE: build_rpm.sh
+#
+#         USAGE: ./build_rpm.sh
+#
+#   DESCRIPTION: Generate RPM package.
+#
+#       OPTIONS: ---
+#  REQUIREMENTS: ---
+#          BUGS: ---
+#         NOTES: ---
+#        AUTHOR: Dilawar Singh (), dilawars@ncbs.res.in
+#  ORGANIZATION: NCBS Bangalore
+#       CREATED: Wednesday 07 March 2018 10:02:28  IST
+#      REVISION:  ---
+#===============================================================================
+
+set -o nounset                                  # Treat unset variables as an error
+gbp buildpackage-rpm  --git-ignore-branch --git-ignore-new -uc -us -d  \
+    --git-spec-file=./rmp/moose.spec | tee _rpm.log
diff --git a/cmake/build_moose-core.sh.in b/cmake/build_moose-core.sh.in
index 8ae7a5b37b4eda363b189c951bf05bc7f28c474e..5e6530c5b35a38ff4c39c05d737da0b0e685debc 100755
--- a/cmake/build_moose-core.sh.in
+++ b/cmake/build_moose-core.sh.in
@@ -7,10 +7,6 @@ set -e
 # will play well with cmake. CMAKE replaces @FOO@ and ${FOO} with cmake variable
 # values.
 
-if [ -z "$MAKE" ]; then
-    MAKE=make
-fi
-
 echo "Building pymoose and creating bdist."
 export GSL_ROOT_DIR=@GSL_ROOT_DIR@
 export HDF5_ROOT=@HDF5_ROOT@
@@ -19,10 +15,10 @@ cmake -DCMAKE_INSTALL_PREFIX=@PYMOOSE_INSTALL_DIR@ \
     -DCMAKE_BUILD_TYPE=Release \
     -DWITH_BOOST=@WITH_BOOST@ \
     -DPYTHON_EXECUTABLE=@PYTHON_EXECUTABLE@ \
-    -DVERSION_MOOSE=@MOOSE_VERSION@ \
-    -DPYMOOSE_BDIST_DIR=@PYMOOSE_BDIST_DIR@ \
+    -DVERSION_MOOSE=@VERSION_MOOSE@ \
     @CMAKE_PYMOOSE_ARGS@ \
     @PYMOOSE_SOURCE_DIR@ 
-$MAKE
+
+make -j3
 ctest --output-on-failure || echo "Some tests failed"
-$MAKE bdist VERBOSE=1
+make bdist 
diff --git a/debian/changelog b/debian/changelog
index c0c7780432af2bfb26002bb751fff79cceaec304..bd52b2950921cc03ea6ee5dc7099e67dad7765d0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,15 +1,18 @@
-moose (3.2.git) UNRELEASED; urgency=medium
+moose (3.1.3ubuntu1) experimental; urgency=medium
 
-    * Nightly build. 
+  * Version bumped.
 
- -- Dilawar Singh <dilawars@ncbs.res.in>  Sat, 16 Dec 2017 10:17:08 +0530
+ -- Dilawar Singh <dilawars@ncbs.res.in>  Thu, 01 Feb 2018 12:26:15 +0530
 
-moose (3.0.2) unstable; urgency=low
+moose (3.1.2) unstable; urgency=medium
 
-  * Initial release 
-  * Feature-freeze release.
-  * trunk series. Experimental branch.
-  * 3.0.2 relase.
-  * Just packed with SBML and GSL-1.6 support.
+  * Chamcham release (3.1.x) series.
 
- -- Dilawar Singh <dilawars@ncbs.res.in>  Sun, 05 Jul 2015 13:41:58 +0530
+ -- Dilawar Singh <dilawars@ncbs.res.in>  Mon, 08 May 2017 13:43:42 +0530
+
+moose (3.1.2) unstable; urgency=low
+
+  * Bugfixes over 3.1.1
+  * Enhanced rdesigneur interface.
+
+ -- Dilawar <dilawars@ncbs.res.in>  Sat, 22 Apr 2017 13:41:58 +0530
diff --git a/debian/control b/debian/control
index a0a1af49bb3ceb8e0ac7ff82d34190d01d130380..aa3360cbab2afdf31f6ff181e201e9ec663624f1 100644
--- a/debian/control
+++ b/debian/control
@@ -8,7 +8,7 @@ Homepage: http://moose.ncbs.res.in
 
 Package: moose
 Architecture: any
-Depends: ${shlibs:Depends},python-numpy-abi9, libhdf5-7 | libhdf5-serial-1.8.4, python-lxml, python-numpy, python-matplotlib, python-networkx, python-qt4, libgsl0ldbl
+Depends: ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}
 Description: the Multiscale Object-Oriented Simulation Environment
  It is the base and numerical core for large, detailed simulations including Computational Neuroscience and Systems Biology.
  .
diff --git a/debian/install b/debian/install
index f3eed99f2351a925e2a381f52d1dff583b5b1979..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644
--- a/debian/install
+++ b/debian/install
@@ -1,3 +0,0 @@
-usr/lib/moose
-usr/lib/python*
-usr/bin/moosegui
diff --git a/debian/rules b/debian/rules
index b9f79dc0cd7a928b5f2ac09e7e1742a20df7bc4d..5967cc8de394431aa56450beed10571c916bdddd 100755
--- a/debian/rules
+++ b/debian/rules
@@ -1,31 +1,15 @@
 #!/usr/bin/make -f
 
-# export DH_VERBOSE=1
+export MAKEOPTS=-j5
 
-## Here goes the debian make.
+export DH_VERBOSE=1
 
 %:
-	dh "$@" 
+	dh "$@" --buildsystem=cmake --with-python2
 
-# Override clean target.
-override_dh_auto_clean:
-	rm -rf $(BUILD_DIR_MOOSE)
-
-# consider using -DUSE_VERSIONED_DIR=ON if backporting
 override_dh_auto_configure:
-	cmake -DCMAKE_INSTALL_PREFIX=debian/tmp/usr -DCMAKE_VERSION=3.2.git
-
-override_dh_auto_build:
-	make VERBOSE=0 -j`nproc`
-
-override_dh_auto_install:
-	make install
-
-override_dh_auto_test:
-	echo "Nothing to do here"
-
-override_dh_shlibdeps:
-	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
+	dh_auto_configure -- -DVERSION_MOOSE=3.1.3 -DCMAKE_SKIP_RPATH=ON
 
 override_dh_python2:
-	dh_python2 --no-guessing-versions
+	dh_numpy
+	dh_python2
diff --git a/moose-core/.travis.yml b/moose-core/.travis.yml
index d1de05b822fc17bd41eb64d523a7a150ee23d96b..294e0896243791f983832cc2272705c819a76702 100644
--- a/moose-core/.travis.yml
+++ b/moose-core/.travis.yml
@@ -2,8 +2,6 @@ language: cpp
 sudo: required
 group: edge
 
-services: 
-    - docker
 
 os:
 - linux
@@ -17,6 +15,13 @@ notifications:
     on_success: change
     on_failure: always
 
+before_script:
+- echo "OSX related"
+- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi
+- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_prepare_osx.sh; fi
+- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh; fi
+
+
 before_script:
 - echo "OSX related"
 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then nvm get head || true; fi
@@ -24,8 +29,8 @@ before_script:
 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo ./.travis/travis_prepare_linux.sh;
   fi
 script:
-- 
-- python2 -m compileall -q .
+
+- python2 -m compileall -q . || echo "Python2 not found"
 - if type python3 > /dev/null; then python3 -m compileall -q . ; fi
 - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then ./.travis/travis_build_osx.sh; fi
 - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then ./.travis/travis_build_linux.sh; fi
diff --git a/moose-core/.travis/travis_build_linux.sh b/moose-core/.travis/travis_build_linux.sh
index 83cce12028721c2bf551f2b6b9579761237c1663..e475b2e0bf622b47ac46a08f0b14eaa308c08b03 100755
--- a/moose-core/.travis/travis_build_linux.sh
+++ b/moose-core/.travis/travis_build_linux.sh
@@ -1,4 +1,5 @@
 #!/usr/bin/env bash
+
 #===============================================================================
 #
 #          FILE: travis_build_linux.sh
@@ -17,44 +18,58 @@
 #      REVISION:  ---
 #===============================================================================
 
-set -o nounset                              # Treat unset variables as an error
-set -e
+set -e -x
 
 PYTHON2="/usr/bin/python2"
 PYTHON3="/usr/bin/python3"
-MAKEFLAGS="-j4"
+MAKEFLAGS="-j`nproc`"
+
+
+if [ ! -n "$MAKE" ]; then
+    MAKE="make -j`nproc`"
+else
+    MAKE="$MAKE -j`nproc`"
+fi
+
+unset PYTHONPATH
 
 # Bug: `which python` returns /opt/bin/python* etc on travis. For which numpy
 # many not be available. Therefore, it is neccessary to use fixed path for
 # python executable.
 
+$PYTHON2 -m compileall -q .
+if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi
+
+echo "Currently in `pwd`"
 (
-    $PYTHON2 -m compileall -q .
-    if type $PYTHON3 > /dev/null; then $PYTHON3 -m compileall -q . ; fi
+    mkdir -p _GSL_BUILD && cd _GSL_BUILD 
+    cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
+    $MAKE && ctest --output-on-failure
+)
 
-    mkdir -p _GSL_BUILD && cd _GSL_BUILD && \
-        cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
-    make && ctest --output-on-failure
-    cd .. # Now with boost.
+(
+    # Now with boost.
     mkdir -p _BOOST_BUILD && cd _BOOST_BUILD && \
         cmake -DWITH_BOOST=ON -DDEBUG=ON -DQUIET_MODE=ON -DPYTHON_EXECUTABLE="$PYTHON2" ..
-    make && ctest --output-on-failure
-    cd ..
-
-    # This is only applicable on linux build.
-    echo "Python3: Removed python2-networkx and install python3"
-    if type $PYTHON3 > /dev/null; then
-        sudo apt-get remove -qq python-networkx
-        sudo apt-get install -qq python3-networkx
+    $MAKE && ctest --output-on-failure
+)
+
+# This is only applicable on linux build.
+echo "Python3: Removed python2-networkx and install python3"
+if type $PYTHON3 > /dev/null; then
+    sudo apt-get remove -qq python-networkx
+    sudo apt-get install -qq python3-networkx
+    (
         mkdir -p _GSL_BUILD2 && cd _GSL_BUILD2 && \
             cmake -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON3" ..
-        make && ctest --output-on-failure
-        cd .. # Now with BOOST and python3
+        $MAKE && ctest --output-on-failure
+    )
+    (
         mkdir -p _BOOST_BUILD2 && cd _BOOST_BUILD2 && \
             cmake -DWITH_BOOST=ON -DDEBUG=ON -DPYTHON_EXECUTABLE="$PYTHON3" ..
-        make && ctest --output-on-failure
-        cd .. && echo "All done"
-    else
-        echo "Python3 is not found. Build disabled"
-    fi
-)
+        $MAKE && ctest --output-on-failure
+    )
+    echo "All done"
+else
+    echo "Python3 is not found. Build disabled"
+fi
diff --git a/moose-core/.travis/travis_build_osx.sh b/moose-core/.travis/travis_build_osx.sh
index 44ff04c8ab44657ef88f2960fb971726853bd043..0b446a202543a7f70409f51397ab44c10a172f7f 100755
--- a/moose-core/.travis/travis_build_osx.sh
+++ b/moose-core/.travis/travis_build_osx.sh
@@ -21,19 +21,23 @@ set -o nounset                              # Treat unset variables as an error
 set -e
 
 (
+
+    # Make sure not to pick up python from /opt.
+    PATH=/usr/bin:/usr/local/bin:$PATH
     mkdir -p _GSL_BUILD && cd _GSL_BUILD \
         && cmake -DQUIET_MODE=ON -DDEBUG=ON \
         -DPYTHON_EXECUTABLE=`which python` ..
-    make && ctest --output-on-failure
+    make -j3 && ctest --output-on-failure
+
     cd .. # Now with boost.
     mkdir -p _BOOST_BUILD && cd _BOOST_BUILD \
         && cmake -DWITH_BOOST=ON -DDEBUG=ON \
         -DPYTHON_EXECUTABLE=`which python` ..
-    make && ctest --output-on-failure
+
+    make -j3 && ctest --output-on-failure
     cd ..
+    set +e
 
-    # Now test the brew formula
-    cd ~
-    brew tap BhallaLab/moose
-    brew install moose
 )
+set +e
+
diff --git a/moose-core/.travis/travis_prepare_linux.sh b/moose-core/.travis/travis_prepare_linux.sh
index f2110440121110a95f0ad3f64c60ffb78ac6864c..484f1a4ec09e5b4ac3f4a4e3b778a5529746d00f 100755
--- a/moose-core/.travis/travis_prepare_linux.sh
+++ b/moose-core/.travis/travis_prepare_linux.sh
@@ -30,6 +30,6 @@ apt-get install -qq libgsl0-dev
 apt-get install -qq python-pip python3-pip
 apt-get install -qq libgraphviz-dev
 
-# Dependencies for NML2 
+# Dependencies for NML2
 apt-get install -qq python-scipy python3-scipy
-pip install pyNeuroML libNeuroML 
+#pip install pyNeuroML libNeuroML
diff --git a/moose-core/.travis/travis_prepare_osx.sh b/moose-core/.travis/travis_prepare_osx.sh
index 8c95810b76ce59ea217537a933b1bbd471b63f27..65bff743617d0883dddf034c8cc7b7e17fcae747 100755
--- a/moose-core/.travis/travis_prepare_osx.sh
+++ b/moose-core/.travis/travis_prepare_osx.sh
@@ -26,14 +26,19 @@ brew install gsl
 brew install hdf5
 brew install python
 brew install numpy
+brew install boost
+
 #brew outdated python || brew install python
 #brew outdated numpy || brew install homebrew/python/numpy
 brew unlink numpy && brew link numpy || echo "Failed to link numpy"
 # Numpy caveats
 mkdir -p $HOME/Library/Python/2.7/lib/python/site-packages
 echo 'import sys; sys.path.insert(1, "/usr/local/lib/python2.7/site-packages")' >> $HOME/Library/Python/2.7/lib/python/site-packages/homebrew.pth
+
+# To make sure that we do not pick python from /opt etc.
+PATH=/usr/local/bin:/usr/bin:$PATH
 # ensurepip
-#python -m ensurepip
-pip2 install matplotlib --user
-pip2 install pyNeuroML libNeuroML --user
-pip2 install scipy --user
+python -m ensurepip
+python -m pip install matplotlib --user
+python -m pip install pyNeuroML libNeuroML --user
+python -m pip install scipy --user
diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt
index fbfb5bec3057e51907cf1cdee021c6146ca935d8..20588f7afb1c2e0a4c805746b412dfdf21c332d0 100644
--- a/moose-core/CMakeLists.txt
+++ b/moose-core/CMakeLists.txt
@@ -1,7 +1,8 @@
 set(CMAKE_LEGACY_CYGWIN_WIN32 0)
 cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
 
-project(moose-core)
+
+project(pymoose)
 
 if(COMMAND cmake_policy)
     cmake_policy(SET CMP0003 NEW)
@@ -12,7 +13,7 @@ if(COMMAND cmake_policy)
 endif(COMMAND cmake_policy)
 
 
-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake_modules")
+set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules")
 include(CheckCXXCompiler.cmake)
 include(CheckIncludeFileCXX)
 include(FindPkgConfig)
@@ -20,24 +21,29 @@ include(FindPkgConfig)
 # getgit revision number
 find_program( GIT_EXEC git )
 if(GIT_EXEC)
-    execute_process(COMMAND ${GIT_EXEC} rev-parse --short HEAD 
+    execute_process(
+        COMMAND ${GIT_EXEC} rev-parse --short HEAD
         OUTPUT_VARIABLE GIT_HEAD
         OUTPUT_STRIP_TRAILING_WHITESPACE
-        )
+    )
+else(GIT_EXEC)
+    set(GIT_HEAD 'HEAD')
+    message(STATUS "Couldn't fetch version from git repo" )
 endif()
 
 # If from command line, version info is not passed, use the git to generate a
 # version file. If GIT fails, use the previous known version.
 if(NOT VERSION_MOOSE)
     set(VERSION_MOOSE "3.2.0-${GIT_HEAD}")
-endif( )
+endif()
+
 add_definitions( -DMOOSE_VERSION="${VERSION_MOOSE}")
 message( STATUS "MOOSE Version ${VERSION_MOOSE}" )
 
 # Write VERSION to a file VERSION so that setup.cmake.py can use it.
 set(VERSION_FILE ${CMAKE_CURRENT_SOURCE_DIR}/python/VERSION)
-message(STATUS "+ Writing ${VERSION_MOOSE} to ${VERSION_FILE}" )
 file(WRITE ${VERSION_FILE} ${VERSION_MOOSE} )
+message(STATUS "| Writing ${VERSION_MOOSE} to ${VERSION_FILE}" )
 
 # This snippet is from LLVM project.
 # Sanity check our source directory to make sure that we are not trying to
@@ -121,10 +127,7 @@ endif()
 ################################### TARGETS ####################################
 
 add_library(libmoose SHARED basecode/main.cpp)
-
-if(DEBUG)
-    add_executable(moose.bin basecode/main.cpp)
-endif( )
+add_executable(moose.bin basecode/main.cpp)
 
 ################################### SETUP BUILD ################################
 
@@ -373,61 +376,98 @@ ELSE(MACOSX)
         )
 endif(MACOSX)
 
-if(DEBUG)
-    add_dependencies(moose.bin libmoose)
-    target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS})
-    if( WITH_BOOST )
-        target_link_libraries( moose.bin ${Boost_LIBRARIES} )
-    endif( WITH_BOOST )
-endif()
+add_dependencies(moose.bin libmoose)
+target_link_libraries(moose.bin moose ${CMAKE_DL_LIBS})
+if( WITH_BOOST )
+    target_link_libraries( moose.bin ${Boost_LIBRARIES} )
+endif( WITH_BOOST )
 
 
 ######################### BUILD PYMOOSE ########################################
+# This target is built by pymoose/CMakeLists.txt file.
 add_subdirectory( pymoose )
 
-######################### INSTALL ##############################################
-
-if(DEBUG)
-    install(TARGETS moose.bin
-        DESTINATION bin
-        )
-
-    install(TARGETS libmoose
-        DESTINATION lib
-        )
-
-    install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
-        DESTINATION bin
-        )
-endif( )
-
-# INSTALL python module.
-# This target is built by pymoose/CMakeLists.txt file. Using the --prefix option
 # always override debian default installation directory. It will be installed in
 # site-packages instead of dist-packages.
 # See https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/362570
 # HACK: Get platform information from python and use it to fix the layout.
-execute_process(
-    COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc
+execute_process(COMMAND ${PYTHON_EXECUTABLE} -mplatform OUTPUT_VARIABLE _platform_desc)
+message(STATUS "Platform: ${_platform_desc}")
+
+# DISTUTILS_EXTRA_ARGS may come of top-level cmake script. On DEBIAN/UBUNTU, it
+# is most likely to be --install-layout=deb .
+set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX} ${DISTUTILS_EXTRA_ARGS}")
+
+# On Debian/Ubuntu install using debian layout.
+# NOTE: Also create setup.cfg file which setup prefix and install-layout
+# suitable for DEBIAN systems.
+if(${_platform_desc} MATCHES ".*(Ubuntu|Debian).*")
+    list(APPEND EXTRA_ARGS "--install-layout=deb")
+    file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg
+         "[install]\nprefix=/usr\ninstall-layout=deb"
+       )
+endif()
+
+# Set PYMOOSE binary distribution build and install directories.
+# Target for creating bdist. This is handy for creating bdist for packaging.
+# Save the binary distribution (tar.gz) to PYMOOSE_BDIST_DIR.
+find_package(PythonInterp REQUIRED)
+if(NOT PYMOOSE_BDIST_DIR)
+    set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/bdist)
+endif( )
+
+# If no one hsa set the PYMOOSE bdist installation directory, use default.
+if(NOT PYMOOSE_BDIST_INSTALL_DIR)
+    set(PYMOOSE_BDIST_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR}/pymoose_bdist_install)
+endif()
+file(MAKE_DIRECTORY ${PYMOOSE_BDIST_INSTALL_DIR})
+
+# We need a custom name for bdist; same on all platform.
+set(_platform "CMAKE" )
+set(PYMOOSE_BDIST_FILE ${PYMOOSE_BDIST_DIR}/pymoose-${VERSION_MOOSE}.${_platform}.tar.gz)
+message(STATUS "binary distribution file ${PYMOOSE_BDIST_FILE}")
+add_custom_target(bdist ALL DEPENDS  ${PYMOOSE_BDIST_FILE} )
+
+# Any command using setup.cmake.py must run in the same directory.
+add_custom_command( OUTPUT ${PYMOOSE_BDIST_FILE}
+    COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_dumb -p ${_platform} 
+        -d ${PYMOOSE_BDIST_DIR}
+    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
+    COMMENT "bdist is saved to ${PYMOOSE_BDIST_DIR}"
+    VERBATIM
+    )
+add_custom_command(TARGET bdist POST_BUILD
+    COMMAND ${CMAKE_COMMAND} -E chdir ${PYMOOSE_BDIST_INSTALL_DIR} tar xvf ${PYMOOSE_BDIST_FILE}
+    COMMENT "Unarchiving bdist file ${PYMOOSE_BDIST_FILE} to ${PYMOOSE_BDIST_INSTALL_DIR}"
+    VERBATIM
     )
-message( STATUS "Platform ${_platform_desc}" )
 
+# Copy python files from source to current binary directory. Make sure to call
+# this before building bdist.
+file(GLOB_RECURSE PYTHON_SRCS "${CMAKE_SOURCE_DIR}/python/*")
+add_custom_target(copy_pymoose DEPENDS ${PYTHON_SRCS}
+    COMMAND ${CMAKE_COMMAND} -E copy_directory
+        ${CMAKE_CURRENT_SOURCE_DIR}/python ${CMAKE_CURRENT_BINARY_DIR}/python
+    COMMENT "Copying required python files and other files to build directory"
+    VERBATIM 
+    )
 
-set(EXTRA_ARGS "--prefix ${CMAKE_INSTALL_PREFIX}")
+add_dependencies( bdist copy_pymoose )
+add_dependencies( copy_pymoose _moose )
 
-# On Debian/Ubuntu install using debian layout
-if( ${_platform_desc} MATCHES ".*(Ubuntu|Debian).*" )
-    list( APPEND EXTRA_ARGS "--install-layout=deb" )
-endif( )
+######################### INSTALL ##############################################
 
-# If make is called with sudo, install in system directories. Otherwise use
-# --user to install in user home.
-install(CODE
-    "execute_process(
-        COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py install ${EXTRA_ARGS} ${PYMOOSE_EXTRA_INSTALL_ARGS}
-        WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
-        )"
-        )
+install(TARGETS moose.bin DESTINATION bin CONFIGURATIONS Debug)
+install(TARGETS libmoose DESTINATION lib CONFIGURATIONS Debug)
+install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/scripts/moose
+    DESTINATION bin CONFIGURATIONS Debug
+    )
+
+# install pymoose bdist.
+install(DIRECTORY ${PYMOOSE_BDIST_INSTALL_DIR}/
+    DESTINATION ${CMAKE_INSTALL_PREFIX}
+    CONFIGURATIONS Release
+    )
 
 # Print message to start build process
 if(${CMAKE_BUILD_TOOL} MATCHES "make")
@@ -439,28 +479,6 @@ if(${CMAKE_BUILD_TOOL} MATCHES "make")
         )
 endif()
 
-# Target for creating bdist. This is handy for creating bdist for packaging.
-# Save the binary distribution (tar.gz) to PYMOOSE_BDIST_DIR. Note that this
-# target is only useful when creating packages on Open Build Service i.e. if you
-# use this target on distribution X, it may not work on distrbutions other than
-# X. See python-wheels for making portable distributions.
-if(NOT PYMOOSE_BDIST_DIR)
-    set(PYMOOSE_BDIST_DIR ${CMAKE_BINARY_DIR}/pymoose_bdist)
-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. Need to write a
-# setup.cfg file to fix the prefix in all cases. 
-file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg "[install]\nprefix=/usr" )
-find_package( PythonInterp REQUIRED)
-add_custom_target( bdist 
-    COMMAND ${PYTHON_EXECUTABLE} setup.cmake.py bdist_dumb -d ${PYMOOSE_BDIST_DIR}
-    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python
-    COMMENT "Genearating bdist using setup.cmake.py." 
-    VERBATIM
-    )
-
 
 ############################ CTEST ######################################
 include( CTest )
@@ -490,7 +508,7 @@ foreach( _test_script ${PY_TEST_SCRIPTS} )
         WORKING_DIRECTORY ${PYMOOSE_TEST_DIRECTORY}
         )
      set_tests_properties( ${_test_name}
-        PROPERTIES ENVIRONMENT "PYTHONPATH=${PROJECT_BINARY_DIR}/python"
+         PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/python"
         )
 endforeach( )
 
diff --git a/moose-core/pymoose/CMakeLists.txt b/moose-core/pymoose/CMakeLists.txt
index adf4176b955dcc0e1c254777f304cbac14233151..b5d118b764800099c1753c54876237d34de57b54 100644
--- a/moose-core/pymoose/CMakeLists.txt
+++ b/moose-core/pymoose/CMakeLists.txt
@@ -11,16 +11,22 @@ set(PYMOOSE_SRCS
     PyRun.cpp
     )
 
+# Build _moose.so in source directory and them copy everything to
+# current binary directory using cmake.
 add_library( _moose MODULE ${PYMOOSE_SRCS} )
-set(PYMOOSE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/python/moose")
+set(PYMOOSE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/python/moose")
 
 find_package(PythonInterp REQUIRED)
-execute_process( COMMAND ${PYTHON_EXECUTABLE} -c
-    "try: import importlib.machinery; print(importlib.machinery.EXTENSION_SUFFIXES[0])
-except Exception: pass"
+execute_process( COMMAND
+    ${PYTHON_EXECUTABLE} -c
+        "import importlib.machinery
+print(importlib.machinery.EXTENSION_SUFFIXES[-1])"
     OUTPUT_VARIABLE PYTHON_SO_EXTENSION
     OUTPUT_STRIP_TRAILING_WHITESPACE
     )
+if(NOT PYTHON_SO_EXTENSION)
+    set(PYTHON_SO_EXTENSION ".so")
+endif()
 message( STATUS "Python so extension ${PYTHON_SO_EXTENSION}" )
 
 find_package(NumPy REQUIRED)
@@ -43,7 +49,7 @@ set_target_properties(_moose PROPERTIES
     COMPILE_FLAGS "${PYTHON_INCLUDE_FLAGS}"
     LIBRARY_OUTPUT_DIRECTORY ${PYMOOSE_OUTPUT_DIRECTORY}
     PREFIX ""
-    SUFFIX ".so"
+    SUFFIX ${PYTHON_SO_EXTENSION}
     )
 
 if(NOT(PYTHON_SO_EXTENSION STREQUAL ""))
@@ -71,7 +77,7 @@ if(MACOSX)
     target_link_libraries(_moose
         ${SYSTEM_SHARED_LIBS}
         )
-ELSE(MACOSX)
+else(MACOSX)
     target_link_libraries(_moose
         "-Wl,--whole-archive"
         ${MOOSE_LIBRARIES}
@@ -81,25 +87,12 @@ ELSE(MACOSX)
         ${SYSTEM_SHARED_LIBS}
         )
 endif(MACOSX)
-
-# Make this target dependant on all python files in python folder.
-add_custom_target(copy_python_files
-    COMMAND ${CMAKE_COMMAND} -E copy_directory
-        ${CMAKE_SOURCE_DIR}/python ${CMAKE_BINARY_DIR}/python
-    COMMENT "Copying required python files and other files to build directory"
-    VERBATIM
-    )
-
-add_dependencies(_moose copy_python_files)
-
-
-# Print message at the end of build process.
-add_custom_command( TARGET _moose POST_BUILD 
+add_custom_command(TARGET _moose POST_BUILD
     COMMAND ${CMAKE_COMMAND} -E cmake_echo_color --cyan
-    "MOOSE python extention is successfully built. Now "
-    " 1. Run 'make install' to install it for single user. "
-    " 2. Run 'sudo make install' to install it system-wide. "
-    " "
-    "NOTE: Run 'pip uninstall moose' to uninstall moose."
+        "MOOSE python extention is successfully built. Now "
+        " Run 'sudo make install' to install it. "
+        " "
+        "NOTE: Run 'pip uninstall moose' to uninstall moose."
     VERBATIM
     )
+
diff --git a/moose-core/python/moose/moose.py b/moose-core/python/moose/moose.py
index 416e2e5f44d3552f276ecc772bd1f082ddb46437..a949e5f4b5429952c38be7b9e2414694652dad9a 100644
--- a/moose-core/python/moose/moose.py
+++ b/moose-core/python/moose/moose.py
@@ -1,4 +1,5 @@
 # -*- coding: utf-8 -*-
+from __future__ import print_function, division, absolute_import
 
 # Author: Subhasis Ray
 # Maintainer: Dilawar Singh, Harsha Rani, Upi Bhalla
diff --git a/moose-core/python/setup.cmake.py b/moose-core/python/setup.cmake.py
index d9bbdf3778305d1c782c0477e56c53c492fce9b7..d74a52426fa622a500bb935adeb8824c286b1734 100644
--- a/moose-core/python/setup.cmake.py
+++ b/moose-core/python/setup.cmake.py
@@ -1,11 +1,7 @@
 # -*- coding: utf-8 -*-
+from __future__ import print_function
 
-"""setup.py:
-Script to install python targets.
-
-NOTE: This script is to be called by CMake. Not intended to be used standalone.
-
-"""
+# NOTE: This script is to be called by CMake. Not intended to be used standalone.
 
 __author__           = "Dilawar Singh"
 __copyright__        = "Copyright 2013, Dilawar Singh and NCBS Bangalore"
@@ -19,25 +15,26 @@ __status__           = "Development"
 import os
 import sys
 
-try:
-	from setuptools import setup
-except Exception as e:
-	from distutils.core import setup
+
+# NOTE: Though setuptool is preferred we use distutils.
+# 1. setuptool normalize VERSION even when it is compatible with PyPI
+# guidelines. This caused havoc on our OBS build.
+from distutils.core import setup
 
 
 # Read version from VERSION created by cmake file. This file must be present for
 # setup.cmake.py to work perfectly.
 script_dir = os.path.dirname( os.path.abspath( __file__ ) )
-version = '3.2pre1'
 
+# Version file must be available. It MUST be written by cmake. Or create
+# manually.
+with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f:
+    version = f.read( )
+print( 'Got %s from VERSION file' % version )
 
-try:
-    with open( os.path.join( script_dir, 'VERSION'), 'r' ) as f:
-        version = f.read( )
-except Exception as e:
-    print( 'Failed to read VERSION %s' % e )
-    print( 'Using default %s' % version )
 
+# importlib is available only for python3.
+suffix = '.so'
 try:
     import importlib.machinery
     suffix = importlib.machinery.EXTENSION_SUFFIXES[0].split('.')[-1]
@@ -46,27 +43,20 @@ except Exception as e:
     suffix = '.so'
 
 setup(
-        name='pymoose',
-        version=version,
-        description='Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)',
-        author='MOOSERes',
-        author_email='bhalla@ncbs.res.in',
-        maintainer='Dilawar Singh',
-        maintainer_email='dilawars@ncbs.res.in',
-        url='http://moose.ncbs.res.in',
-        packages=[
-            'rdesigneur'
-            , 'moose'
-            , 'moose.SBML'
-            , 'moose.neuroml'
-            , 'moose.neuroml2'
-            , 'moose.genesis'
-            , 'moose.chemUtil'
-            , 'moose.chemMerge'
-            ],
-	install_requires = [ 'python-libsbml', 'numpy' ],
-        package_dir = {
-            'moose' : 'moose', 'rdesigneur' : 'rdesigneur'
-            },
-        package_data = { 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml'] },
-    )
+        name                   = 'pymoose',
+        version                = version,
+        description            = 'Python scripting interface of MOOSE Simulator (https://moose.ncbs.res.in)',
+        author                 = 'MOOSERes',
+        author_email           = 'bhalla@ncbs.res.in',
+        maintainer             = 'Dilawar Singh',
+        maintainer_email       = 'dilawars@ncbs.res.in',
+        url                    = 'http://moose.ncbs.res.in',
+        packages               = [ 'rdesigneur', 'moose'
+                                    , 'moose.SBML', 'moose.genesis'
+                                    , 'moose.neuroml', 'moose.neuroml2'
+                                    , 'moose.chemUtil', 'moose.chemMerge' 
+                                ],
+        install_requires       = [ 'python-libsbml', 'numpy' ],
+        package_dir            = { 'moose' : 'moose', 'rdesigneur' : 'rdesigneur' },
+        package_data           = { 'moose' : ['_moose' + suffix, 'neuroml2/schema/NeuroMLCoreDimensions.xml'] },
+        )
diff --git a/moose-core/setup.py b/moose-core/setup.py
index f7eec4a35346b44bb6c2a30ccf08369c151cfbe2..4d9d8284a8bc92b5d871bfc82fa0e034d60a238e 100755
--- a/moose-core/setup.py
+++ b/moose-core/setup.py
@@ -1,6 +1,8 @@
 # -*- coding: utf-8 -*-
+from __future__ import print_function
 
 """setup.py: This
+NOT COMPLETE.
 scripts prepare MOOSE for PyPI.
 
 Last modified: Mon Jul 28, 2014  12:52AM