diff --git a/.travis.yml b/.travis.yml
index 047a95a5ac9147cef708937b6ed3b676e8f4b040..1a6d6efdb4424b0f968eec02155ea2adb15f7178 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,6 +1,4 @@
 sudo : required
-dist : trusty
-group : edge
 
 compiler:
     - gcc
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d711ca1dd90580e50ef8183c4ca67e069b2bc45b..6968c32f41fe9b6cad0f3944aba695070c6cf49b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,15 +28,6 @@ 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 )
 
-# get platform and arch using python.
-find_package( PythonInterp REQUIRED)
-execute_process( 
-    COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print('%s-%s'%(sys.platform,sys.arch))"
-    OUTPUT_VARIABLE PY_PLATFORM_ARCH
-    OUTPUT_STRIP_TRAILING_WHITESPACE
-    )
-message(STATUS "Building bdist for arch - ${PY_PLATFORM_ARCH}")
-
 
 # On python3. Do not install GUI. 
 find_package(PythonInterp REQUIRED)
@@ -62,7 +53,6 @@ if(UNIX AND NOT APPLE)
 endif( )
 
 
-
 add_custom_target(moose ALL)
 
 
@@ -73,7 +63,10 @@ set(PYMOOSE_BUILD_DIR ${CMAKE_BINARY_DIR}/__moose-core_build)
 # 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)
-set(PYMOOSE_BDIST_DIR ${PYMOOSE_BUILD_DIR}/)
+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)
@@ -94,14 +87,16 @@ configure_file( ${CMAKE_SOURCE_DIR}/cmake/build_moose-core.sh.in
 
 # Build pymoose module.
 add_custom_target( moose-core ALL 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}.${PY_PLATFORM_ARCH}.tar.gz 
+        tar xvf ${PYMOOSE_BUILD_DIR}/pymoose-${MOOSE_VERSION}.*.tar.gz 
     COMMENT "Building bdist and unarchiving it"
-    VERBATIM
+    # VERBATIM ## WARN: Don't use VERBATIM here. The glob * in tar xvf will not
+    # work
     )
 add_dependencies(moose moose-core)
 
@@ -130,7 +125,8 @@ endif()
 set(MOOSE_GUI_DIR ${CMAKE_SOURCE_DIR}/moose-gui)
 
 # Install pymoose. Use tar.gz in PYMOOSE_BUILD_DIR and unarchive it.
-install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/
+# /usr is prefixed by bdist so we need to replace it.
+install(DIRECTORY ${PYMOOSE_INSTALL_DIR}/usr/
     DESTINATION ${CMAKE_INSTALL_PREFIX}
     PATTERN ".git" EXCLUDE
     PATTERN "*.pyc" EXCLUDE
diff --git a/cmake/build_moose-core.sh.in b/cmake/build_moose-core.sh.in
index c4a1a940d55d890bdb3f513756464dcd6694e2e1..8ae7a5b37b4eda363b189c951bf05bc7f28c474e 100755
--- a/cmake/build_moose-core.sh.in
+++ b/cmake/build_moose-core.sh.in
@@ -25,4 +25,4 @@ cmake -DCMAKE_INSTALL_PREFIX=@PYMOOSE_INSTALL_DIR@ \
     @PYMOOSE_SOURCE_DIR@ 
 $MAKE
 ctest --output-on-failure || echo "Some tests failed"
-$MAKE bdist
+$MAKE bdist VERBOSE=1
diff --git a/debian/rules b/debian/rules
index 823c7f6375066cc886e81167d0a70b3c83f36db0..b9f79dc0cd7a928b5f2ac09e7e1742a20df7bc4d 100755
--- a/debian/rules
+++ b/debian/rules
@@ -13,7 +13,7 @@ override_dh_auto_clean:
 
 # consider using -DUSE_VERSIONED_DIR=ON if backporting
 override_dh_auto_configure:
-	cmake -DCMAKE_INSTALL_PREFIX=debian/tmp/usr
+	cmake -DCMAKE_INSTALL_PREFIX=debian/tmp/usr -DCMAKE_VERSION=3.2.git
 
 override_dh_auto_build:
 	make VERBOSE=0 -j`nproc`
diff --git a/moose-core/CMakeLists.txt b/moose-core/CMakeLists.txt
index 0541457f10b02d28c2bdfb92320db88f63435430..fbfb5bec3057e51907cf1cdee021c6146ca935d8 100644
--- a/moose-core/CMakeLists.txt
+++ b/moose-core/CMakeLists.txt
@@ -439,6 +439,28 @@ 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 )
diff --git a/moose-core/python/setup.cmake.py b/moose-core/python/setup.cmake.py
index 94787ff76ba0bf70554c742c158e19a7ad36f23d..d9bbdf3778305d1c782c0477e56c53c492fce9b7 100644
--- a/moose-core/python/setup.cmake.py
+++ b/moose-core/python/setup.cmake.py
@@ -24,6 +24,9 @@ try:
 except Exception as e:
 	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'