summaryrefslogtreecommitdiff
path: root/gnuradio-runtime/lib
diff options
context:
space:
mode:
authorDouglas Anderson <danderson@ntia.doc.gov>2017-02-12 15:52:19 -0800
committerJohnathan Corgan <johnathan@corganlabs.com>2017-02-26 18:21:22 -0800
commit9e625c4821f4c63421b3d3747c0c4f358fef6c5f (patch)
tree41dedbe053417be7314cdce15d64fbbb89db4d8d /gnuradio-runtime/lib
parente5aabcc6a4a9335f3ef8abf5f89104b626e9364d (diff)
python3: update non-GRC components to use python2 or python3
Diffstat (limited to 'gnuradio-runtime/lib')
-rw-r--r--gnuradio-runtime/lib/CMakeLists.txt6
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/lib/math/gen_sine_table.py6
-rw-r--r--gnuradio-runtime/lib/pmt/CMakeLists.txt2
-rw-r--r--gnuradio-runtime/lib/pmt/gen-serial-tags.py5
-rw-r--r--[-rwxr-xr-x]gnuradio-runtime/lib/pmt/generate_unv.py3
-rw-r--r--gnuradio-runtime/lib/sptr_magic.cc2
6 files changed, 15 insertions, 9 deletions
diff --git a/gnuradio-runtime/lib/CMakeLists.txt b/gnuradio-runtime/lib/CMakeLists.txt
index c6e42876ce..e461889858 100644
--- a/gnuradio-runtime/lib/CMakeLists.txt
+++ b/gnuradio-runtime/lib/CMakeLists.txt
@@ -24,7 +24,7 @@ GR_CHECK_HDR_N_DEF(sys/resource.h HAVE_SYS_RESOURCE_H)
# Handle the generated constants
########################################################################
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c
- "import time;print time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime())"
+ "import time;print(time.strftime('%a, %d %b %Y %H:%M:%S', time.gmtime()))"
OUTPUT_VARIABLE BUILD_DATE OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "Loading build date ${BUILD_DATE} into constants...")
@@ -53,8 +53,8 @@ list(APPEND gnuradio_runtime_sources ${CMAKE_CURRENT_BINARY_DIR}/constants.cc)
########################################################################
include_directories(${GNURADIO_RUNTIME_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}
- ${CMAKE_CURRENT_BINARY_DIR}/../include/
- ${VOLK_INCLUDE_DIRS}
+ ${CMAKE_CURRENT_BINARY_DIR}/../include/
+ ${VOLK_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
)
diff --git a/gnuradio-runtime/lib/math/gen_sine_table.py b/gnuradio-runtime/lib/math/gen_sine_table.py
index d7d11eff11..75e3a0c58f 100755..100644
--- a/gnuradio-runtime/lib/math/gen_sine_table.py
+++ b/gnuradio-runtime/lib/math/gen_sine_table.py
@@ -20,6 +20,8 @@
# Boston, MA 02110-1301, USA.
#
+from __future__ import division
+from __future__ import unicode_literals
import math
import sys
@@ -38,8 +40,8 @@ def gen_approx_table (f, nentries, min_x, max_x):
for i in range (nentries):
a = (i * incx) + min_x
b = ((i + 1) * incx) + min_x
- m = (f(b)-f(a))/(b-a)
- c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f((a+b)/2) + f(a))/2
+ m = (f(b)-f(a)) / (b-a)
+ c = (3*a+b)*(f(a)-f(b))/(4*(b-a)) + (f(old_div((a+b) / 2) + f(a)),2)
abs_error = c+m*a-f(a)
r.append ((m, c, abs_error))
return r
diff --git a/gnuradio-runtime/lib/pmt/CMakeLists.txt b/gnuradio-runtime/lib/pmt/CMakeLists.txt
index e5c8f2f47e..85b2a4d6e0 100644
--- a/gnuradio-runtime/lib/pmt/CMakeLists.txt
+++ b/gnuradio-runtime/lib/pmt/CMakeLists.txt
@@ -66,7 +66,7 @@ add_custom_command(
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.h.t
${CMAKE_CURRENT_SOURCE_DIR}/unv_template.cc.t
${CMAKE_CURRENT_SOURCE_DIR}/unv_qa_template.cc.t
- COMMAND ${PYTHON_EXECUTABLE} ${PYTHON_DASH_B} -c
+ COMMAND ${PYTHON_EXECUTABLE} -B -c
"import os, sys; srcdir='${CMAKE_CURRENT_SOURCE_DIR}'; sys.path.append(srcdir); os.environ['srcdir']=srcdir; from generate_unv import main; main()"
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
VERBATIM
diff --git a/gnuradio-runtime/lib/pmt/gen-serial-tags.py b/gnuradio-runtime/lib/pmt/gen-serial-tags.py
index 18e927beb5..2ff2240a47 100644
--- a/gnuradio-runtime/lib/pmt/gen-serial-tags.py
+++ b/gnuradio-runtime/lib/pmt/gen-serial-tags.py
@@ -32,11 +32,14 @@ enum pst_tags {
#endif /* INCLUDED_PMT_SERIAL_TAGS_H */
"""
+from __future__ import print_function
+from __future__ import unicode_literals
+
import sys, os, re
if __name__ == '__main__':
if len(sys.argv) != 3:
- print "Usage %s <input_scm_file> <output_hdr_file>"%__file__
+ print("Usage %s <input_scm_file> <output_hdr_file>"%__file__)
exit()
input_scm_file, output_hdr_file = sys.argv[1:]
enums = list()
diff --git a/gnuradio-runtime/lib/pmt/generate_unv.py b/gnuradio-runtime/lib/pmt/generate_unv.py
index 6218099fc1..45c57a3fb8 100755..100644
--- a/gnuradio-runtime/lib/pmt/generate_unv.py
+++ b/gnuradio-runtime/lib/pmt/generate_unv.py
@@ -23,6 +23,7 @@
"""
Generate code for uniform numeric vectors
"""
+from __future__ import unicode_literals
import re, os, os.path
@@ -93,7 +94,7 @@ using namespace pmt;
# set srcdir to the directory that contains Makefile.am
try:
srcdir = os.environ['srcdir']
-except KeyError, e:
+except KeyError as e:
srcdir = "."
srcdir = srcdir + '/'
diff --git a/gnuradio-runtime/lib/sptr_magic.cc b/gnuradio-runtime/lib/sptr_magic.cc
index e5e83722fc..bffef04756 100644
--- a/gnuradio-runtime/lib/sptr_magic.cc
+++ b/gnuradio-runtime/lib/sptr_magic.cc
@@ -102,4 +102,4 @@ namespace gnuradio {
s_map.erase(pos);
return sptr;
}
-};
+}