Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Python: Add setup file to create sdist package for PyPI
The new setup_pypi.py file can be used to generate the sdist package for the XRootD python bindings. This should be used only wen creating the package for distribution in PyPI.
- Loading branch information
Showing
2 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
include README.rst | ||
include VERSION_INFO | ||
include genversion.sh | ||
recursive-include tests * | ||
recursive-include examples *.py | ||
recursive-include docs * | ||
recursive-include src * |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
from distutils.core import setup, Extension | ||
from distutils import sysconfig | ||
from os import getenv, walk, path, path, getcwd, chdir | ||
import subprocess | ||
|
||
# Remove the "-Wstrict-prototypes" compiler option, which isn't valid for C++. | ||
cfg_vars = sysconfig.get_config_vars() | ||
opt = cfg_vars["OPT"] | ||
cfg_vars["OPT"] = " ".join( flag for flag in opt.split() if flag != '-Wstrict-prototypes' ) | ||
|
||
|
||
sources = list() | ||
depends = list() | ||
|
||
for dirname, dirnames, filenames in walk('src'): | ||
for filename in filenames: | ||
if filename.endswith('.cc'): | ||
sources.append(path.join(dirname, filename)) | ||
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 | ||
topdir = path.dirname(path.dirname(getcwd())) | ||
p = subprocess.Popen(['./genversion.sh', '--print-only'], stdout=subprocess.PIPE, cwd=topdir) | ||
version, err = p.communicate() | ||
version = version.strip() | ||
|
||
print 'XRootD library dir: ', xrdlibdir | ||
print 'XRootD include dir: ', xrdincdir | ||
print 'Version: ', version | ||
|
||
setup( name = 'pyxrootd', | ||
version = version, | ||
author = 'XRootD Developers', | ||
author_email = 'xrootd-dev@slac.stanford.edu', | ||
url = 'http://xrootd.org', | ||
license = 'LGPLv3+', | ||
description = "XRootD Python bindings", | ||
long_description = "XRootD Python bindings", | ||
packages = ['pyxrootd', 'XRootD', 'XRootD.client'], | ||
package_dir = {'pyxrootd' : 'src', | ||
'XRootD' : 'libs', | ||
'XRootD.client': 'libs/client'}, | ||
ext_modules = [ | ||
Extension( | ||
'pyxrootd.client', | ||
sources = sources, | ||
depends = depends, | ||
libraries = ['XrdCl', 'XrdUtils', 'dl'], | ||
extra_compile_args = ['-g'], | ||
include_dirs = [xrdincdir], | ||
library_dirs = [xrdlibdir] | ||
) | ||
] | ||
) |