python: Added upm directory for python modules

* Grouped UPM python modules into upm directory, for example:
      /usr/local/lib/python2.7/dist-packages/upm
    * Updated UPM example import statements
    * Removed unused RPATH statements from UPM src CMakeLists.txt,
      currently build collateral contains an explicit RPATH which
      is stripped from the install collateral.
    * Converted python examples to work on both python2 AND python3
    * Added ctest for loading examples w/python3
    * Removed returns from swig macros
    * UPM python module use will change...
        Before:
            import pyupm_dfrph
        After:
            from upm import pyupm_dfrph
            or
            import upm.pyupm_dfrph
            etc...
    * This commit fixes #468

Signed-off-by: Noel Eck <noel.eck@intel.com>
This commit is contained in:
Noel Eck
2016-10-10 14:48:42 -07:00
parent 8624a07b77
commit bf425014ab
190 changed files with 1439 additions and 1234 deletions

View File

@ -56,10 +56,16 @@ if (BUILDSWIGPYTHON AND PYTHON2INTERP_FOUND)
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/)
endif (BUILDSWIGPYTHON AND PYTHON2INTERP_FOUND)
# Add a python3 test
# Add some python3 tests
if (BUILDSWIGPYTHON AND PYTHON3INTERP_FOUND)
add_test (NAME check_load_modules_python3 COMMAND ${PYTHON3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/check_pythonload.py
${CMAKE_BINARY_DIR}/src/*/python${PYTHON3_VERSION_MAJOR}.${PYTHON3_VERSION_MINOR}/*.py
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/)
# Test load examples w/python3
add_test (NAME check_load_examples_python3 COMMAND ${PYTHON3_EXECUTABLE}
${CMAKE_CURRENT_SOURCE_DIR}/check_pythonload.py
${CMAKE_SOURCE_DIR}/examples/python/*.py
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/src/)
endif (BUILDSWIGPYTHON AND PYTHON3INTERP_FOUND)

View File

@ -59,7 +59,9 @@ class loadModule(unittest.TestCase):
skeys = list(failures.keys())
skeys.sort()
self.assertEqual(len(failures), 0,
'\n\nFailed to load %d modules:\n' % len(failures) +
'\n\n%s' % '\n'.join((['%s=%s' % (k, os.environ[k]) for k in list(os.environ.keys())])) +
'\npython %s\n' % ' '.join(sys.version.strip().split()) +
'\nFailed to load %d modules:\n' % len(failures) +
'\n'.join(['%s: %s' % (k, failures[k]) for k in skeys]))
if __name__ == '__main__':