diff --git a/.gitignore b/.gitignore index f808f62..3ed6e50 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ -SOURCES/networkx-1.11.tar.gz +/networkx_reference.pdf +/networkx_tutorial.pdf +/networkx-documentation.zip +/networkx-1.9.1.tar.gz +/networkx-1.10.tar.gz /networkx-1.11.tar.gz diff --git a/networkx-numpy.patch b/networkx-numpy.patch new file mode 100644 index 0000000..ee30393 --- /dev/null +++ b/networkx-numpy.patch @@ -0,0 +1,20 @@ +With recent versions of numpy, the original expression results in: + +TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('int64') +with casting rule 'same_kind' + +This patch solves the issue by not trying to add in place. + +diff -Naur networkx-networkx-1.10.orig/networkx/linalg/algebraicconnectivity.py networkx-networkx-1.10/networkx/linalg/algebraicconnectivity.py +--- networkx-networkx-1.10.orig/networkx/linalg/algebraicconnectivity.py 2015-10-30 15:41:35.000000000 -0600 ++++ networkx-networkx-1.10/networkx/linalg/algebraicconnectivity.py 2015-12-01 09:49:51.568953316 -0700 +@@ -244,8 +244,7 @@ + W -= (W.T * X * X.T).T + project(W) + # Compute the diagonal of P * L * P as a Jacobi preconditioner. +- D = L.diagonal() +- D += 2. * (asarray(X) * asarray(W)).sum(axis=1) ++ D = L.diagonal() + 2. * (asarray(X) * asarray(W)).sum(axis=1) + D += (asarray(X) * asarray(X * (W.T * X))).sum(axis=1) + D[D < tol * Lnorm] = 1. + D = 1. / D diff --git a/tests/examples/Makefile b/tests/examples/Makefile new file mode 100644 index 0000000..7922ff7 --- /dev/null +++ b/tests/examples/Makefile @@ -0,0 +1,63 @@ +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Makefile of /examples +# Description: Run some of the examples from upstream sources +# Author: Petr Lautrbach +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +export TEST=/examples +export TESTVERSION=1.0 + +BUILT_FILES= + +FILES=$(METADATA) runtest.sh Makefile PURPOSE tests.list + +.PHONY: all install download clean + +run: $(FILES) build + ./runtest.sh + +build: $(BUILT_FILES) + test -x runtest.sh || chmod a+x runtest.sh + +clean: + rm -f *~ $(BUILT_FILES) + + +include /usr/share/rhts/lib/rhts-make.include + +$(METADATA): Makefile + @echo "Owner: Petr Lautrbach " > $(METADATA) + @echo "Name: $(TEST)" >> $(METADATA) + @echo "TestVersion: $(TESTVERSION)" >> $(METADATA) + @echo "Path: $(TEST_DIR)" >> $(METADATA) + @echo "Description: Run some of the examples from upstream sources" >> $(METADATA) + @echo "Type: Sanity" >> $(METADATA) + @echo "TestTime: 30m" >> $(METADATA) + @echo "RunFor: examples" >> $(METADATA) + @echo "Requires: examples" >> $(METADATA) + @echo "Priority: Normal" >> $(METADATA) + @echo "License: GPLv2+" >> $(METADATA) + @echo "Confidential: no" >> $(METADATA) + @echo "Destructive: no" >> $(METADATA) + @echo "Releases: -RHEL4 -RHELClient5 -RHELServer5 -RHELServer6 -RHELServer7" >> $(METADATA) + + rhts-lint $(METADATA) diff --git a/tests/examples/PURPOSE b/tests/examples/PURPOSE new file mode 100644 index 0000000..c421bc4 --- /dev/null +++ b/tests/examples/PURPOSE @@ -0,0 +1,3 @@ +PURPOSE of /examples +Description: Run some of the examples from upstream sources +Author: Petr Lautrbach diff --git a/tests/examples/runtest.sh b/tests/examples/runtest.sh new file mode 100755 index 0000000..3f5b04e --- /dev/null +++ b/tests/examples/runtest.sh @@ -0,0 +1,51 @@ +#!/bin/bash +# vim: dict+=/usr/share/beakerlib/dictionary.vim cpt=.,w,b,u,t,i,k +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# runtest.sh of /examples +# Description: Run some of the examples from upstream sources +# Author: Petr Lautrbach +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +# +# Copyright (c) 2019 Red Hat, Inc. +# +# This program is free software: you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation, either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be +# useful, but WITHOUT ANY WARRANTY; without even the implied +# warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +# PURPOSE. See the GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. +# +# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +# Include Beaker environment +. /usr/bin/rhts-environment.sh || exit 1 +. /usr/share/beakerlib/beakerlib.sh || exit 1 + +PACKAGE="python3-networkx" +EXAMPLES="/usr/share/doc/python3-networkx-core/examples" + +rlJournalStart + rlPhaseStartSetup + rlAssertRpm $PACKAGE + rlPhaseEnd + + for test in `cat tests.list`; do + rlPhaseStartTest $test + dir=${test/\/*/} + script=${test/*\//} + cd $EXAMPLES/$dir + rlRun "python3 $script" 0 + cd - + rlPhaseEnd + done + + rlJournalPrintText +rlJournalEnd diff --git a/tests/examples/tests.list b/tests/examples/tests.list new file mode 100644 index 0000000..3207324 --- /dev/null +++ b/tests/examples/tests.list @@ -0,0 +1,19 @@ +advanced/heavy_metal_umlaut.py +advanced/iterated_dynamical_systems.py +advanced/parallel_betweenness.py +algorithms/davis_club.py +algorithms/krackhardt_centrality.py +algorithms/rcm.py +basic/properties.py +basic/read_write.py +drawing/chess_masters.py +drawing/knuth_miles.py +graph/degree_sequence.py +graph/erdos_renyi.py +graph/expected_degree_sequence.py +graph/karate_club.py +graph/knuth_miles.py +graph/napoleon_russian_campaign.py +graph/roget.py +graph/words.py +multigraph/chess_masters.py diff --git a/tests/tests.yml b/tests/tests.yml new file mode 100644 index 0000000..f78d2ad --- /dev/null +++ b/tests/tests.yml @@ -0,0 +1,12 @@ +- hosts: localhost + tags: + - classic + - container + roles: + - role: standard-test-source + + - role: standard-test-beakerlib + required_packages: + - python3-networkx + tests: + - examples