diff --git a/networkx-1.11.tar.gz b/networkx-1.11.tar.gz new file mode 100644 index 0000000000000000000000000000000000000000..d9359596f678ff590c25d3aa90b47eefdf87b45b Binary files /dev/null and b/networkx-1.11.tar.gz differ diff --git a/networkx-optional-modules.patch b/networkx-optional-modules.patch new file mode 100644 index 0000000000000000000000000000000000000000..6d2cc35f352fe86141f58fec418f353749b21a88 --- /dev/null +++ b/networkx-optional-modules.patch @@ -0,0 +1,29 @@ +make importing of drawing and geo subpackages optional + +diff -Naur networkx-networkx-1.10.orig/networkx/__init__.py networkx-networkx-1.10/networkx/__init__.py +--- networkx-networkx-1.10.orig/networkx/__init__.py 2015-10-30 15:41:35.000000000 -0600 ++++ networkx-networkx-1.10/networkx/__init__.py 2015-11-24 09:34:20.741823392 -0700 +@@ -95,5 +95,8 @@ + from networkx.linalg import * + from networkx.tests.test import run as test + +-import networkx.drawing +-from networkx.drawing import * ++try: ++ import networkx.drawing ++ from networkx.drawing import * ++except ImportError: ++ pass +diff -Naur networkx-networkx-1.10.orig/networkx/readwrite/__init__.py networkx-networkx-1.10/networkx/readwrite/__init__.py +--- networkx-networkx-1.10.orig/networkx/readwrite/__init__.py 2015-10-30 15:41:35.000000000 -0600 ++++ networkx-networkx-1.10/networkx/readwrite/__init__.py 2015-11-24 09:34:46.539738141 -0700 +@@ -14,4 +14,8 @@ + from networkx.readwrite.gml import * + from networkx.readwrite.graphml import * + from networkx.readwrite.gexf import * +-from networkx.readwrite.nx_shp import * ++ ++try: ++ from networkx.readwrite.nx_shp import * ++except ImportError: ++ pass diff --git a/python-networkx-sphinx.patch b/python-networkx-sphinx.patch new file mode 100644 index 0000000000000000000000000000000000000000..137e98e291f61522771790636e0eb9321c1a575a --- /dev/null +++ b/python-networkx-sphinx.patch @@ -0,0 +1,11 @@ +diff -up networkx-networkx-1.11/doc/source/conf.py.sphinx networkx-networkx-1.11/doc/source/conf.py +--- networkx-networkx-1.11/doc/source/conf.py.sphinx 2016-01-30 10:25:44.000000000 -0700 ++++ networkx-networkx-1.11/doc/source/conf.py 2016-12-23 09:54:55.280925006 -0700 +@@ -74,7 +74,6 @@ extensions = [ + 'sphinx.ext.intersphinx', + 'sphinx.ext.mathjax', + 'sphinx.ext.napoleon', +- 'sphinx.ext.pngmath', + 'sphinx.ext.todo', + 'sphinx.ext.viewcode', + #'sphinxcontrib.bibtex', diff --git a/python-networkx.spec b/python-networkx.spec new file mode 100644 index 0000000000000000000000000000000000000000..3a451aa5aead701c30cc2d762242f820192c56b9 --- /dev/null +++ b/python-networkx.spec @@ -0,0 +1,213 @@ +Name: python-networkx +Version: 1.11 +Release: 14 +Summary: Python package for creating and manipulating graphs and networks +License: BSD +URL: http://networkx.github.io/ +Source0: https://github.com/networkx/networkx/archive/networkx-1.11.tar.gz +# make importing of drawing and geo subpackages optional +Patch0000: networkx-optional-modules.patch +# Fix sphinx build error +# https://github.com/networkx/networkx/issues/2340 +Patch0001: python-networkx-sphinx.patch +BuildArch: noarch + +%description +NetworkX is a Python 2 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +%package -n python2-networkx +Summary: Creates and Manipulates Graphs and Networks +Requires: python2-networkx-core = 1.11-14 python2-networkx-geo = 1.11-14 +Requires: python2-networkx-drawing = 1.11-14 + +%{?python_provide:%python_provide python2-networkx} + +%description -n python2-networkx +NetworkX is a Python 2 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +%package -n python2-networkx-core +Summary: Creates and Manipulates Graphs and Networks +BuildRequires: python2-devel python2-decorator python2-scipy python2-setuptools +BuildRequires: python2-yaml python2-pyparsing python2-nose +Requires: python2-decorator python2-scipy python2-yaml python2-pyparsing + +%{?python_provide:%python_provide python2-networkx-core} + +%description -n python2-networkx-core +NetworkX is a Python 2 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +%package -n python2-networkx-geo +Summary: GDAL I/O +Requires: python2-networkx-core = 1.11-14 python2-gdal +BuildRequires: python2-gdal + +%{?python_provide:%python_provide python2-networkx-geo} + +%description -n python2-networkx-geo +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +This package provides GDAL I/O support. + +%package -n python2-networkx-drawing +Summary: visual representations for graphs and networks +Requires: python2-networkx-core = 1.11-14 +BuildRequires: python2.7dist(gv) python2-matplotlib python2-pydotplus +Requires: python2.7dist(gv) python2-matplotlib python2-pydotplus + +%{?python_provide:%python_provide python2-networkx-drawing} + +%description -n python2-networkx-drawing +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +This package provides support for graph visualizations. + +%package -n python3-networkx +Summary: Creates and Manipulates Graphs and Networks +Requires: python3-networkx-core = 1.11-14 python3-networkx-geo = 1.11-14 +Requires: python3-networkx-drawing = 1.11-14 + +%{?python_provide:%python_provide python3-networkx} + +%description -n python3-networkx +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +%package -n python3-networkx-core +Summary: Creates and Manipulates Graphs and Networks +BuildRequires: python3-devel python3-decorator python3-yaml +BuildRequires: python3-scipy python3-pyparsing python3-setuptools +Requires: python3-decorator python3-yaml python3-scipy python3-pyparsing + +%{?python_provide:%python_provide python3-networkx-core} + +%description -n python3-networkx-core +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +%package -n python3-networkx-geo +Summary: GDAL I/O +Requires: python3-networkx-core = 1.11-14 gdal-python3 +BuildRequires: gdal-python3 + +%{?python_provide:%python_provide python3-networkx-geo} + +%description -n python3-networkx-geo +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +This package provides GDAL I/O support. + +%package -n python3-networkx-drawing +Summary: visual representations for graphs and networks +Requires: python3-networkx-core = 1.11-14 python3-matplotlib python3-pydotplus +BuildRequires: python3-matplotlib python3-pydotplus + +%{?python_provide:%python_provide python3-networkx-drawing} + +%description -n python3-networkx-drawing +NetworkX is a Python 3 package for the creation, manipulation, and +study of the structure, dynamics, and functions of complex networks. + +This package provides support for graph visualizations. + +%package help +Summary: Documentation for networkx +BuildRequires: python2-pandas python2-pydotplus python2-sphinx python2-sphinx_rtd_theme +BuildRequires: python2-sphinxcontrib-bibtex python2-ipython python2-numpydoc +BuildRequires: tex(latex) tex-preview python2-matplotlib +Provides: bundled(jquery) python-networkx-doc = 1.11-14 +Obsoletes: python-networkx-doc < 1.11-14 +%description help +Documentation for networkx + +%prep +%autosetup -n networkx-networkx-%{version} -p1 +find examples -type f -perm /0111 | xargs chmod a-x + +%build +%py2_build +sed -i 's/^[[:blank:]]*python/&2/' doc/Makefile +PYTHONPATH=$PWD/build/lib make SPHINXBUILD=sphinx-build-2 -C doc html + +mv build build2 +mv networkx/*.pyc build2 + +%py3_build + +%install +%py3_install + +mv build build3 +mv build2 build +mv -f build/*.pyc networkx + +%py2_install +mv $RPM_BUILD_ROOT%{_docdir}/networkx-1.11 ./installed-docs +rm -f installed-docs/INSTALL.txt + +for f in `grep -FRl /usr/bin/env $RPM_BUILD_ROOT%{python2_sitelib}`; do + sed 's|/usr/bin/env python|%{_bindir}/python2|' $f > $f.new + touch -r $f $f.new + chmod a+x $f.new + mv -f $f.new $f +done + +for f in `grep -FRl /usr/bin/env $RPM_BUILD_ROOT%{python3_sitelib}`; do + sed 's|/usr/bin/env python|%{_bindir}/python3|' $f > $f.new + touch -r $f $f.new + chmod a+x $f.new + mv -f $f.new $f +done + +%clean +rm -fr %{buildroot} +rm -f /tmp/tmp?????? + +%check +mkdir site-packages +mv networkx site-packages +PYTHONPATH=$PWD/site-packages python2 -c "import networkx; networkx.test()" + +%files -n python2-networkx +%doc README.rst LICENSE.txt + +%files -n python2-networkx-core +%doc installed-docs/* +%{python2_sitelib}/* +%exclude %{python2_sitelib}/networkx/drawing/ +%exclude %{python2_sitelib}/networkx/readwrite/nx_shp.py* + +%files -n python2-networkx-drawing +%{python2_sitelib}/networkx/drawing + +%files -n python2-networkx-geo +%{python2_sitelib}/networkx/readwrite/nx_shp.py* + +%files -n python3-networkx +%doc README.rst LICENSE.txt + +%files -n python3-networkx-core +%doc installed-docs/* +%{python3_sitelib}/* +%exclude %{python3_sitelib}/networkx/drawing/ +%exclude %{python3_sitelib}/networkx/readwrite/nx_shp.py +%exclude %{python3_sitelib}/networkx/readwrite/__pycache__/nx_shp.* + +%files -n python3-networkx-drawing +%{python3_sitelib}/networkx/drawing + +%files -n python3-networkx-geo +%{python3_sitelib}/networkx/readwrite/nx_shp.py +%{python3_sitelib}/networkx/readwrite/__pycache__/nx_shp.* + +%files help +%doc doc/build/html/* + +%changelog +* Tue May 10 2020 liangdong - 1.11-14 +- Package init