From: Anirudha Bose Date: Fri, 27 May 2016 21:27:31 +0000 (+0530) Subject: pybind: Fix build and libs path in rados/setup.py X-Git-Tag: ses5-milestone5~486^2~4 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=3c3206d6b82f74b4a7b5384cf4ed8fd33af1ddb8;p=ceph.git pybind: Fix build and libs path in rados/setup.py * Remove rados.c from Git tree * Remove Python 2.6, 3.2, 3.3 from classifiers * Export CEPH_LIB_DIR to setup.py files in pybind Signed-off-by: Anirudha Bose --- diff --git a/src/pybind/Makefile.am b/src/pybind/Makefile.am index 9f779dd5f8ef..b3ecd7a46b8c 100644 --- a/src/pybind/Makefile.am +++ b/src/pybind/Makefile.am @@ -13,6 +13,7 @@ PY_DISTUTILS = \ CFLAGS="-iquote \${abs_srcdir}/include ${AM_CFLAGS} ${PYTHON_CFLAGS}" \ LDFLAGS="-L\${abs_builddir}/.libs $(subst -pie,,${AM_LDFLAGS}) ${PYTHON_LDFLAGS}" \ CYTHON_BUILD_DIR=$(CYTHON_BUILD_DIR) \ + CEPH_LIB_DIR="$(abs_builddir)/.libs" \ ${PYTHON} ./setup.py if WITH_RADOS diff --git a/src/pybind/rados/setup.py b/src/pybind/rados/setup.py index 4bdfcbd89bee..90d0763307c5 100755 --- a/src/pybind/rados/setup.py +++ b/src/pybind/rados/setup.py @@ -91,10 +91,14 @@ def check_sanity(): if set(['MAKEFLAGS', 'MFLAGS', 'MAKELEVEL']).issubset(set(os.environ.keys())): # The setup.py has been invoked by a top-level Ceph make. # Set the appropriate CFLAGS and LDFLAGS - CEPH_ROOT = subprocess.check_output(['git', 'rev-parse', '--show-toplevel']).strip().decode('utf-8') + CEPH_SRC_DIR = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + '..', + '..' + ) - compiler.add_include_dir(os.path.join(CEPH_ROOT, 'src', 'include')) - compiler.add_library_dir(os.path.join(CEPH_ROOT, 'src', '.libs')) + compiler.add_include_dir(os.path.join(CEPH_SRC_DIR, 'include')) + compiler.add_library_dir(os.environ['CEPH_LIB_DIR']) try: compiler.link_executable( @@ -119,22 +123,21 @@ def check_sanity(): if not check_sanity(): sys.exit(1) -if '--without-cython' in sys.argv: +try: + from Cython.Build import cythonize +except ImportError: + print("WARNING: Cython is not installed.") + if not os.path.isfile('rados.c'): - print('Error: Cannot find Cythonized file rados.c', file=sys.stderr) - print('Retry without using --without-cython', file=sys.stderr) + print('ERROR: Cannot find Cythonized file rados.c', file=sys.stderr) sys.exit(1) + else: + def cythonize(x, **kwargs): + return x - def cythonize(x, **kwargs): - return x - - - sys.argv.remove('--without-cython') - source = "rados.c" + source = "rados.c" else: - from Cython.Build import cythonize - source = "rados.pyx" # Disable cythonification if we're not really building anything @@ -177,10 +180,7 @@ setup( 'License :: OSI Approved :: GNU Lesser General Public License v2 or later (LGPLv2+)', 'Operating System :: POSIX :: Linux', 'Programming Language :: Cython', - 'Programming Language :: Python :: 2.6', 'Programming Language :: Python :: 2.7', - 'Programming Language :: Python :: 3.2', - 'Programming Language :: Python :: 3.3', 'Programming Language :: Python :: 3.4', 'Programming Language :: Python :: 3.5' ],