Fix grcc compilation with python3 by adding local subdirs to __path__
As the directory structure in the repository is different then the one after the package gets installed we need to add those subdirectories to the __path__ otherwise python3 is not able to load the modules using the relative import syntax and grcc compilation and some unit tests fail. Mofiy __path__ only when the CMAKE_BINARY_DIR environment variable is present. Revert "grgsm_livemon: Set cell_allocation to [0]" This reverts commit 013d4c258c6ad31c2581f0caa4eee3aa609fd9de. Change-Id: I223fd6181e8e36027039301186b671712a597ff8
This commit is contained in:
parent
783a1f7b56
commit
6eea94f7de
|
@ -360,7 +360,7 @@ blocks:
|
||||||
parameters:
|
parameters:
|
||||||
affinity: ''
|
affinity: ''
|
||||||
alias: ''
|
alias: ''
|
||||||
cell_allocation: '[0]'
|
cell_allocation: '[arfcn.downlink2arfcn(fc)]'
|
||||||
comment: ''
|
comment: ''
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
|
|
|
@ -315,7 +315,7 @@ blocks:
|
||||||
parameters:
|
parameters:
|
||||||
affinity: ''
|
affinity: ''
|
||||||
alias: ''
|
alias: ''
|
||||||
cell_allocation: '[0]'
|
cell_allocation: '[arfcn.downlink2arfcn(fc)]'
|
||||||
comment: ''
|
comment: ''
|
||||||
maxoutbuf: '0'
|
maxoutbuf: '0'
|
||||||
minoutbuf: '0'
|
minoutbuf: '0'
|
||||||
|
|
|
@ -39,6 +39,7 @@ macro(GRCC_COMPILE file_name)
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
|
||||||
COMMAND "${CMAKE_COMMAND}"
|
COMMAND "${CMAKE_COMMAND}"
|
||||||
-E env PYTHONPATH="${PYTHONPATH}" GRC_BLOCKS_PATH=${CMAKE_SOURCE_DIR}/grc
|
-E env PYTHONPATH="${PYTHONPATH}" GRC_BLOCKS_PATH=${CMAKE_SOURCE_DIR}/grc
|
||||||
|
CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}
|
||||||
${GRCC} -o ${CMAKE_CURRENT_BINARY_DIR}
|
${GRCC} -o ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.grc
|
${CMAKE_CURRENT_SOURCE_DIR}/${file_name}.grc
|
||||||
COMMAND "${CMAKE_COMMAND}" -E rename ${CMAKE_CURRENT_BINARY_DIR}/${file_name}.py ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
|
COMMAND "${CMAKE_COMMAND}" -E rename ${CMAKE_CURRENT_BINARY_DIR}/${file_name}.py ${CMAKE_CURRENT_BINARY_DIR}/${file_name}
|
||||||
|
|
|
@ -47,7 +47,8 @@ GR_PYTHON_INSTALL(
|
||||||
include(GrTest)
|
include(GrTest)
|
||||||
|
|
||||||
set(GR_TEST_TARGET_DEPS gr-gsm)
|
set(GR_TEST_TARGET_DEPS gr-gsm)
|
||||||
set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig:${CMAKE_BINARY_DIR}/python/misc_utils:${CMAKE_BINARY_DIR}/python/receiver:${CMAKE_BINARY_DIR}/python/demapping:${CMAKE_BINARY_DIR}/python/transmitter)
|
set(GR_TEST_PYTHON_DIRS ${CMAKE_BINARY_DIR}/swig:${CMAKE_BINARY_DIR}/python/misc_utils)
|
||||||
|
set(GR_TEST_ENVIRONS "CMAKE_BINARY_DIR=${CMAKE_BINARY_DIR}")
|
||||||
GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
|
GR_ADD_TEST(qa_arfcn ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_arfcn.py)
|
||||||
GR_ADD_TEST(qa_decryption ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_decryption.py)
|
GR_ADD_TEST(qa_decryption ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_decryption.py)
|
||||||
GR_ADD_TEST(qa_burst_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_printer.py)
|
GR_ADD_TEST(qa_burst_printer ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/qa_burst_printer.py)
|
||||||
|
|
|
@ -23,6 +23,25 @@ This is the GNU Radio GSM module. Place your Python package
|
||||||
description here (python/__init__.py).
|
description here (python/__init__.py).
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
if "CMAKE_BINARY_DIR" in os.environ:
|
||||||
|
dirname, filename = os.path.split(os.path.abspath(__file__))
|
||||||
|
|
||||||
|
# As the directory structure in the repository is different then the one after the package
|
||||||
|
# gets installed we need to add those subdirectories to the __path__ otherwise python3 is
|
||||||
|
# not able to load the modules using the relative import syntax and grcc compilation and
|
||||||
|
# some unit tests fail.
|
||||||
|
__path__ += [
|
||||||
|
# Load the local (not yet installed) grgsm_swig from the ../swig subdirectory.
|
||||||
|
os.path.join(os.environ.get("CMAKE_BINARY_DIR"), "swig"),
|
||||||
|
|
||||||
|
# Load the local (not yet installed) python modules from the local subdirectories
|
||||||
|
os.path.join(dirname, "misc_utils"),
|
||||||
|
os.path.join(dirname, "receiver"),
|
||||||
|
os.path.join(dirname, "demapping"),
|
||||||
|
os.path.join(dirname, "transmitter"),
|
||||||
|
os.path.join(dirname, "trx")]
|
||||||
|
|
||||||
# import swig generated symbols into the gsm namespace
|
# import swig generated symbols into the gsm namespace
|
||||||
from .grgsm_swig import *
|
from .grgsm_swig import *
|
||||||
|
|
Loading…
Reference in New Issue