summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt3
-rw-r--r--cmake/Modules/GrPython.cmake9
-rw-r--r--cmake/Modules/GrSwig.cmake6
-rw-r--r--gnuradio-runtime/swig/CMakeLists.txt1
-rw-r--r--gnuradio-runtime/swig/basic_block.i6
-rw-r--r--gnuradio-runtime/swig/gnuradio.i5
-rw-r--r--gnuradio-runtime/swig/pmt_swig.i6
-rw-r--r--gnuradio-runtime/swig/py3compat.i7
-rwxr-xr-xgr-uhd/apps/uhd_fft2
-rw-r--r--gr-utils/python/modtool/cli/base.py2
-rw-r--r--gr-utils/python/modtool/core/base.py17
-rw-r--r--gr-utils/python/modtool/tests/test_modtool.py6
-rw-r--r--grc/CMakeLists.txt9
-rw-r--r--grc/core/generator/flow_graph.py.mako9
14 files changed, 11 insertions, 77 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a842fb981..f7336d3970 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -61,8 +61,7 @@ set(GR_BOOST_MIN_VERSION "1.53")
set(GR_SWIG_MIN_VERSION "3.0.8")
set(GR_CMAKE_MIN_VERSION "3.5.1")
set(GR_MAKO_MIN_VERSION "0.4.2")
-set(GR_PYTHON_MIN_VERSION "2.7.6")
-set(GR_PYTHON3_MIN_VERSION "3.6.5")
+set(GR_PYTHON_MIN_VERSION "3.6.5")
set(GCC_MIN_VERSION "4.8.4")
set(CLANG_MIN_VERSION "3.4.0")
set(APPLECLANG_MIN_VERSION "500")
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index b7f72e666e..92af7f5a65 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -33,18 +33,13 @@ if (PYTHON_EXECUTABLE)
find_package(PythonInterp ${GR_PYTHON_MIN_VERSION} REQUIRED)
else (PYTHON_EXECUTABLE)
message(STATUS "PYTHON_EXECUTABLE not set - using default python3")
- message(STATUS "Use -DPYTHON_EXECUTABLE=/path/to/python2 to build for python2.")
- find_package(PythonInterp ${GR_PYTHON3_MIN_VERSION} REQUIRED)
+ find_package(PythonInterp ${GR_PYTHON_MIN_VERSION} REQUIRED)
endif (PYTHON_EXECUTABLE)
-if (${PYTHON_VERSION_MAJOR} VERSION_EQUAL 3)
- set(PYTHON3 TRUE)
-endif ()
-
find_package(PythonLibs ${PYTHON_VERSION_MAJOR}.${PYTHON_VERSION_MINOR} EXACT)
if (CMAKE_CROSSCOMPILING)
- set(QA_PYTHON_EXECUTABLE "/usr/bin/python")
+ set(QA_PYTHON_EXECUTABLE "/usr/bin/python3")
else (CMAKE_CROSSCOMPILING)
set(QA_PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
endif(CMAKE_CROSSCOMPILING)
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 39585ac4be..6dae9246c1 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -118,12 +118,8 @@ macro(GR_SWIG_MAKE name)
list(INSERT GR_SWIG_INCLUDE_DIRS 0 "$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>")
list(INSERT GR_SWIG_INCLUDE_DIRS 0 "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>")
- if (PYTHON3)
- set(py3 "-py3")
- endif (PYTHON3)
-
#setup the swig flags with flags and include directories
- set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -w314 -relativeimport ${py3} -module ${name} ${GR_SWIG_FLAGS})
+ set(CMAKE_SWIG_FLAGS -fvirtual -modern -keyword -w511 -w314 -relativeimport -py3 -module ${name} ${GR_SWIG_FLAGS})
#set the C++ property on the swig .i file so it builds
set_source_files_properties(${ifiles} PROPERTIES CPLUSPLUS ON)
diff --git a/gnuradio-runtime/swig/CMakeLists.txt b/gnuradio-runtime/swig/CMakeLists.txt
index bade4beeaa..e39693e4c3 100644
--- a/gnuradio-runtime/swig/CMakeLists.txt
+++ b/gnuradio-runtime/swig/CMakeLists.txt
@@ -101,7 +101,6 @@ install(
msg_queue.i
pmt_swig.i
prefs.i
- py3compat.i
realtime.i
sync_block.i
sync_decimator.i
diff --git a/gnuradio-runtime/swig/basic_block.i b/gnuradio-runtime/swig/basic_block.i
index 363e121bc6..cf75479bb8 100644
--- a/gnuradio-runtime/swig/basic_block.i
+++ b/gnuradio-runtime/swig/basic_block.i
@@ -31,10 +31,6 @@ namespace std {
%template(x_vector_basic_block_sptr) vector<gr::basic_block_sptr>;
};
-%begin %{
-#define SWIG_PYTHON_2_UNICODE
-%}
-
namespace gr {
class gr::basic_block
@@ -64,8 +60,6 @@ namespace gr {
}
#ifdef SWIGPYTHON
-%import py3compat.i
-
%pythoncode %{
basic_block_sptr.__repr__ = lambda self: "<basic_block %s (%d)>" % (self.name(), self.unique_id ())
%}
diff --git a/gnuradio-runtime/swig/gnuradio.i b/gnuradio-runtime/swig/gnuradio.i
index 211f0a92d2..555372eeac 100644
--- a/gnuradio-runtime/swig/gnuradio.i
+++ b/gnuradio-runtime/swig/gnuradio.i
@@ -78,10 +78,5 @@
// Python 2/3 compatibility
%begin %{
-#define SWIG_PYTHON_2_UNICODE
#define SWIG_PYTHON_CAST_MODE
%}
-
-#ifdef SWIGPYTHON
-%import py3compat.i
-#endif
diff --git a/gnuradio-runtime/swig/pmt_swig.i b/gnuradio-runtime/swig/pmt_swig.i
index c6ac444fba..cd529d657e 100644
--- a/gnuradio-runtime/swig/pmt_swig.i
+++ b/gnuradio-runtime/swig/pmt_swig.i
@@ -25,10 +25,6 @@
%include "std_string.i"
%include "stdint.i"
-%begin %{
-#define SWIG_PYTHON_2_UNICODE
-%}
-
%{
#include <boost/shared_ptr.hpp>
#include <boost/any.hpp>
@@ -79,8 +75,6 @@ namespace pmt {
%template(pmt_vector_cfloat) std::vector< std::complex<float> >;
%template(pmt_vector_cdouble) std::vector< std::complex<double> >;
-%import py3compat.i
-
////////////////////////////////////////////////////////////////////////
// Language independent exception handler
////////////////////////////////////////////////////////////////////////
diff --git a/gnuradio-runtime/swig/py3compat.i b/gnuradio-runtime/swig/py3compat.i
deleted file mode 100644
index 6e726c294f..0000000000
--- a/gnuradio-runtime/swig/py3compat.i
+++ /dev/null
@@ -1,7 +0,0 @@
-%begin %{
-#define SWIG_PYTHON_2_UNICODE
-%}
-
-%pythonbegin %{
-from __future__ import absolute_import
-%}
diff --git a/gr-uhd/apps/uhd_fft b/gr-uhd/apps/uhd_fft
index c9607670cf..2d64e85813 100755
--- a/gr-uhd/apps/uhd_fft
+++ b/gr-uhd/apps/uhd_fft
@@ -1,4 +1,4 @@
-#!/usr/bin/env python
+#!/usr/bin/env python3
#
# Copyright 2015-2016,2018 Free Software Foundation, Inc.
#
diff --git a/gr-utils/python/modtool/cli/base.py b/gr-utils/python/modtool/cli/base.py
index 5fa2b8b7b4..d0259372ff 100644
--- a/gr-utils/python/modtool/cli/base.py
+++ b/gr-utils/python/modtool/cli/base.py
@@ -73,8 +73,6 @@ class CommandCLI(click.Group):
command is the priority over the same external plug-in command.
"""
try:
- if sys.version_info[0] == 2:
- cmd_name = cmd_name.encode('ascii', 'replace')
mod = import_module('gnuradio.modtool.cli.' + cmd_name)
except ImportError:
return self.commands.get(cmd_name)
diff --git a/gr-utils/python/modtool/core/base.py b/gr-utils/python/modtool/core/base.py
index 55b6f48076..d9f6a3b6e2 100644
--- a/gr-utils/python/modtool/core/base.py
+++ b/gr-utils/python/modtool/core/base.py
@@ -30,22 +30,7 @@ import glob
import logging
import itertools
-try:
- from types import SimpleNamespace
-except:
- # Py2.7 doesn't have SimpleNamespace, soooo use what Py3 docs say is roughly equivalent
- class SimpleNamespace:
- def __init__(self, **kwargs):
- self.__dict__.update(kwargs)
-
- def __repr__(self):
- keys = sorted(self.__dict__)
- items = ("{}={!r}".format(k, self.__dict__[k]) for k in keys)
- return "{}({})".format(type(self).__name__, ", ".join(items))
-
- def __eq__(self, other):
- return self.__dict__ == other.__dict__
-
+from types import SimpleNamespace
from gnuradio import gr
from ..tools import get_modname, SCMRepoFactory
diff --git a/gr-utils/python/modtool/tests/test_modtool.py b/gr-utils/python/modtool/tests/test_modtool.py
index 957a5e7d54..3cfd735f90 100644
--- a/gr-utils/python/modtool/tests/test_modtool.py
+++ b/gr-utils/python/modtool/tests/test_modtool.py
@@ -64,11 +64,7 @@ class TestModToolCore(unittest.TestCase):
def setUp(self):
""" create a new module and block before every test """
try:
- try:
- warnings.simplefilter("ignore", ResourceWarning)
- except (NameError):
- # Python2 , Python3 < 3.2 don't know ResourceWarning
- pass
+ warnings.simplefilter("ignore", ResourceWarning)
args = {'module_name':'howto',
'directory': self.test_dir,
'srcdir': self.srcdir}
diff --git a/grc/CMakeLists.txt b/grc/CMakeLists.txt
index ba69764f8a..9a807e1cc0 100644
--- a/grc/CMakeLists.txt
+++ b/grc/CMakeLists.txt
@@ -25,10 +25,9 @@ include(GrPython)
message(STATUS "")
GR_PYTHON_CHECK_MODULE_RAW(
- "python2 >= 2.7.6 or python3 >= 3.6.5"
+ "python3 >= ${GR_PYTHON_MIN_VERSION}"
"import sys; \
- requirement = (3, 6, 5) if sys.version_info.major >= 3 else (2, 7, 6); \
- assert sys.version_info[:3] >= requirement"
+ assert '.'.join([str(x) for x in sys.version_info[:3]]) >= '${GR_PYTHON_MIN_VERSION}'"
PYTHON_MIN_VER_FOUND
)
@@ -39,8 +38,8 @@ GR_PYTHON_CHECK_MODULE_RAW(
)
GR_PYTHON_CHECK_MODULE_RAW(
- "mako >= 0.9.1"
- "import mako; assert mako.__version__ >= '0.9.1'"
+ "mako >= ${GR_MAKO_MIN_VERSION}"
+ "import mako; assert mako.__version__ >= '${GR_MAKO_MIN_VERSION}'"
MAKO_FOUND
)
diff --git a/grc/core/generator/flow_graph.py.mako b/grc/core/generator/flow_graph.py.mako
index 8da3011749..3fb540d8d1 100644
--- a/grc/core/generator/flow_graph.py.mako
+++ b/grc/core/generator/flow_graph.py.mako
@@ -1,15 +1,6 @@
% if not generate_options.startswith('hb'):
-<%
-from sys import version_info
-from gnuradio import eng_notation
-python_version = version_info.major
-%>\
-% if python_version == 2:
-#!/usr/bin/env python2
-% elif python_version == 3:
#!/usr/bin/env python3
% endif
-% endif
# -*- coding: utf-8 -*-
<%def name="indent(code)">${ '\n '.join(str(code).splitlines()) }</%def>
#