Skip to content

Commit

Permalink
[Python] Use right cmake binary.
Browse files Browse the repository at this point in the history
  • Loading branch information
simonmichal committed Jan 20, 2020
1 parent 29e6751 commit 11b3977
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 5 deletions.
3 changes: 2 additions & 1 deletion packaging/wheel/install.sh
Expand Up @@ -12,7 +12,8 @@ cd xrootdbuild
# (for the python bindings we don't want to install the binaries)
CMAKE_ARGS="-DXRDCL_LIB_ONLY=TRUE -DENABLE_PYTHON=TRUE -DCMAKE_INSTALL_PREFIX=$1 -DXRD_PYTHON_REQ_VERSION=$2 -DCMAKE_INSTALL_BINDIR=$startdir/xrootdbuild/bin"

cmake .. $CMAKE_ARGS
cmake_path=$4
$cmake_path .. $CMAKE_ARGS

res=$?
if [ "$res" -ne "0" ]; then
Expand Down
30 changes: 26 additions & 4 deletions packaging/wheel/setup.py
Expand Up @@ -30,6 +30,27 @@ def binary_exists(name):
from distutils.spawn import find_executable
return find_executable(name) is not None

def check_cmake3(path):
from distutils.spawn import find_executable
args = (path, "--version")
popen = subprocess.Popen(args, stdout=subprocess.PIPE)
popen.wait()
output = popen.stdout.read()
prefix_len = len( "cmake version " )
version = output[prefix_len:].split( '.' )
return int( version[0] ) >= 3

def cmake_exists():
"""Check whether CMAKE is on PATH."""
from distutils.spawn import find_executable
path = find_executable('cmake')
if path is not None:
if check_cmake3(path): return True, path
path = find_executable('cmake3')
return path is not None, path



# def python_dependency_name( py_version_short, py_version_nodot ):
# """ find the name of python dependency """
# from distutils.spawn import find_executable
Expand All @@ -51,7 +72,7 @@ def run(self):
py_version_short = self.config_vars['py_version_short']
py_version_nodot = self.config_vars['py_version_nodot']

cmake_bin = binary_exists( 'cmake' )
cmake_bin, cmake_path = cmake_exists()
make_bin = binary_exists( 'make' )
comp_bin = binary_exists( 'c++' ) or binary_exists( 'g++' ) or binary_exists( 'clang' )

Expand All @@ -72,7 +93,7 @@ def run(self):

if missing_dep:
print( 'Some dependencies are missing:')
if not cmake_bin: print('\tcmake is missing!')
if not cmake_bin: print('\tcmake (version 3) is missing!')
if not make_bin: print('\tmake is missing!')
if not comp_bin: print('\tC++ compiler is missing (g++, c++, clang, etc.)!')
if not zlib_dev: print('\tzlib development package is missing!')
Expand All @@ -91,6 +112,7 @@ def run(self):
command.append(prefix)
command.append( py_version_short )
command.append( useropt )
command.append( cmake_path )
rc = subprocess.call(command)
if rc:
raise Exception( 'Install step failed!' )
Expand Down Expand Up @@ -131,8 +153,8 @@ def run(self):
long_description = "XRootD with Python bindings",
setup_requires = setup_requires,
cmdclass = {
'install': CustomInstall,
'sdist': CustomDist,
'install': CustomInstall,
'sdist': CustomDist,
'bdist_wheel': CustomWheelGen
}
)

0 comments on commit 11b3977

Please sign in to comment.