Skip to content

Commit

Permalink
Python: limited support for osx w/ homebrew
Browse files Browse the repository at this point in the history
Looks for xrootd include and library directories where they are found on
OS X/Darwin systems where xrootd has been installed via homebrew.

Only works if the bindings version match the xrootd version installed
via homebrew.

Comments on the installation procedure for OSX in README.rst
  • Loading branch information
otron committed Jul 30, 2015
1 parent b02410e commit 87ebf64
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
16 changes: 16 additions & 0 deletions bindings/python/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Prerequisites (incomplete): xrootd

# Installing on OSX
Setup should succeed if:
- xrootd is installed on your system
- xrootd was installed via homebrew
- you're installing the bindings package with the same version number as the
xrootd installation (`xrootd -v`).

If you have xrootd installed and the installation still fails, do
`XRD_LIBDIR=XYZ; XRD_INCDIR=ZYX; pip install xrootd`
where XYZ and ZYX are the paths to the XRootD library and include directories on your system.

## How to find the lib and inc directories
To find the library directory, search your system for "libXrd*" files.
The include directory should contain a file named "XrdVersion.hh", so search for that.
17 changes: 14 additions & 3 deletions bindings/python/setup_pypi.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from distutils.core import setup, Extension
from distutils import sysconfig
from os import getenv, walk, path, path, getcwd, chdir
from platform import system
import subprocess

# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++.
Expand All @@ -19,13 +20,23 @@
elif filename.endswith('.hh'):
depends.append(path.join(dirname, filename))

xrdlibdir = getenv( 'XRD_LIBDIR' ) or '/usr/lib'
xrdincdir = getenv( 'XRD_INCDIR' ) or '/usr/include/xrootd'

# Get package version
with open ('VERSION_INFO') as verfile:
version = verfile.read().strip()

def getincdir_osx():
# Assume xrootd was installed via homebrew
return '/usr/local/Cellar/xrootd/{0}/include/xrootd'.format(version)

def getlibdir():
return (system() == 'Darwin' and '/usr/local/lib') or '/usr/lib'

def getincdir():
return (system() == 'Darwin' and getincdir_osx()) or '/usr/include/xrootd'

xrdlibdir = getenv( 'XRD_LIBDIR' ) or getlibdir()
xrdincdir = getenv( 'XRD_INCDIR' ) or getincdir()

print 'XRootD library dir: ', xrdlibdir
print 'XRootD include dir: ', xrdincdir
print 'Version: ', version
Expand Down

0 comments on commit 87ebf64

Please sign in to comment.