[hamradio-commits] [soapysdr] 01/06: New upstream version 0.6.1

Andreas E. Bombe aeb at moszumanska.debian.org
Sun Dec 17 21:23:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

aeb pushed a commit to annotated tag debian/0.6.1-1
in repository soapysdr.

commit fc96b416e5b355e14122eae666a29dfdb75f9849
Author: Andreas Bombe <aeb at debian.org>
Date:   Sun Dec 17 21:45:12 2017 +0100

    New upstream version 0.6.1
---
 .travis.yml                                        | 14 ++++------
 CMakeLists.txt                                     | 22 ++++++++--------
 Changelog.txt                                      | 10 ++++++++
 apps/SoapyRateTest.cpp                             | 30 +++++++++++++++++++---
 .../{ => Modules}/GetGitRevisionDescription.cmake  |  0
 .../GetGitRevisionDescription.cmake.in             |  0
 cmake/{ => Modules}/SoapySDRConfig.cmake           |  0
 cmake/{ => Modules}/SoapySDRConfigVersion.in.cmake |  0
 cmake/{ => Modules}/SoapySDRUtil.cmake             |  0
 debian/changelog                                   |  6 +++++
 debian/rules                                       |  3 ++-
 include/SoapySDR/Device.h                          | 16 ++++++------
 include/SoapySDR/Device.hpp                        | 16 ++++++------
 lib/DeviceC.cpp                                    | 16 ++++++------
 lib/FactoryC.cpp                                   |  4 +--
 lib/Version.in.cpp                                 |  9 ++++---
 python/CMakeLists.txt                              |  7 +++++
 python/SoapySDR.i                                  |  1 +
 python/apps/MeasureDelay.py                        | 13 +++++-----
 python3/CMakeLists.txt                             |  2 +-
 python3/FindPython3Libs.cmake                      |  1 +
 21 files changed, 108 insertions(+), 62 deletions(-)

diff --git a/.travis.yml b/.travis.yml
index d0f335c..3432df7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,16 +17,10 @@ matrix:
   include:
     - os: linux
       compiler: gcc
-      env:
-        global:
-          - PYTHON_EXECUTABLE=/usr/bin/python
-          - PYTHON3_EXECUTABLE=/usr/bin/python3
+      env: PYTHON_EXECUTABLE=/usr/bin/python PYTHON3_EXECUTABLE=/usr/bin/python3
     - os: osx
       compiler: clang
-      env:
-        global:
-          - PYTHON_EXECUTABLE=/usr/local/bin/python
-          - PYTHON3_EXECUTABLE=/usr/local/bin/python3
+      env: PYTHON_EXECUTABLE=/usr/local/bin/python2 PYTHON3_EXECUTABLE=/usr/local/bin/python3
 
 env:
   global:
@@ -46,7 +40,9 @@ install:
 
   # install python3 support dependencies
   - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo apt-get install -qq python3 python3-dev python3-numpy swig; fi;
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install swig python3 ; fi
+
+  # install osx python and python2 dependencies
+  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install swig python2 python3 ; fi
 
 script:
   - mkdir build
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c541a30..0e97064 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -10,10 +10,15 @@ enable_testing()
 # gather version information
 # packagers may specify -DSOAPY_SDR_EXTVER="foo" to replace the git hash
 ########################################################################
-set(SOAPY_SDR_LIBVER "0.6.0")
+file(READ "${PROJECT_SOURCE_DIR}/Changelog.txt" changelog_txt)
+string(REGEX MATCH "Release ([0-9]+\\.[0-9]+\\.[0-9]+) \\(" CHANGELOG_MATCH "${changelog_txt}")
+if(NOT CHANGELOG_MATCH)
+    message(FATAL_ERROR "Failed to extract version number from Changelog.txt")
+endif(NOT CHANGELOG_MATCH)
+set(SOAPY_SDR_LIBVER "${CMAKE_MATCH_1}")
 
 if (NOT SOAPY_SDR_EXTVER)
-    include(${PROJECT_SOURCE_DIR}/cmake/GetGitRevisionDescription.cmake)
+    include(${PROJECT_SOURCE_DIR}/cmake/Modules/GetGitRevisionDescription.cmake)
     get_git_head_revision(GITREFSPEC GITHASH)
     if (GITHASH)
         string(SUBSTRING "${GITHASH}" 0 8 GITHASH)
@@ -78,7 +83,7 @@ endif()
 ########################################################################
 # Allows in-tree module util
 ########################################################################
-set(SoapySDR_DIR ${PROJECT_SOURCE_DIR}/cmake)
+set(SoapySDR_DIR ${PROJECT_SOURCE_DIR}/cmake/Modules)
 set(SOAPY_SDR_IN_TREE_SOURCE_DIR ${PROJECT_SOURCE_DIR})
 find_package(SoapySDR NO_MODULE REQUIRED)
 include_directories(${SoapySDR_INCLUDE_DIRS}) #local include precedence
@@ -87,12 +92,12 @@ include_directories(${SoapySDR_INCLUDE_DIRS}) #local include precedence
 # Install cmake helper modules
 ########################################################################
 configure_file(
-    ${PROJECT_SOURCE_DIR}/cmake/SoapySDRConfigVersion.in.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/SoapySDRConfigVersion.in.cmake
     ${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake
 @ONLY)
 set(cmake_files
-    ${PROJECT_SOURCE_DIR}/cmake/SoapySDRConfig.cmake
-    ${PROJECT_SOURCE_DIR}/cmake/SoapySDRUtil.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/SoapySDRConfig.cmake
+    ${PROJECT_SOURCE_DIR}/cmake/Modules/SoapySDRUtil.cmake
     ${PROJECT_BINARY_DIR}/SoapySDRConfigVersion.cmake)
 if (UNIX)
     install(FILES ${cmake_files} DESTINATION share/cmake/${PROJECT_NAME})
@@ -116,8 +121,6 @@ add_subdirectory(docs)
 ########################################################################
 # Python support (optional)
 ########################################################################
-option(ENABLE_PYTHON "enable python bindings" ON)
-if (ENABLE_PYTHON)
 message(STATUS "")
 message(STATUS "#############################################")
 message(STATUS "## Begin configuration for Python support...")
@@ -125,16 +128,13 @@ message(STATUS "#############################################")
 message(STATUS "Enabling optional Python bindings if possible...")
 add_subdirectory(python)
 
-if(BUILD_PYTHON3)
 message(STATUS "")
 message(STATUS "#############################################")
 message(STATUS "## Begin configuration for Python3 support...")
 message(STATUS "#############################################")
 message(STATUS "Enabling optional Python3 bindings if possible...")
 add_subdirectory(python3)
-endif(BUILD_PYTHON3)
 
-endif (ENABLE_PYTHON)
 
 ########################################################################
 # uninstall target
diff --git a/Changelog.txt b/Changelog.txt
index 1c9fe2a..df781df 100644
--- a/Changelog.txt
+++ b/Changelog.txt
@@ -1,5 +1,15 @@
 This this the changelog file for the SoapySDR project.
 
+Release 0.6.1 (2017-12-12)
+==========================
+
+- Handle null pointer in SoapySDRDevice_makeStrArgs()
+- Added read stream status to rate testing application
+- Fixed units for average byte rate in stream rate testing utility
+- Separate ENABLE_PYTHON and ENABLE_PYTHON3 options for python support
+- Moved cmake modules into subdirectory to hide them from cmake's
+  default project search path when cloned in user's home directory
+
 Release 0.6.0 (2017-04-29)
 ==========================
 
diff --git a/apps/SoapyRateTest.cpp b/apps/SoapyRateTest.cpp
index fc953b8..becd85f 100644
--- a/apps/SoapyRateTest.cpp
+++ b/apps/SoapyRateTest.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2016-2016 Josh Blum
+// Copyright (c) 2016-2017 Josh Blum
 // SPDX-License-Identifier: BSL-1.0
 
 #include <SoapySDR/Device.hpp>
@@ -37,6 +37,9 @@ void runRateTestStreamLoop(
     unsigned long long totalSamples(0);
     const auto startTime = std::chrono::high_resolution_clock::now();
     auto timeLastPrint = std::chrono::high_resolution_clock::now();
+    auto timeLastSpin = std::chrono::high_resolution_clock::now();
+    auto timeLastStatus = std::chrono::high_resolution_clock::now();
+    int spinIndex(0);
 
     std::cout << "Starting stream loop, press Ctrl+C to exit..." << std::endl;
     device->activateStream(stream);
@@ -75,15 +78,36 @@ void runRateTestStreamLoop(
         totalSamples += ret;
 
         const auto now = std::chrono::high_resolution_clock::now();
+        if (timeLastSpin + std::chrono::milliseconds(300) < now)
+        {
+            timeLastSpin = now;
+            static const char spin[] = {"|/-\\"};
+            printf("\b%c", spin[(spinIndex++)%4]);
+            fflush(stdout);
+        }
+        //occasionally read out the stream status (non blocking)
+        if (timeLastStatus + std::chrono::seconds(1) < now)
+        {
+            timeLastStatus = now;
+            while (true)
+            {
+                size_t chanMask; int flags; long long timeNs;
+                ret = device->readStreamStatus(stream, chanMask, flags, timeNs, 0);
+                if (ret == SOAPY_SDR_OVERFLOW) overflows++;
+                else if (ret == SOAPY_SDR_UNDERFLOW) underflows++;
+                else if (ret == SOAPY_SDR_TIME_ERROR) {}
+                else break;
+            }
+        }
         if (timeLastPrint + std::chrono::seconds(5) < now)
         {
             timeLastPrint = now;
             const auto timePassed = std::chrono::duration_cast<std::chrono::microseconds>(now - startTime);
             const auto sampleRate = double(totalSamples)/timePassed.count();
-            printf("%g Msps\t%g Bps", sampleRate, sampleRate*numChans*elemSize);
+            printf("\b%g Msps\t%g MBps", sampleRate, sampleRate*numChans*elemSize);
             if (overflows != 0) printf("\tOverflows %u", overflows);
             if (underflows != 0) printf("\tUnderflows %u", underflows);
-            printf("\n");
+            printf("\n ");
         }
 
     }
diff --git a/cmake/GetGitRevisionDescription.cmake b/cmake/Modules/GetGitRevisionDescription.cmake
similarity index 100%
rename from cmake/GetGitRevisionDescription.cmake
rename to cmake/Modules/GetGitRevisionDescription.cmake
diff --git a/cmake/GetGitRevisionDescription.cmake.in b/cmake/Modules/GetGitRevisionDescription.cmake.in
similarity index 100%
rename from cmake/GetGitRevisionDescription.cmake.in
rename to cmake/Modules/GetGitRevisionDescription.cmake.in
diff --git a/cmake/SoapySDRConfig.cmake b/cmake/Modules/SoapySDRConfig.cmake
similarity index 100%
rename from cmake/SoapySDRConfig.cmake
rename to cmake/Modules/SoapySDRConfig.cmake
diff --git a/cmake/SoapySDRConfigVersion.in.cmake b/cmake/Modules/SoapySDRConfigVersion.in.cmake
similarity index 100%
rename from cmake/SoapySDRConfigVersion.in.cmake
rename to cmake/Modules/SoapySDRConfigVersion.in.cmake
diff --git a/cmake/SoapySDRUtil.cmake b/cmake/Modules/SoapySDRUtil.cmake
similarity index 100%
rename from cmake/SoapySDRUtil.cmake
rename to cmake/Modules/SoapySDRUtil.cmake
diff --git a/debian/changelog b/debian/changelog
index ff973ba..5af034c 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+soapysdr (0.6.1-1) unstable; urgency=low
+
+  * Release 0.6.1 (2017-12-12)
+
+ -- Josh Blum <josh at pothosware.com>  Tue, 12 Dec 2017 19:14:44 -0000
+
 soapysdr (0.6.0-1) unstable; urgency=low
 
   * Release 0.6.0 (2017-04-29)
diff --git a/debian/rules b/debian/rules
index 197b73b..a587122 100755
--- a/debian/rules
+++ b/debian/rules
@@ -6,6 +6,7 @@ DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
 
 # extract the last section of the changelog version for extra info
 DEB_VERSION ?= $(shell dpkg-parsechangelog -S Version)
+DEB_VERSION_EXTRA := $(lastword $(subst -, ,$(DEB_VERSION)))
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
@@ -17,7 +18,7 @@ override_dh_auto_configure:
 	dh_auto_configure -- \
 		-DCMAKE_AUTOSET_INSTALL_RPATH=FALSE \
 		-DLIB_SUFFIX="/$(DEB_HOST_MULTIARCH)" \
-		-DSOAPY_SDR_EXTVER="$(DEB_VERSION)"
+		-DSOAPY_SDR_EXTVER="$(DEB_VERSION_EXTRA)"
 
 override_dh_installchangelogs:
 	dh_installchangelogs Changelog.txt
diff --git a/include/SoapySDR/Device.h b/include/SoapySDR/Device.h
index 7edfeea..bf0907d 100644
--- a/include/SoapySDR/Device.h
+++ b/include/SoapySDR/Device.h
@@ -1138,20 +1138,20 @@ SOAPY_SDR_API char **SoapySDRDevice_listSensors(const SoapySDRDevice *device, si
  * Get meta-information about a sensor.
  * Example: displayable name, type, range.
  * \param device a pointer to a device instance
- * \param name the name of an available sensor
+ * \param key the ID name of an available sensor
  * \return meta-information about a sensor
  */
-SOAPY_SDR_API SoapySDRArgInfo SoapySDRDevice_getSensorInfo(const SoapySDRDevice *device, const char *name);
+SOAPY_SDR_API SoapySDRArgInfo SoapySDRDevice_getSensorInfo(const SoapySDRDevice *device, const char *key);
 
 /*!
  * Readback a global sensor given the name.
  * The value returned is a string which can represent
  * a boolean ("true"/"false"), an integer, or float.
  * \param device a pointer to a device instance
- * \param name the name of an available sensor
+ * \param key the ID name of an available sensor
  * \return the current value of the sensor
  */
-SOAPY_SDR_API char *SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *name);
+SOAPY_SDR_API char *SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *key);
 
 /*!
  * List the available channel readback sensors.
@@ -1170,10 +1170,10 @@ SOAPY_SDR_API char **SoapySDRDevice_listChannelSensors(const SoapySDRDevice *dev
  * \param device a pointer to a device instance
  * \param direction the channel direction RX or TX
  * \param channel an available channel on the device
- * \param name the name of an available sensor
+ * \param key the ID name of an available sensor
  * \return meta-information about a sensor
  */
-SOAPY_SDR_API SoapySDRArgInfo SoapySDRDevice_getChannelSensorInfo(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
+SOAPY_SDR_API SoapySDRArgInfo SoapySDRDevice_getChannelSensorInfo(const SoapySDRDevice *device, const int direction, const size_t channel, const char *key);
 
 /*!
  * Readback a channel sensor given the name.
@@ -1182,10 +1182,10 @@ SOAPY_SDR_API SoapySDRArgInfo SoapySDRDevice_getChannelSensorInfo(const SoapySDR
  * \param device a pointer to a device instance
  * \param direction the channel direction RX or TX
  * \param channel an available channel on the device
- * \param name the name of an available sensor
+ * \param key the ID name of an available sensor
  * \return the current value of the sensor
  */
-SOAPY_SDR_API char *SoapySDRDevice_readChannelSensor(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name);
+SOAPY_SDR_API char *SoapySDRDevice_readChannelSensor(const SoapySDRDevice *device, const int direction, const size_t channel, const char *key);
 
 /*******************************************************************
  * Register API
diff --git a/include/SoapySDR/Device.hpp b/include/SoapySDR/Device.hpp
index 16865c9..66d17a7 100644
--- a/include/SoapySDR/Device.hpp
+++ b/include/SoapySDR/Device.hpp
@@ -996,19 +996,19 @@ public:
     /*!
      * Get meta-information about a sensor.
      * Example: displayable name, type, range.
-     * \param name the name of an available sensor
+     * \param key the ID name of an available sensor
      * \return meta-information about a sensor
      */
-    virtual ArgInfo getSensorInfo(const std::string &name) const;
+    virtual ArgInfo getSensorInfo(const std::string &key) const;
 
     /*!
      * Readback a global sensor given the name.
      * The value returned is a string which can represent
      * a boolean ("true"/"false"), an integer, or float.
-     * \param name the name of an available sensor
+     * \param key the ID name of an available sensor
      * \return the current value of the sensor
      */
-    virtual std::string readSensor(const std::string &name) const;
+    virtual std::string readSensor(const std::string &key) const;
 
     /*!
      * List the available channel readback sensors.
@@ -1024,10 +1024,10 @@ public:
      * Example: displayable name, type, range.
      * \param direction the channel direction RX or TX
      * \param channel an available channel on the device
-     * \param name the name of an available sensor
+     * \param key the ID name of an available sensor
      * \return meta-information about a sensor
      */
-    virtual ArgInfo getSensorInfo(const int direction, const size_t channel, const std::string &name) const;
+    virtual ArgInfo getSensorInfo(const int direction, const size_t channel, const std::string &key) const;
 
     /*!
      * Readback a channel sensor given the name.
@@ -1035,10 +1035,10 @@ public:
      * a boolean ("true"/"false"), an integer, or float.
      * \param direction the channel direction RX or TX
      * \param channel an available channel on the device
-     * \param name the name of an available sensor
+     * \param key the ID name of an available sensor
      * \return the current value of the sensor
      */
-    virtual std::string readSensor(const int direction, const size_t channel, const std::string &name) const;
+    virtual std::string readSensor(const int direction, const size_t channel, const std::string &key) const;
 
     /*******************************************************************
      * Register API
diff --git a/lib/DeviceC.cpp b/lib/DeviceC.cpp
index 1fe7707..95a4756 100644
--- a/lib/DeviceC.cpp
+++ b/lib/DeviceC.cpp
@@ -713,17 +713,17 @@ char **SoapySDRDevice_listSensors(const SoapySDRDevice *device, size_t *length)
     __SOAPY_SDR_C_CATCH_RET(nullptr);
 }
 
-SoapySDRArgInfo SoapySDRDevice_getSensorInfo(const SoapySDRDevice *device, const char *name)
+SoapySDRArgInfo SoapySDRDevice_getSensorInfo(const SoapySDRDevice *device, const char *key)
 {
     __SOAPY_SDR_C_TRY
-    return toArgInfo(device->getSensorInfo(name));
+    return toArgInfo(device->getSensorInfo(key));
     __SOAPY_SDR_C_CATCH_RET(SoapySDRArgInfoNull());
 }
 
-char *SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *name)
+char *SoapySDRDevice_readSensor(const SoapySDRDevice *device, const char *key)
 {
     __SOAPY_SDR_C_TRY
-    return strdup(device->readSensor(name).c_str());
+    return strdup(device->readSensor(key).c_str());
     __SOAPY_SDR_C_CATCH_RET(nullptr);
 }
 
@@ -735,17 +735,17 @@ char **SoapySDRDevice_listChannelSensors(const SoapySDRDevice *device, const int
     __SOAPY_SDR_C_CATCH_RET(nullptr);
 }
 
-SoapySDRArgInfo SoapySDRDevice_getChannelSensorInfo(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
+SoapySDRArgInfo SoapySDRDevice_getChannelSensorInfo(const SoapySDRDevice *device, const int direction, const size_t channel, const char *key)
 {
     __SOAPY_SDR_C_TRY
-    return toArgInfo(device->getSensorInfo(direction, channel, name));
+    return toArgInfo(device->getSensorInfo(direction, channel, key));
     __SOAPY_SDR_C_CATCH_RET(SoapySDRArgInfoNull());
 }
 
-char *SoapySDRDevice_readChannelSensor(const SoapySDRDevice *device, const int direction, const size_t channel, const char *name)
+char *SoapySDRDevice_readChannelSensor(const SoapySDRDevice *device, const int direction, const size_t channel, const char *key)
 {
     __SOAPY_SDR_C_TRY
-    return strdup(device->readSensor(direction, channel, name).c_str());
+    return strdup(device->readSensor(direction, channel, key).c_str());
     __SOAPY_SDR_C_CATCH_RET(nullptr);
 }
 
diff --git a/lib/FactoryC.cpp b/lib/FactoryC.cpp
index 47ee8e4..84549f6 100644
--- a/lib/FactoryC.cpp
+++ b/lib/FactoryC.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2016 Josh Blum
+// Copyright (c) 2014-2017 Josh Blum
 // SPDX-License-Identifier: BSL-1.0
 
 #include "ErrorHelpers.hpp"
@@ -36,7 +36,7 @@ SoapySDRDevice *SoapySDRDevice_make(const SoapySDRKwargs *args)
 SoapySDRDevice *SoapySDRDevice_makeStrArgs(const char *args)
 {
     __SOAPY_SDR_C_TRY
-    return (SoapySDRDevice *)SoapySDR::Device::make(args);
+    return (SoapySDRDevice *)SoapySDR::Device::make((args==nullptr)?"":args);
     __SOAPY_SDR_C_CATCH_RET(nullptr);
 }
 
diff --git a/lib/Version.in.cpp b/lib/Version.in.cpp
index db700f1..8a4b236 100644
--- a/lib/Version.in.cpp
+++ b/lib/Version.in.cpp
@@ -1,4 +1,4 @@
-// Copyright (c) 2014-2016 Josh Blum
+// Copyright (c) 2014-2017 Josh Blum
 // SPDX-License-Identifier: BSL-1.0
 
 #include <SoapySDR/Version.hpp>
@@ -7,9 +7,10 @@
 std::string SoapySDR::getAPIVersion(void)
 {
     std::stringstream ss;
-    ss << int((SOAPY_SDR_API_VERSION >> 24) & 0xf) << "."
-       << int((SOAPY_SDR_API_VERSION >> 16) & 0xf) << "."
-       << int((SOAPY_SDR_API_VERSION >> 0) & 0xff);
+    ss << std::hex << int((SOAPY_SDR_API_VERSION >> 24) & 0xff) << "."
+       << std::hex << int((SOAPY_SDR_API_VERSION >> 16) & 0xff) << "."
+       << std::hex << int((SOAPY_SDR_API_VERSION >> 0) & 0xffff)
+       << std::dec;
     return ss.str();
 }
 
diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index c5776c5..b1ae6d9 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -54,6 +54,7 @@ if (USE_PYTHON_CONFIG AND EXISTS ${PYTHON_CONFIG_EXECUTABLE})
         COMMAND ${PYTHON_CONFIG_EXECUTABLE}  --ldflags
         OUTPUT_STRIP_TRAILING_WHITESPACE
         OUTPUT_VARIABLE PYTHON_LIBRARIES)
+    string(STRIP "${PYTHON_LIBRARIES}" PYTHON_LIBRARIES)
     set(PYTHONLIBS_VERSION_STRING ${PYTHON_VERSION_STRING})
     set(PYTHONLIBS_FOUND TRUE)
 else()
@@ -90,6 +91,12 @@ if(PYTHON_VERSION_STRING AND "${PYTHON_VERSION_STRING}" VERSION_LESS "3.0")
     set(BUILD_PYTHON3 TRUE PARENT_SCOPE)
 endif()
 
+#or enable search for python3 when this directory failed to find
+#a full set of python interpreter and devel files of any version
+if(NOT PYTHONINTERP_FOUND OR NOT PYTHONLIBS_FOUND)
+    set(BUILD_PYTHON3 TRUE PARENT_SCOPE)
+endif()
+
 ########################################################################
 ## set the swig flags - shared with python3 build
 ########################################################################
diff --git a/python/SoapySDR.i b/python/SoapySDR.i
index ee2affc..1f7aecd 100644
--- a/python/SoapySDR.i
+++ b/python/SoapySDR.i
@@ -160,6 +160,7 @@ class Device(Device):
 
 def extractBuffPointer(buff):
     if hasattr(buff, '__array_interface__'): return buff.__array_interface__['data'][0]
+    if hasattr(buff, 'buffer_info'): return buff.buffer_info()[0]
     if hasattr(buff, '__long__'): return long(buff)
     if hasattr(buff, '__int__'): return int(buff)
     raise Exception("Unrecognized data format: " + str(type(buff)))
diff --git a/python/apps/MeasureDelay.py b/python/apps/MeasureDelay.py
index 8f3592c..7e77930 100644
--- a/python/apps/MeasureDelay.py
+++ b/python/apps/MeasureDelay.py
@@ -101,6 +101,12 @@ def measure_delay(
         if sr.ret > 0: rxBuffs = np.concatenate((rxBuffs, rxBuff[:sr.ret]))
         else: break
 
+    #cleanup streams
+    print("Cleanup streams")
+    sdr.deactivateStream(txStream)
+    sdr.closeStream(rxStream)
+    sdr.closeStream(txStream)
+
     #check resulting buffer
     if len(rxBuffs) != numRxSamps:
         raise Exception('receive fail - captured samples %d out of %d'%(len(rxBuffs), numRxSamps))
@@ -143,13 +149,6 @@ def measure_delay(
     rxPeakTime = rxTime0 + long((rxArgmaxIndex/rate)*1e9)
     timeDelta = rxPeakTime - txPeakTime
     print('>>> Time delta %f us'%(timeDelta/1e3))
-
-    #cleanup streams
-    print("Cleanup streams")
-    sdr.deactivateStream(rxStream)
-    sdr.deactivateStream(txStream)
-    sdr.closeStream(rxStream)
-    sdr.closeStream(txStream)
     print("Done!")
 
 def main():
diff --git a/python3/CMakeLists.txt b/python3/CMakeLists.txt
index 9204837..f38001b 100644
--- a/python3/CMakeLists.txt
+++ b/python3/CMakeLists.txt
@@ -55,7 +55,7 @@ endif()
 ########################################################################
 include(FeatureSummary)
 include(CMakeDependentOption)
-cmake_dependent_option(ENABLE_PYTHON3 "Enable python bindings" ON "ENABLE_LIBRARY;SWIG_FOUND;PYTHON3INTERP_FOUND;PYTHON3LIBS_FOUND;PYTHON3_DEBUG_OK" OFF)
+cmake_dependent_option(ENABLE_PYTHON3 "Enable python bindings" ON "ENABLE_LIBRARY;SWIG_FOUND;PYTHON3INTERP_FOUND;PYTHON3LIBS_FOUND;PYTHON3_DEBUG_OK;BUILD_PYTHON3" OFF)
 add_feature_info(Python3 ENABLE_PYTHON3 "python3 bindings")
 if (NOT ENABLE_PYTHON3)
     return()
diff --git a/python3/FindPython3Libs.cmake b/python3/FindPython3Libs.cmake
index 8994f0c..9af2007 100644
--- a/python3/FindPython3Libs.cmake
+++ b/python3/FindPython3Libs.cmake
@@ -156,6 +156,7 @@ if (NOT PYTHON3_LIBRARIES OR NOT PYTHON3_INCLUDE_DIRS)
             COMMAND ${PYTHON3_CONFIG_EXECUTABLE}  --ldflags
             OUTPUT_STRIP_TRAILING_WHITESPACE
             OUTPUT_VARIABLE PYTHON3_LIBRARIES)
+        string(STRIP "${PYTHON3_LIBRARIES}" PYTHON3_LIBRARIES)
     endif(PYTHON3_CONFIG_EXECUTABLE)
 endif()
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-hamradio/soapysdr.git



More information about the pkg-hamradio-commits mailing list