[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Commit-gnuradio] [gnuradio] 02/20: python3: add cmake support for pytho
From: |
git |
Subject: |
[Commit-gnuradio] [gnuradio] 02/20: python3: add cmake support for python3 at top level |
Date: |
Sun, 25 Dec 2016 03:59:56 +0000 (UTC) |
This is an automated email from the git hooks/post-receive script.
jcorgan pushed a commit to branch python3
in repository gnuradio.
commit 8150fa5b3a2c721fc44b17cd8ea61650f52f8a6d
Author: Douglas Anderson <address@hidden>
Date: Tue Dec 20 14:44:08 2016 -0800
python3: add cmake support for python3 at top level
---
CMakeLists.txt | 3 ++-
cmake/Modules/GrPython.cmake | 13 +++++++------
cmake/Modules/GrSwig.cmake | 4 ++--
cmake/Modules/UseSWIG.cmake | 2 +-
4 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3c5ef6e..9847694 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -149,7 +149,7 @@ if(MSVC)
endif(MSVC)
if(WIN32)
- add_definitions(-D_USE_MATH_DEFINES)
+ add_definitions(-D_USE_MATH_DEFINES)
endif(WIN32)
# Record Compiler Info for record
@@ -282,6 +282,7 @@ include(GrBoost)
########################################################################
# Enable python component
########################################################################
+set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package(PythonLibs 2)
find_package(SWIG)
diff --git a/cmake/Modules/GrPython.cmake b/cmake/Modules/GrPython.cmake
index 0bfa92d..cdd87de 100644
--- a/cmake/Modules/GrPython.cmake
+++ b/cmake/Modules/GrPython.cmake
@@ -1,4 +1,4 @@
-# Copyright 2010-2011 Free Software Foundation, Inc.
+# Copyright 2010-2016 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
@@ -36,11 +36,12 @@ if(PYTHON_EXECUTABLE)
else(PYTHON_EXECUTABLE)
#use the built-in find script
+ set(Python_ADDITIONAL_VERSIONS 3.4 3.5 3.6)
find_package(PythonInterp 2)
#and if that fails use the find program routine
if(NOT PYTHONINTERP_FOUND)
- find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7
python2.6 python2.5)
+ find_program(PYTHON_EXECUTABLE NAMES python python2 python2.7 python3)
if(PYTHON_EXECUTABLE)
set(PYTHONINTERP_FOUND TRUE)
endif(PYTHON_EXECUTABLE)
@@ -86,7 +87,7 @@ macro(GR_PYTHON_CHECK_MODULE desc mod cmd have)
try:
import ${mod}
assert ${cmd}
-except ImportError, AssertionError: exit(-1)
+except (ImportError, AssertionError): exit(-1)
except: pass
#########################################"
RESULT_VARIABLE ${have}
@@ -106,7 +107,7 @@ endmacro(GR_PYTHON_CHECK_MODULE)
if(NOT DEFINED GR_PYTHON_DIR)
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "
from distutils import sysconfig
-print sysconfig.get_python_lib(plat_specific=True, prefix='')
+print(sysconfig.get_python_lib(plat_specific=True, prefix=''))
" OUTPUT_VARIABLE GR_PYTHON_DIR OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
@@ -119,7 +120,7 @@ file(TO_CMAKE_PATH ${GR_PYTHON_DIR} GR_PYTHON_DIR)
function(GR_UNIQUE_TARGET desc)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${desc} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE)
add_custom_target(${_target} ALL DEPENDS ${ARGN})
@@ -233,7 +234,7 @@ endfunction(GR_PYTHON_INSTALL)
file(WRITE ${CMAKE_BINARY_DIR}/python_compile_helper.py "
import sys, py_compile
files = sys.argv[1:]
-srcs, gens = files[:len(files)/2], files[len(files)/2:]
+srcs, gens = files[:len(files)//2], files[len(files)//2:]
for src, gen in zip(srcs, gens):
py_compile.compile(file=src, cfile=gen, doraise=True)
")
diff --git a/cmake/Modules/GrSwig.cmake b/cmake/Modules/GrSwig.cmake
index 400cde2..cb1e5d9 100644
--- a/cmake/Modules/GrSwig.cmake
+++ b/cmake/Modules/GrSwig.cmake
@@ -236,7 +236,7 @@ endmacro(GR_SWIG_INSTALL)
########################################################################
file(WRITE ${CMAKE_BINARY_DIR}/get_swig_deps.py "
-import os, sys, re
+import os, sys, re, io
i_include_matcher = re.compile('%(include|import)\\s*[<|\"](.*)[>|\"]')
h_include_matcher = re.compile('#(include)\\s*[<|\"](.*)[>|\"]')
@@ -245,7 +245,7 @@ include_dirs = sys.argv[2].split(';')
def get_swig_incs(file_path):
if file_path.endswith('.i'): matcher = i_include_matcher
else: matcher = h_include_matcher
- file_contents = open(file_path, 'r').read()
+ file_contents = io.open(file_path, 'r', encoding='utf-8').read()
return matcher.findall(file_contents, re.MULTILINE)
def get_swig_deps(file_path, level):
diff --git a/cmake/Modules/UseSWIG.cmake b/cmake/Modules/UseSWIG.cmake
index d101494..43b4bea 100644
--- a/cmake/Modules/UseSWIG.cmake
+++ b/cmake/Modules/UseSWIG.cmake
@@ -175,7 +175,7 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile)
file(RELATIVE_PATH reldir ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR})
execute_process(
COMMAND ${PYTHON_EXECUTABLE} -c "import re, hashlib
-unique = hashlib.md5('${reldir}${ARGN}').hexdigest()[:5]
+unique = hashlib.md5(b'${reldir}${ARGN}').hexdigest()[:5]
print(re.sub('\\W', '_', '${name} ${reldir} ' + unique))"
OUTPUT_VARIABLE _target OUTPUT_STRIP_TRAILING_WHITESPACE
)
- [Commit-gnuradio] [gnuradio] branch python3 created (now 23af6b8), git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 12/20: python3: update gr-trellis for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 01/20: volk: update submodule to latest master, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 15/20: python3: update gr-vocoder for python support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 19/20: python3: use site instead of distutils, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 20/20: python3: futurize misplaced __future__ import, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 05/20: python3: update gr-analog for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 06/20: python3: update gr-blocks python files for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 08/20: python3: update gr-dtv for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 02/20: python3: add cmake support for python3 at top level,
git <=
- [Commit-gnuradio] [gnuradio] 17/20: python3: fix issues detected by futurize, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 16/20: python3: update gr-zeromq for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 11/20: python3: update gr-qtgui for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 13/20: python3: update gr-uhd for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 04/20: python3: update gnuradio-runtime for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 03/20: python3: update doxygen files to build docs with python3, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 09/20: python3: update gr-fec for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 14/20: python3: update gr-utils for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 10/20: python3: update gr-filter for python3 support, git, 2016/12/24
- [Commit-gnuradio] [gnuradio] 07/20: python3: update gr-digital for python3 support, git, 2016/12/24