Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: install platlib into a subdir of build-base dir #10666

Merged
merged 1 commit into from Aug 10, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmake/modules/AddCephTest.cmake
Expand Up @@ -13,7 +13,7 @@ function(add_ceph_test test_name test_path)
CEPH_BUILD_DIR=${CMAKE_BINARY_DIR}
LD_LIBRARY_PATH=${CMAKE_BINARY_DIR}/lib
PATH=${CMAKE_RUNTIME_OUTPUT_DIRECTORY}:${CMAKE_SOURCE_DIR}/src:$ENV{PATH}
PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules:${CMAKE_SOURCE_DIR}/src/pybind
PYTHONPATH=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/cython_modules/lib.${PYTHON_VERSION_MAJOR}:${CMAKE_SOURCE_DIR}/src/pybind
CEPH_BUILD_VIRTUALENV=${CEPH_BUILD_VIRTUALENV})
# none of the tests should take more than 1 hour to complete
set_property(TEST
Expand Down
4 changes: 2 additions & 2 deletions cmake/modules/Distutils.cmake
Expand Up @@ -47,7 +47,7 @@ function(distutils_add_cython_module name src)
CEPH_LIBDIR=${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
CFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include\"
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
build --build-base ${CYTHON_MODULE_DIR} --build-platlib ${CYTHON_MODULE_DIR} --verbose
build --build-base ${CYTHON_MODULE_DIR} --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON_VERSION_MAJOR} --verbose
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${src})
endfunction(distutils_add_cython_module)
Expand All @@ -71,7 +71,7 @@ function(distutils_install_cython_module name)
CPPFLAGS=\"-iquote${CMAKE_SOURCE_DIR}/src/include\"
LDFLAGS=\"-L${CMAKE_LIBRARY_OUTPUT_DIRECTORY}\"
${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/setup.py
build --build-base ${CYTHON_MODULE_DIR} --build-platlib ${CYTHON_MODULE_DIR} --verbose
build --build-base ${CYTHON_MODULE_DIR} --build-platlib ${CYTHON_MODULE_DIR}/lib.${PYTHON_VERSION_MAJOR} --verbose
build_ext --cython-c-in-temp --build-temp ${CMAKE_CURRENT_BINARY_DIR} --cython-include-dirs ${PROJECT_SOURCE_DIR}/src/pybind/rados
install \${options} --single-version-externally-managed --record /dev/null
egg_info --egg-base ${CMAKE_CURRENT_BINARY_DIR}
Expand Down
10 changes: 8 additions & 2 deletions src/ceph.in
Expand Up @@ -66,12 +66,16 @@ def respawn_in_path(lib_path, pybind_path, pythonlib_path):
sys.path.insert(0, os.path.join(MYDIR, pybind_path))
sys.path.insert(0, os.path.join(MYDIR, pythonlib_path))

def get_pythonlib_dir():
"""Returns the name of a distutils build directory"""
return "lib.{version[0]}".format(version=sys.version_info)

if MYDIR.endswith('src') and \
os.path.exists(os.path.join(MYDIR, '.libs')) and \
os.path.exists(os.path.join(MYDIR, 'pybind')) and \
os.path.exists(os.path.join(MYDIR, 'build')):

python_libpath = os.path.join(MYDIR, 'build')
python_libpath = os.path.join(MYDIR, 'build', get_pythonlib_dir())
respawn_in_path(os.path.join(MYDIR, '.libs'), 'pybind', python_libpath)
if 'PATH' in os.environ and MYDIR not in os.environ['PATH']:
os.environ['PATH'] += ':' + MYDIR
Expand All @@ -92,7 +96,9 @@ elif os.path.exists(os.path.join(os.getcwd(), "CMakeCache.txt")) \
lib_path = os.path.join(os.getcwd(), "lib")
bin_path = os.path.join(os.getcwd(), "bin")
pybind_path = os.path.join(src_path, "src", "pybind")
pythonlib_path = os.path.join(lib_path, "cython_modules")
pythonlib_path = os.path.join(lib_path,
"cython_modules",
get_pythonlib_dir())

respawn_in_path(lib_path, pybind_path, pythonlib_path)

Expand Down
2 changes: 1 addition & 1 deletion src/pybind/cephfs/Makefile.am
Expand Up @@ -23,7 +23,7 @@ cephfs-pybind-install-exec: ${srcdir}/ceph_ver.h
fi ; \
cd $(srcdir)/pybind/cephfs; $(PY_DISTUTILS) build \
--build-base $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build/lib.2 \
install \
$$options $$root \
--single-version-externally-managed \
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/rados/Makefile.am
Expand Up @@ -23,7 +23,7 @@ rados-pybind-install-exec: ${srcdir}/ceph_ver.h
fi ; \
cd $(srcdir)/pybind/rados; $(PY_DISTUTILS) build \
--build-base $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build/lib.2 \
install \
$$options $$root \
--single-version-externally-managed \
Expand Down
2 changes: 1 addition & 1 deletion src/pybind/rbd/Makefile.am
Expand Up @@ -23,7 +23,7 @@ rbd-pybind-install-exec: ${srcdir}/ceph_ver.h
fi ; \
cd $(srcdir)/pybind/rbd; $(PY_DISTUTILS) build \
--build-base $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build \
--build-platlib $(shell readlink -f $(builddir))/build/lib.2 \
install \
$$options $$root \
--single-version-externally-managed \
Expand Down