diff --git a/CMakeLists.txt b/CMakeLists.txt
index b9d5114a5be01c9254b804b69438234dc586495f..f56f10d2a81112d743289c8885f315d6e3e73931 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -34,6 +34,13 @@ option(BUILD_CLIENTS_ONLY "Build clients only" OFF)
 option(BUILD_CONSUMER_TOOLS "Build consumer tools" OFF)
 option(BUILD_EVENT_MONITOR_PRODUCER "Build the event monitor producer" OFF)
 
+option(BUILD_PYTHON "Build python libs" ON)
+if(BUILD_PYTHON)
+    set(BUILD_PYTHON_PACKAGES "" CACHE STRING "which python packages to build")
+    set_property(CACHE BUILD_PYTHON_PACKAGES PROPERTY STRINGS source rpm deb win)
+endif()
+
+
 option(BUILD_TESTS "Build unit tests" OFF)
 option(BUILD_INTEGRATION_TESTS "Include integration tests" OFF)
 
@@ -46,6 +53,7 @@ option(BUILD_PYTHON_DOCS "Build the Python documentaion with sphinx" OFF)
 option(ENABLE_LIBFABRIC "Enables LibFabric support for RDMA transfers" OFF)
 option(ENABLE_LIBFABRIC_LOCALHOST "Emulates LibFabric stack over TCP. Only for localhost and testing purposes." OFF)
 
+
 set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeModules/)
 
 set (ASAPO_CXX_COMMON_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/common/cpp/include)
diff --git a/consumer/CMakeLists.txt b/consumer/CMakeLists.txt
index b0bc14d1f558b0c307b6c8ef874e7551491618e4..5fef2c2e32842be2536850c8b72097ec5f65ad4f 100644
--- a/consumer/CMakeLists.txt
+++ b/consumer/CMakeLists.txt
@@ -1,5 +1,8 @@
 add_subdirectory(api/cpp)
-add_subdirectory(api/python)
+
+if (BUILD_PYTHON)
+    add_subdirectory(api/python)
+endif()
 
 
 if(BUILD_CONSUMER_TOOLS)
diff --git a/consumer/api/python/CMakeLists.txt b/consumer/api/python/CMakeLists.txt
index fa67bc7794c539630f1cc879ad176e03b01c10e9..3eeec33663c17e8ed49845dd1ec8a9b5f7cbe77b 100644
--- a/consumer/api/python/CMakeLists.txt
+++ b/consumer/api/python/CMakeLists.txt
@@ -2,7 +2,7 @@
 if (UNIX)
     include(CMakeLists_Linux.cmake)
     set (suf "so")
-ELSEIF(CMAKE_BUILD_TYPE STREQUAL "Release")
+ELSE()
     set (suf "pyd")
     include(CMakeLists_Windows.cmake)
 ENDIF()
\ No newline at end of file
diff --git a/consumer/api/python/CMakeLists_Linux.cmake b/consumer/api/python/CMakeLists_Linux.cmake
index e0bbd7af09e46e56a4151b8835c475dd787d34b5..c099a14d424918d4a3dcdf5dde31cbc949f990e2 100644
--- a/consumer/api/python/CMakeLists_Linux.cmake
+++ b/consumer/api/python/CMakeLists_Linux.cmake
@@ -19,8 +19,10 @@ set (ASAPO_CONSUMER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/include)
 
 configure_files(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} @ONLY)
 
-ADD_CUSTOM_TARGET(python-lib COMMAND ${Python_EXECUTABLE} setup.py build_ext --inplace --force)
+ADD_CUSTOM_TARGET(python-lib-consumer ALL COMMAND ${Python_EXECUTABLE} setup.py build_ext --inplace --force)
 
-ADD_DEPENDENCIES(python-lib asapo-consumer)
+ADD_DEPENDENCIES(python-lib-consumer asapo-consumer)
 
-add_subdirectory(source_dist_linux)
+if (BUILD_PYTHON_PACKAGES)
+    add_subdirectory(dist_linux)
+endif()
diff --git a/consumer/api/python/source_dist_linux/CMakeLists.txt b/consumer/api/python/dist_linux/CMakeLists.txt
similarity index 57%
rename from consumer/api/python/source_dist_linux/CMakeLists.txt
rename to consumer/api/python/dist_linux/CMakeLists.txt
index 9c8c2d41bc1def51e14ba8fd15704ce8a8dd85bb..67e5a6e9effdc0d049121753ec70b6f1c9f29032 100644
--- a/consumer/api/python/source_dist_linux/CMakeLists.txt
+++ b/consumer/api/python/dist_linux/CMakeLists.txt
@@ -1,21 +1,26 @@
 configure_file(setup.py.in setup.py @ONLY)
 configure_file(MANIFEST.in MANIFEST.in @ONLY)
 
-ADD_CUSTOM_TARGET(python-dist
+if ("source" IN_LIST BUILD_PYTHON_PACKAGES )
+    ADD_CUSTOM_TARGET(python-dist-consumer ALL
         COMMAND ${Python_EXECUTABLE} setup.py sdist
         )
-
-ADD_CUSTOM_TARGET(python-rpm-consumer
-        COMMAND PACKAGE_PREFIX=python- python setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=numpy
-        )
-
-ADD_CUSTOM_TARGET(python3-rpm-consumer
-        COMMAND PACKAGE_PREFIX=python3- python3 setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=python3-numpy
-        )
-
-#get_property(ASAPO_CONSUMER_LIB TARGET asapo-consumer PROPERTY LOCATION)
-
-ADD_CUSTOM_TARGET(copy_python_dist
+    ADD_DEPENDENCIES(python-dist-consumer copy_python_dist-consumer)
+endif()
+
+if ("rpm" IN_LIST BUILD_PYTHON_PACKAGES)
+    ADD_CUSTOM_TARGET(python-rpm-consumer ALL
+            COMMAND PACKAGE_PREFIX=python- python setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=numpy
+            )
+
+    ADD_CUSTOM_TARGET(python3-rpm-consumer ALL
+            COMMAND PACKAGE_PREFIX=python3- python3 setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=python3-numpy
+            )
+    ADD_DEPENDENCIES(python-rpm-consumer copy_python_dist-consumer)
+    ADD_DEPENDENCIES(python3-rpm-consumer copy_python_dist-consumer)
+endif()
+
+ADD_CUSTOM_TARGET(copy_python_dist-consumer ALL
         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/../asapo_wrappers.h ${CMAKE_CURRENT_BINARY_DIR}/.
         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/../asapo_consumer.cpp ${CMAKE_CURRENT_BINARY_DIR}/.
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/consumer/api/cpp/include ${CMAKE_CURRENT_BINARY_DIR}/include
@@ -28,9 +33,4 @@ ADD_CUSTOM_TARGET(copy_python_dist
 
         )
 
-
-ADD_DEPENDENCIES(copy_python_dist python-lib)
-
-ADD_DEPENDENCIES(python-dist copy_python_dist)
-ADD_DEPENDENCIES(python-rpm-consumer python-dist)
-ADD_DEPENDENCIES(python3-rpm-consumer python-dist)
+ADD_DEPENDENCIES(copy_python_dist-consumer python-lib-consumer)
diff --git a/consumer/api/python/source_dist_linux/MANIFEST.in b/consumer/api/python/dist_linux/MANIFEST.in
similarity index 100%
rename from consumer/api/python/source_dist_linux/MANIFEST.in
rename to consumer/api/python/dist_linux/MANIFEST.in
diff --git a/consumer/api/python/source_dist_linux/setup.py.in b/consumer/api/python/dist_linux/setup.py.in
similarity index 100%
rename from consumer/api/python/source_dist_linux/setup.py.in
rename to consumer/api/python/dist_linux/setup.py.in
diff --git a/deploy/build_env/Ubuntu16.04/Dockerfile b/deploy/build_env/Ubuntu16.04/Dockerfile
index 20f8c85911f3fab595252eac824e5c4543132825..943b0329ae9590d3f1b345db07e7b462f89727b0 100644
--- a/deploy/build_env/Ubuntu16.04/Dockerfile
+++ b/deploy/build_env/Ubuntu16.04/Dockerfile
@@ -4,13 +4,16 @@ ENV GOPATH /tmp
 
 ADD install_curl.sh install_curl.sh
 ADD install_cmake.sh install_cmake.sh
-ADD install_libfabric.sh install_libfabric.sh
 
 RUN apt update && apt install -y g++ golang zlib1g-dev python cython python-numpy python3 cython3 python3-numpy  \
 git wget python-pip python3-pip && \
 pip  --no-cache-dir install --upgrade cython && pip3  --no-cache-dir install --upgrade cython && pip3  --no-cache-dir install sphinx && \
-./install_curl.sh /curl &&  ./install_cmake.sh && ./install_libfabric.sh \
-apt-get purge -y --auto-remove
+./install_curl.sh /curl &&  ./install_cmake.sh
+
+ADD install_libfabric.sh install_libfabric.sh
+RUN ./install_libfabric.sh
+
+RUN apt-get purge -y --auto-remove
 
 ADD build.sh /bin/build.sh
 
diff --git a/deploy/build_env/Ubuntu16.04/build.sh b/deploy/build_env/Ubuntu16.04/build.sh
index 54678561c5c2a68c0a85188e15ffaf86f366fc13..c0031edf8d69d1c4393e6ba06306ad0bf6bd360e 100755
--- a/deploy/build_env/Ubuntu16.04/build.sh
+++ b/deploy/build_env/Ubuntu16.04/build.sh
@@ -8,9 +8,11 @@ cmake \
     -DENABLE_LIBFABRIC=on \
     -DLIBCURL_DIR=/curl \
     -DBUILD_PYTHON_DOCS=ON \
-    -DBUILD_EVENT_MONITOR_PRODUCER=ON \
+    -DBUILD_PYTHON_PACKAGES=source \
+    -DBUILD_CLIENTS_ONLY=ON \
     ..
-cd consumer/api/python/source_dist_linux && make python-dist
-cd ../producer/api/python/source_dist_linux && make python-dist-producer
-cd ../docs/sphinx && make
+make
+#cd consumer/api/python/dist_linux && make python-dist-consumer
+#cd ../producer/api/python/dist_linux && make python-dist-producer
+#cd ../docs/sphinx && make
 
diff --git a/deploy/build_env/Ubuntu16.04/install_libfabric.sh b/deploy/build_env/Ubuntu16.04/install_libfabric.sh
index a6ef6db450713966297cc671f2f3612839cd5bcf..ecfc8cdb67e649694daeafde88fee47d7ceaf24f 100755
--- a/deploy/build_env/Ubuntu16.04/install_libfabric.sh
+++ b/deploy/build_env/Ubuntu16.04/install_libfabric.sh
@@ -1,8 +1,10 @@
 #!/usr/bin/env bash
 
-apt install -y wget autoconf libtool make librdmacm-dev rdma-core
 wget https://github.com/ofiwg/libfabric/archive/v1.11.0.tar.gz
 tar xzf v1.11.0.tar.gz
+
+apt install -y autoconf libtool make librdmacm-dev mc
+
 cd libfabric-1.11.0
 ./autogen.sh
 ./configure
diff --git a/deploy/build_env/centos/build.sh b/deploy/build_env/centos/build.sh
index dbcfc1cccffa31049e951594ee937b3c7ba6e6c9..9ca1c74d7afa7a9bcd7d418128e225c9041421d8 100755
--- a/deploy/build_env/centos/build.sh
+++ b/deploy/build_env/centos/build.sh
@@ -7,12 +7,12 @@ cmake \
     -DINSTALL_EXAMPLES=ON \
     -DBUILD_CLIENTS_ONLY=ON \
     -DPACKAGE_RELEASE_SUFFIX=$OS \
-    -DNUMPY_VERSION=0   \
+    -DBUILD_PYTHON=OFF   \
     -DLIBCURL_DIR=/curl \
     ..
 make
 make package
-cd consumer/api/python/source_dist_linux && make python-rpm-consumer python3-rpm-consumer && cd -
-cd producer/api/python/source_dist_linux && make python-rpm-producer python3-rpm-producer
 
+cmake -DNUMPY_VERSION=0 -DBUILD_PYTHON=ON -DBUILD_PYTHON_PACKAGES="source;rpm" ..
+make
 
diff --git a/deploy/build_env/manylinux2010/build.sh b/deploy/build_env/manylinux2010/build.sh
index 586cd048620fb43767436550457c32cc9984ab18..0fee6f1faebfef1a0776629a1db85c316d46a31b 100755
--- a/deploy/build_env/manylinux2010/build.sh
+++ b/deploy/build_env/manylinux2010/build.sh
@@ -18,12 +18,17 @@ for python_path in /opt/python/cp{27,35,36,37,38}*; do
     echo "building wheel for python_version=$python_version with numpy_version=$numpy_version"
 
     cd /asapo/build
-    cmake -DENABLE_LIBFABRIC=on -DCMAKE_BUILD_TYPE="Release" -DLIBCURL_DIR=/curl -DPython_EXECUTABLE=$python -DNUMPY_VERSION=$numpy_version ..
-    cd /asapo/build/consumer/api/python/source_dist_linux \
+    cmake -DENABLE_LIBFABRIC=on \
+          -DCMAKE_BUILD_TYPE="Release" \
+          -DBUILD_CLIENTS_ONLY=ON \
+          -DLIBCURL_DIR=/curl -DPython_EXECUTABLE=$python \
+          -DBUILD_PYTHON_PACKAGES=source \
+          -DNUMPY_VERSION=$numpy_version ..
+    cd /asapo/build/consumer/api/python/dist_linux \
         && $pip install -r ../dev-requirements.txt \
-        && make python-dist \
+        && make python-dist-consumer \
         && $pip wheel dist/*.tar.gz -w /asapo/build/consumer/wheelhouse --no-deps
-    cd  /asapo/build/producer/api/python/source_dist_linux \
+    cd  /asapo/build/producer/api/python/dist_linux \
         && $pip install -r ../dev-requirements.txt \
         && make python-dist-producer \
         && $pip wheel dist/*.tar.gz -w /asapo/build/producer/wheelhouse --no-deps
diff --git a/deploy/build_env/manylinux2010/build_image.sh b/deploy/build_env/manylinux2010/build_image.sh
index d5667a5145247e95d3213293323425d91a4c75f8..ed3fc8061e0710d15c48d76145e12a248c5bbb50 100755
--- a/deploy/build_env/manylinux2010/build_image.sh
+++ b/deploy/build_env/manylinux2010/build_image.sh
@@ -1,6 +1,11 @@
 #!/usr/bin/env bash
 
-docker build -t yakser/asapo-env:manylinux2010_ .
-./docker-squash yakser/asapo-env:manylinux2010_ -t yakser/asapo-env:manylinux2010
-docker push yakser/asapo-env:manylinux2010
+#docker build -t yakser/asapo-env:manylinux2010_ .
+#./docker-squash yakser/asapo-env:manylinux2010_ -t yakser/asapo-env:manylinux2010
+
+docker build -t yakser/asapo-env:manylinux2010 .
+#docker push yakser/asapo-env:manylinux2010
+#docker push yakser/asapo-env:manylinux2010
+
+
 
diff --git a/docs/sphinx/CMakeLists.txt b/docs/sphinx/CMakeLists.txt
index 77fda050e6c860103cc70fb958ef823cb0b12b5a..9da6590e708d4d9c5d8a341fd1a1c8b8a856880b 100644
--- a/docs/sphinx/CMakeLists.txt
+++ b/docs/sphinx/CMakeLists.txt
@@ -9,4 +9,4 @@ add_custom_target(
 )
 
 add_dependencies(docs-py python-lib-producer)
-add_dependencies(docs-py python-lib)
+add_dependencies(docs-py python-lib-consumer)
diff --git a/examples/consumer/CMakeLists.txt b/examples/consumer/CMakeLists.txt
index 6da6f7a60df9cbdb2233be2f29ee83c492c7ec5e..1bb3170d2e8508175cba23266b4a1d37c0005a52 100644
--- a/examples/consumer/CMakeLists.txt
+++ b/examples/consumer/CMakeLists.txt
@@ -2,10 +2,8 @@ find_package(Threads)
 
 add_subdirectory(getnext_broker)
 
-if(BUILD_EXAMPLES)
-    if (UNIX OR CMAKE_BUILD_TYPE STREQUAL "Release")
+if(BUILD_EXAMPLES AND BUILD_PYTHON)
         add_subdirectory(getnext_broker_python)
-    endif()
 endif()
 
 
diff --git a/examples/consumer/getnext_broker_python/CMakeLists.txt b/examples/consumer/getnext_broker_python/CMakeLists.txt
index f0a26a43e0325ee62bb227be1b34a9c9b3de92c7..22bd7bea66e7ecd8a7d0fd2b54273152351e9493 100644
--- a/examples/consumer/getnext_broker_python/CMakeLists.txt
+++ b/examples/consumer/getnext_broker_python/CMakeLists.txt
@@ -4,7 +4,7 @@ set(TARGET_NAME getnext_broker_python)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS python-lib-consumer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS asapo_consumer BINARY_DIR)
 endif()
diff --git a/examples/pipeline/CMakeLists.txt b/examples/pipeline/CMakeLists.txt
index 8dce2cc3729884f58bb4926053e8a31a28b758d1..c11f2d30eaab5f9d9528bac38cb5574b29033fec 100644
--- a/examples/pipeline/CMakeLists.txt
+++ b/examples/pipeline/CMakeLists.txt
@@ -1,6 +1,6 @@
 
 add_subdirectory(in_to_out)
 
-if (UNIX OR CMAKE_BUILD_TYPE STREQUAL "Release")
+if (BUILD_PYTHON)
     add_subdirectory(in_to_out_python)
 endif()
diff --git a/examples/pipeline/in_to_out_python/CMakeLists.txt b/examples/pipeline/in_to_out_python/CMakeLists.txt
index 9ab39455b74d188afbe611bf05599c4e84f876f0..cebedb3f70ecaab5e94677e78d192db8e1a8a8a8 100644
--- a/examples/pipeline/in_to_out_python/CMakeLists.txt
+++ b/examples/pipeline/in_to_out_python/CMakeLists.txt
@@ -3,7 +3,7 @@ set(TARGET_NAME pipeline_inout_python)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS_CONSUMER python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS_CONSUMER python-lib-consumer BINARY_DIR)
     get_target_property(PYTHON_LIBS_PRODUCER python-lib-producer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS_CONSUMER asapo_consumer BINARY_DIR)
diff --git a/producer/CMakeLists.txt b/producer/CMakeLists.txt
index 3c8560c158c9f3cabadc119cc4baae3205d4f3d1..dea86005c26f8907e2f4f739f517ec19091be7f6 100644
--- a/producer/CMakeLists.txt
+++ b/producer/CMakeLists.txt
@@ -1,5 +1,8 @@
 add_subdirectory(api/cpp)
-add_subdirectory(api/python)
+
+if (BUILD_PYTHON)
+    add_subdirectory(api/python)
+endif()
 
 if(BUILD_EVENT_MONITOR_PRODUCER)
     add_subdirectory(event_monitor_producer)
diff --git a/producer/api/python/CMakeLists.txt b/producer/api/python/CMakeLists.txt
index fa67bc7794c539630f1cc879ad176e03b01c10e9..3eeec33663c17e8ed49845dd1ec8a9b5f7cbe77b 100644
--- a/producer/api/python/CMakeLists.txt
+++ b/producer/api/python/CMakeLists.txt
@@ -2,7 +2,7 @@
 if (UNIX)
     include(CMakeLists_Linux.cmake)
     set (suf "so")
-ELSEIF(CMAKE_BUILD_TYPE STREQUAL "Release")
+ELSE()
     set (suf "pyd")
     include(CMakeLists_Windows.cmake)
 ENDIF()
\ No newline at end of file
diff --git a/producer/api/python/CMakeLists_Linux.cmake b/producer/api/python/CMakeLists_Linux.cmake
index 47bee3561758e43dc516da3ba8f6318174f84c50..de40245e9da800c6b40124f03d59d855ec7650b0 100644
--- a/producer/api/python/CMakeLists_Linux.cmake
+++ b/producer/api/python/CMakeLists_Linux.cmake
@@ -14,10 +14,11 @@ set (ASAPO_PRODUCER_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../cpp/include)
 configure_files(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR} @ONLY)
 file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py INPUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
 
-
-ADD_CUSTOM_TARGET(python-lib-producer
+ADD_CUSTOM_TARGET(python-lib-producer ALL
         COMMAND ${Python_EXECUTABLE} setup.py build_ext --inplace --force)
 
 ADD_DEPENDENCIES(python-lib-producer asapo-producer)
 
-add_subdirectory(source_dist_linux)
+if (BUILD_PYTHON_PACKAGES)
+    add_subdirectory(dist_linux)
+endif()
diff --git a/producer/api/python/CMakeLists_Windows.cmake b/producer/api/python/CMakeLists_Windows.cmake
index 955c52966cd91acdc2c41236dbc4295b70bf5876..009a0a7c532b84f61de67e2420ba9fd4e070cdde 100644
--- a/producer/api/python/CMakeLists_Windows.cmake
+++ b/producer/api/python/CMakeLists_Windows.cmake
@@ -31,4 +31,4 @@ add_subdirectory(binary_dist_windows)
 
 set (EXTRA_COMPILE_ARGS "['/MT']")
 set (EXTRA_LINK_ARGS "[]")
-add_subdirectory(source_dist_linux)
+add_subdirectory(dist_linux)
diff --git a/producer/api/python/source_dist_linux/CMakeLists.txt b/producer/api/python/dist_linux/CMakeLists.txt
similarity index 78%
rename from producer/api/python/source_dist_linux/CMakeLists.txt
rename to producer/api/python/dist_linux/CMakeLists.txt
index 1ee0b4ff1365162d0189af27f4a9fc382fc559a7..654c4a611dfe74a45b739488ab8469a0f9c0f486 100644
--- a/producer/api/python/source_dist_linux/CMakeLists.txt
+++ b/producer/api/python/dist_linux/CMakeLists.txt
@@ -3,19 +3,26 @@ configure_file(MANIFEST.in MANIFEST.in @ONLY)
 
 file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py INPUT ${CMAKE_CURRENT_BINARY_DIR}/setup.py)
 
-ADD_CUSTOM_TARGET(python-rpm-producer
+if ("rpm" IN_LIST BUILD_PYTHON_PACKAGES)
+	ADD_CUSTOM_TARGET(python-rpm-producer ALL
 		COMMAND PACKAGE_PREFIX=python- python setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=numpy
 		)
 
-ADD_CUSTOM_TARGET(python3-rpm-producer
+	ADD_CUSTOM_TARGET(python3-rpm-producer ALL
 		COMMAND PACKAGE_PREFIX=python3- python3 setup.py bdist_rpm --release=1.${PACKAGE_RELEASE_SUFFIX} --requires=python3-numpy
 		)
+	ADD_DEPENDENCIES(python3-rpm-producer copy_python_dist-producer)
+	ADD_DEPENDENCIES(python-rpm-producer copy_python_dist-producer)
+endif()
 
-ADD_CUSTOM_TARGET(python-dist-producer
+if ("source" IN_LIST BUILD_PYTHON_PACKAGES )
+	ADD_CUSTOM_TARGET(python-dist-producer ALL
         COMMAND ${Python_EXECUTABLE} setup.py sdist
         )
+	ADD_DEPENDENCIES(python-dist-producer copy_python_dist-producer)
+endif()
 
-ADD_CUSTOM_TARGET(copy_python_dist-producer
+ADD_CUSTOM_TARGET(copy_python_dist-producer ALL
         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/../asapo_wrappers.h ${CMAKE_CURRENT_BINARY_DIR}/.
         COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_CURRENT_BINARY_DIR}/../asapo_producer.cpp ${CMAKE_CURRENT_BINARY_DIR}/.
         COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/producer/api/cpp/include ${CMAKE_CURRENT_BINARY_DIR}/include
@@ -27,13 +34,9 @@ ADD_CUSTOM_TARGET(copy_python_dist-producer
         COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:asapo-producer> ${CMAKE_CURRENT_BINARY_DIR}/lib
         )
 
-
 if (UNIX)
 	ADD_DEPENDENCIES(copy_python_dist-producer python-lib-producer)
 ELSE()
 	ADD_DEPENDENCIES(copy_python_dist-producer asapo_producer)
 ENDIF()
 
-ADD_DEPENDENCIES(python-dist-producer copy_python_dist-producer)
-ADD_DEPENDENCIES(python3-rpm-producer copy_python_dist-producer)
-ADD_DEPENDENCIES(python-rpm-producer copy_python_dist-producer)
diff --git a/producer/api/python/source_dist_linux/MANIFEST.in b/producer/api/python/dist_linux/MANIFEST.in
similarity index 100%
rename from producer/api/python/source_dist_linux/MANIFEST.in
rename to producer/api/python/dist_linux/MANIFEST.in
diff --git a/producer/api/python/source_dist_linux/setup.py.in b/producer/api/python/dist_linux/setup.py.in
similarity index 100%
rename from producer/api/python/source_dist_linux/setup.py.in
rename to producer/api/python/dist_linux/setup.py.in
diff --git a/tests/automatic/bug_fixes/CMakeLists.txt b/tests/automatic/bug_fixes/CMakeLists.txt
index 35f942b1a84999354a8a4f6e58c6fada0170823f..17a66a5243a33d9371e73664d479faca25d20793 100644
--- a/tests/automatic/bug_fixes/CMakeLists.txt
+++ b/tests/automatic/bug_fixes/CMakeLists.txt
@@ -1,7 +1,9 @@
 if (UNIX)
     add_subdirectory(receiver_cpu_usage)
-    add_subdirectory(consumer_python_memleak)
-    add_subdirectory(error-sending-data-using-callback-method)
+    if (BUILD_PYTHON)
+        add_subdirectory(consumer_python_memleak)
+        add_subdirectory(error-sending-data-using-callback-method)
+    endif()
 endif()
 
 add_subdirectory(producer_send_after_restart)
diff --git a/tests/automatic/bug_fixes/consumer_python_memleak/CMakeLists.txt b/tests/automatic/bug_fixes/consumer_python_memleak/CMakeLists.txt
index 6c6b66006a123dac465173c7a91dd01c43c10068..352d76a2b71a0d16e953d3f91eaac692c6dafbb2 100644
--- a/tests/automatic/bug_fixes/consumer_python_memleak/CMakeLists.txt
+++ b/tests/automatic/bug_fixes/consumer_python_memleak/CMakeLists.txt
@@ -4,7 +4,7 @@ set(TARGET_NAME consumer_python_memleak)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS python-lib-consumer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS asapo_consumer BINARY_DIR)
 endif()
diff --git a/tests/automatic/consumer/CMakeLists.txt b/tests/automatic/consumer/CMakeLists.txt
index 1d4de1fa0d3a9b724ca3f2ff095b50b371f01052..50c68fda871e4c7bb09a0e75f7867b12298e4ef7 100644
--- a/tests/automatic/consumer/CMakeLists.txt
+++ b/tests/automatic/consumer/CMakeLists.txt
@@ -3,7 +3,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 3.7) # needed for fixtures
 add_subdirectory(next_multithread_broker)
 add_subdirectory(consumer_api)
 
-if (UNIX OR CMAKE_BUILD_TYPE STREQUAL "Release")
+if (BUILD_PYTHON)
     add_subdirectory(consumer_api_python)
 endif()
 
diff --git a/tests/automatic/consumer/consumer_api_python/CMakeLists.txt b/tests/automatic/consumer/consumer_api_python/CMakeLists.txt
index f63e4734aabc8983a8dd9b7bb01d4a2c12724e07..a4afb1b75bf222278f2a302e1af70ce133eadf03 100644
--- a/tests/automatic/consumer/consumer_api_python/CMakeLists.txt
+++ b/tests/automatic/consumer/consumer_api_python/CMakeLists.txt
@@ -4,7 +4,7 @@ set(TARGET_NAME consumer_api_python)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS python-lib-consumer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS asapo_consumer BINARY_DIR)
 endif()
diff --git a/tests/automatic/full_chain/CMakeLists.txt b/tests/automatic/full_chain/CMakeLists.txt
index 958cfce3006120cbf31e79ac80d64ee7d64cd808..0d7dd8b9fa95ef4c83f07ceb334ffce0b49c9b92 100644
--- a/tests/automatic/full_chain/CMakeLists.txt
+++ b/tests/automatic/full_chain/CMakeLists.txt
@@ -1,5 +1,5 @@
 add_subdirectory(simple_chain)
-if (UNIX OR CMAKE_BUILD_TYPE STREQUAL "Release")
+if (BUILD_PYTHON)
     add_subdirectory(simple_chain_usermeta_python)
     add_subdirectory(send_recv_substreams_python)
 endif()
diff --git a/tests/automatic/full_chain/send_recv_substreams_python/CMakeLists.txt b/tests/automatic/full_chain/send_recv_substreams_python/CMakeLists.txt
index 26c97503083f48685dd6341f098c6f1a0af57bd8..7a5de77a6e828154c92308725514f0109d59b68a 100644
--- a/tests/automatic/full_chain/send_recv_substreams_python/CMakeLists.txt
+++ b/tests/automatic/full_chain/send_recv_substreams_python/CMakeLists.txt
@@ -2,7 +2,7 @@ set(TARGET_NAME send_recv_substreams_python)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS_CONSUMER python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS_CONSUMER python-lib-consumer BINARY_DIR)
     get_target_property(PYTHON_LIBS_PRODUCER python-lib-producer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS_CONSUMER asapo_consumer BINARY_DIR)
diff --git a/tests/automatic/full_chain/simple_chain_usermeta_python/CMakeLists.txt b/tests/automatic/full_chain/simple_chain_usermeta_python/CMakeLists.txt
index 956e8dea68e05bdafdb875447c7dfd4d6c857475..827a81a9c51666d94f4063aa3a9dcdaf4b66e807 100644
--- a/tests/automatic/full_chain/simple_chain_usermeta_python/CMakeLists.txt
+++ b/tests/automatic/full_chain/simple_chain_usermeta_python/CMakeLists.txt
@@ -6,7 +6,7 @@ set(TARGET_NAME full_chain_usermeta_python)
 prepare_asapo()
 
 if (UNIX)
-    get_target_property(PYTHON_LIBS python-lib BINARY_DIR)
+    get_target_property(PYTHON_LIBS python-lib-consumer BINARY_DIR)
 else()
     get_target_property(PYTHON_LIBS asapo_consumer BINARY_DIR)
 endif()
diff --git a/tests/automatic/producer/CMakeLists.txt b/tests/automatic/producer/CMakeLists.txt
index e96695ebbea23663ada2f8218199ac3bd06f7ef2..3f9a657565fab57faf4791b1a933a61366e0e63a 100644
--- a/tests/automatic/producer/CMakeLists.txt
+++ b/tests/automatic/producer/CMakeLists.txt
@@ -1,8 +1,7 @@
 add_subdirectory(file_monitor_producer)
 add_subdirectory(beamtime_metadata)
 
-if (UNIX OR CMAKE_BUILD_TYPE STREQUAL "Release")
+if (BUILD_PYTHON)
     add_subdirectory(python_api)
     add_subdirectory(aai)
-
 endif()