From bbe80c50be7dc633064c8053bbc03cd58e763b3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?=
Date: Mon, 17 Mar 2014 17:26:06 +0000 Subject: [PATCH] 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 --- networkx-nose1.0.patch | 37 +++++++++++++++++++++++++++++++++++++ python-networkx.spec | 14 ++++++++++++-- 2 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 networkx-nose1.0.patch diff --git a/networkx-nose1.0.patch b/networkx-nose1.0.patch new file mode 100644 index 0000000..f73d46f --- /dev/null +++ b/networkx-nose1.0.patch @@ -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: diff --git a/python-networkx.spec b/python-networkx.spec index a0d65ba..154d6c4 100644 --- a/python-networkx.spec +++ b/python-networkx.spec @@ -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