I'm packaging graph-tool for RHEL. I'd like to contribute the spec for
distribution so that your users can easily build packages on Red Hat
systems, and you can offer them for distribution if you choose to do so.
I did notice a couple of problems while packaging.
First, your build scripts appear to install into the general library
path(distutils.sysconfig.get_python_lib()) when it should install to the
platform-dependent library path
(distutils.sysconfig.get_python_lib(1)). According to the manual, I
believe you should be using pyexecdir rather than pythondir.
http://www.gnu.org/software/automake/manual/html_node/Python.html
Second, numpy headers appear to be included incorrectly.
>>> print numpy.get_include.__doc__
Return the directory that contains the NumPy \*.h header files.
Extension modules that need to compile against NumPy should use
this
function to locate the appropriate include directory.
$ python -c 'import numpy; print "-I" + numpy.get_include()'
-I/usr/lib64/python2.7/site-packages/numpy/core/include
However, arrayobject.h is included directly where the correct path
should be numpy/arrayobject.h. Because the headers don't include that
prefix, the spec file includes a static path for the headers.
Similarly, the cairomm headers are included without a prefix.
# pkg-config --cflags cairomm-1.0
-I/usr/include/cairomm-1.0 -I/usr/include/cairo
-I/usr/include/sigc++-2.0 -I/usr/lib64/sigc++-2.0/include
-I/usr/include/pixman-1 -I/usr/include/freetype2
-I/usr/include/libpng12
cairommconfig.h is included, when the correct path is
cairomm/cairommconfig.h.
%if 0%{?rhel} && 0%{?rhel} <= 6
%{!?__python2: %global __python2 /usr/bin/python2}
%{!?python2_sitelib: %global python2_sitelib %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")}
%{!?python2_sitearch: %global python2_sitearch %(%{__python2} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")}
%endif
Name: python-graph-tool
Version: 2.2.35
Release: 1%{?dist}
Summary: Efficient network analysis for Python
Group: Development/Languages
License: GPLv3
URL: http://graph-tool.skewed.de/
Source0: http://downloads.skewed.de/graph-tool/graph-tool-%{version}.tar.bz2
BuildRequires: python2-devel
BuildRequires: gcc >= 4.8
BuildRequires: boost >= 1.54.0
BuildRequires: expat-devel
BuildRequires: scipy
BuildRequires: numpy
BuildRequires: CGAL-devel
BuildRequires: sparsehash-devel
BuildRequires: cairomm-devel
BuildRequires: pycairo-devel
BuildRequires: python-matplotlib
%description
Graph-tool is an efficient Python module for manipulation and statistical
analysis of graphs (a.k.a. networks). Contrary to most other python
modules with similar functionality, the core data structures and
algorithms are implemented in C++, making extensive use of template
metaprogramming, based heavily on the Boost Graph Library. This confers it
a level of performance that is comparable (both in memory usage and
computation time) to that of a pure C/C++ library.
%prep
%setup -q -n graph-tool-%{version}
%build
./configure CFLAGS="$RPM_OPT_FLAGS" \
CPPFLAGS="$(python-config --includes) $(python -c 'import numpy; print "-I" + numpy.get_include() + "/numpy/"') \
-I/usr/lib64/python2.6/site-packages/scipy -I/usr/include/cairomm-1.0/cairomm" \
--with-sparsehash-prefix=google
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc /usr/local/share/doc/graph-tool
%{python2_sitelib}/graph_tool
%changelog
_______________________________________________
graph-tool mailing list
[email protected]
http://lists.skewed.de/mailman/listinfo/graph-tool