fix build dependency on el6

nose1.1 is needed for the attrib plugin

also only exclude nx_shp.py if packaging in separate sub package
This commit is contained in:
Pádraig Brady 2014-03-17 17:26:06 +00:00
parent 0b52a2805e
commit bbe80c50be
2 changed files with 49 additions and 2 deletions

37
networkx-nose1.0.patch Normal file
View File

@ -0,0 +1,37 @@
diff -Naur networkx-1.8.1.orig/networkx/tests/test.py networkx-1.8.1/networkx/tests/test.py
--- networkx-1.8.1.orig/networkx/tests/test.py 2013-08-04 13:53:31.000000000 +0000
+++ networkx-1.8.1/networkx/tests/test.py 2014-03-17 20:49:15.624551199 +0000
@@ -2,6 +2,24 @@
import sys
from os import path,getcwd
+import pkg_resources
+
+# If there is a conflicting non egg module,
+# i.e. an older standard system module installed,
+# then replace it with this requirement
+def replace_dist(requirement):
+ try:
+ return pkg_resources.require(requirement)
+ except pkg_resources.VersionConflict:
+ e = sys.exc_info()[1]
+ dist=e.args[0]
+ req=e.args[1]
+ if dist.key == req.key and not dist.location.endswith('.egg'):
+ del pkg_resources.working_set.by_key[dist.key]
+ # We assume there is no need to adjust sys.path
+ # and the associated pkg_resources.working_set.entries
+ return pkg_resources.require(requirement)
+
def run(verbosity=1,doctest=False,numpy=True):
"""Run NetworkX tests.
@@ -16,6 +34,8 @@
numpy: bool, optional
True to test modules dependent on numpy
"""
+ replace_dist("nose >= 1.0")
+
try:
import nose
except ImportError:

View File

@ -22,6 +22,7 @@ Source2: http://networkx.github.io/documentation/latest/_downloads/networ
Source3: http://networkx.github.io/documentation/latest/_downloads/networkx-documentation.zip
Patch0: optional-modules.patch
Patch1: test-rounding-fix.patch
Patch2: networkx-nose1.0.patch
BuildArch: noarch
Requires: %{name}-core = %{version}-%{release}
@ -41,7 +42,11 @@ BuildRequires: python-decorator
BuildRequires: PyYAML
BuildRequires: scipy
BuildRequires: pyparsing
%if 0%{?rhel} == 6
BuildRequires: python-nose1.1
%else
BuildRequires: python-nose
%endif
Requires: python-decorator
Requires: PyYAML
Requires: scipy
@ -167,6 +172,9 @@ Documentation for networkx
%setup -q -n networkx-%{version}
%patch0 -p1
%patch1 -p1
%if 0%{?rhel} == 6
%patch2 -p1
%endif
# Fix permissions
find examples -type f -perm /0111 | xargs chmod a-x
@ -255,8 +263,9 @@ PYTHONPATH=`pwd`/site-packages python -c "import networkx; networkx.test()"
%doc installed-docs/*
%{python2_sitelib}/*
%exclude %{python2_sitelib}/networkx/drawing/
%if !0%{?rhel}
%exclude %{python2_sitelib}/network/readwrite/nx_shp.py
%endif
%if !0%{?rhel}
%files drawing
@ -274,8 +283,9 @@ PYTHONPATH=`pwd`/site-packages python -c "import networkx; networkx.test()"
%doc installed-docs/*
%{python3_sitelib}/*
%exclude %{python3_sitelib}/networkx/drawing/
%if !0%{?rhel}
%exclude %{python3_sitelib}/network/readwrite/nx_shp.py
%endif
%if !0%{?rhel}
%files -n python3-networkx-drawing