summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDongHun Kwak <dh0128.kwak@samsung.com>2020-12-31 09:33:52 +0900
committerDongHun Kwak <dh0128.kwak@samsung.com>2020-12-31 09:33:52 +0900
commitf14f97841aa140385b7fca2aeb1c7c96b2711560 (patch)
treefab8afb36bd77b932d59a2e6189033c0ff8ad45c /tools
parent52bf920ae0dcb47c3ce8630f656b8cb997d90aa2 (diff)
downloadpython-numpy-f14f97841aa140385b7fca2aeb1c7c96b2711560.tar.gz
python-numpy-f14f97841aa140385b7fca2aeb1c7c96b2711560.tar.bz2
python-numpy-f14f97841aa140385b7fca2aeb1c7c96b2711560.zip
Imported Upstream version 1.16.0upstream/1.16.0
Diffstat (limited to 'tools')
-rw-r--r--tools/allocation_tracking/sorttable.js8
-rwxr-xr-xtools/changelog.py6
-rw-r--r--tools/swig/pyfragments.swg6
-rw-r--r--tools/test-installed-numpy.py4
-rwxr-xr-xtools/travis-before-install.sh12
-rwxr-xr-xtools/travis-test.sh75
6 files changed, 87 insertions, 24 deletions
diff --git a/tools/allocation_tracking/sorttable.js b/tools/allocation_tracking/sorttable.js
index 25bccb2b6..c9528873e 100644
--- a/tools/allocation_tracking/sorttable.js
+++ b/tools/allocation_tracking/sorttable.js
@@ -2,7 +2,7 @@
SortTable
version 2
7th April 2007
- Stuart Langridge, http://www.kryogenix.org/code/browser/sorttable/
+ Stuart Langridge, https://www.kryogenix.org/code/browser/sorttable/
Instructions:
Download this file
@@ -11,7 +11,7 @@
Click on the headers to sort
Thanks to many, many people for contributions and suggestions.
- Licenced as X11: http://www.kryogenix.org/code/browser/licence.html
+ Licenced as X11: https://www.kryogenix.org/code/browser/licence.html
This basically means: do what you want with it.
*/
@@ -301,7 +301,7 @@ sorttable = {
shaker_sort: function(list, comp_func) {
// A stable sort function to allow multi-level sorting of data
- // see: http://en.wikipedia.org/wiki/Cocktail_sort
+ // see: https://en.wikipedia.org/wiki/Cocktail_shaker_sort
// thanks to Joseph Nahmias
var b = 0;
var t = list.length - 1;
@@ -441,7 +441,7 @@ fixEvent.stopPropagation = function() {
/*
forEach, version 1.0
Copyright 2006, Dean Edwards
- License: http://www.opensource.org/licenses/mit-license.php
+ License: https://www.opensource.org/licenses/mit-license.php
*/
// array-like enumeration
diff --git a/tools/changelog.py b/tools/changelog.py
index 84e046c5f..b135b14e5 100755
--- a/tools/changelog.py
+++ b/tools/changelog.py
@@ -42,8 +42,10 @@ import codecs
from git import Repo
from github import Github
-UTF8Writer = codecs.getwriter('utf8')
-sys.stdout = UTF8Writer(sys.stdout)
+if sys.version_info.major < 3:
+ UTF8Writer = codecs.getwriter('utf8')
+ sys.stdout = UTF8Writer(sys.stdout)
+
this_repo = Repo(os.path.join(os.path.dirname(__file__), ".."))
author_msg =\
diff --git a/tools/swig/pyfragments.swg b/tools/swig/pyfragments.swg
index 901e6ed9d..97ca8cf97 100644
--- a/tools/swig/pyfragments.swg
+++ b/tools/swig/pyfragments.swg
@@ -22,7 +22,6 @@
SWIGINTERN int
SWIG_AsVal_dec(long)(PyObject * obj, long * val)
{
- PyArray_Descr * longDescr = PyArray_DescrNewFromType(NPY_LONG);
if (PyInt_Check(obj)) {
if (val) *val = PyInt_AsLong(obj);
return SWIG_OK;
@@ -56,7 +55,9 @@
}
%#endif
if (!PyArray_IsScalar(obj,Integer)) return SWIG_TypeError;
+ PyArray_Descr * longDescr = PyArray_DescrNewFromType(NPY_LONG);
PyArray_CastScalarToCtype(obj, (void*)val, longDescr);
+ Py_DECREF(longDescr);
return SWIG_OK;
}
}
@@ -74,7 +75,6 @@
SWIGINTERN int
SWIG_AsVal_dec(unsigned long)(PyObject *obj, unsigned long *val)
{
- PyArray_Descr * ulongDescr = PyArray_DescrNewFromType(NPY_ULONG);
%#if PY_VERSION_HEX < 0x03000000
if (PyInt_Check(obj))
{
@@ -120,7 +120,9 @@
}
%#endif
if (!PyArray_IsScalar(obj,Integer)) return SWIG_TypeError;
+ PyArray_Descr * ulongDescr = PyArray_DescrNewFromType(NPY_ULONG);
PyArray_CastScalarToCtype(obj, (void*)val, ulongDescr);
+ Py_DECREF(ulongDescr);
return SWIG_OK;
}
}
diff --git a/tools/test-installed-numpy.py b/tools/test-installed-numpy.py
index 04a2a1da2..14f11b7ed 100644
--- a/tools/test-installed-numpy.py
+++ b/tools/test-installed-numpy.py
@@ -46,6 +46,10 @@ elif numpy.ones((10, 1), order='C').flags.f_contiguous:
print('NPY_RELAXED_STRIDES_CHECKING not set, but active.')
sys.exit(1)
+if options.coverage:
+ # Produce code coverage XML report for codecov.io
+ args += ["--cov-report=xml"]
+
result = numpy.test(options.mode,
verbose=options.verbose,
extra_argv=args,
diff --git a/tools/travis-before-install.sh b/tools/travis-before-install.sh
index 1671d35b4..c334e91ae 100755
--- a/tools/travis-before-install.sh
+++ b/tools/travis-before-install.sh
@@ -9,12 +9,7 @@ pushd builds
# Build into own virtualenv
# We therefore control our own environment, avoid travis' numpy
-#
-# Some change in virtualenv 14.0.5 caused `test_f2py` to fail. So, we have
-# pinned `virtualenv` to the last known working version to avoid this failure.
-# Appears we had some issues with certificates on Travis. It looks like
-# bumping to 14.0.6 will help.
-pip install -U 'virtualenv==14.0.6'
+pip install -U virtualenv
if [ -n "$USE_DEBUG" ]
then
@@ -25,6 +20,11 @@ fi
source venv/bin/activate
python -V
+
+if [ -n "$INSTALL_PICKLE5" ]; then
+ pip install pickle5
+fi
+
pip install --upgrade pip setuptools
pip install nose pytz cython pytest
if [ -n "$USE_ASV" ]; then pip install asv; fi
diff --git a/tools/travis-test.sh b/tools/travis-test.sh
index b99866f0d..fa83606b2 100755
--- a/tools/travis-test.sh
+++ b/tools/travis-test.sh
@@ -28,12 +28,16 @@ fi
werrors="-Werror=declaration-after-statement -Werror=vla "
werrors+="-Werror=nonnull -Werror=pointer-arith"
+# build with c99 by default
+
setup_base()
{
# use default python flags but remoge sign-compare
sysflags="$($PYTHON -c "from distutils import sysconfig; \
print (sysconfig.get_config_var('CFLAGS'))")"
export CFLAGS="$sysflags $werrors -Wlogical-op -Wno-sign-compare"
+ # use c99
+ export CFLAGS=$CFLAGS" -std=c99"
# We used to use 'setup.py install' here, but that has the terrible
# behaviour that if a copy of the package is already installed in the
# install location, then the new copy just gets dropped on top of it.
@@ -46,6 +50,8 @@ setup_base()
if [ -z "$USE_DEBUG" ]; then
$PIP install -v . 2>&1 | tee log
else
+ # Python3.5-dbg on travis seems to need this
+ export CFLAGS=$CFLAGS" -Wno-maybe-uninitialized"
$PYTHON setup.py build_ext --inplace 2>&1 | tee log
fi
grep -v "_configtest" log \
@@ -95,8 +101,8 @@ setup_chroot()
# install needed packages
sudo chroot $DIR bash -c "apt-get install -qq -y \
- libatlas-base-dev gfortran python-dev python-nose python-pip cython \
- python-pytest"
+ libatlas-base-dev gfortran python3-dev python3-pip \
+ cython python3-pytest"
}
run_test()
@@ -105,6 +111,12 @@ run_test()
export PYTHONPATH=$PWD
fi
+ if [ -n "$RUN_COVERAGE" ]; then
+ $PIP install pytest-cov
+ NUMPY_EXPERIMENTAL_ARRAY_FUNCTION=1
+ COVERAGE_FLAG=--coverage
+ fi
+
# We change directories to make sure that python won't find the copy
# of numpy in the source directory.
mkdir -p empty
@@ -113,10 +125,33 @@ run_test()
"import os; import numpy; print(os.path.dirname(numpy.__file__))")
export PYTHONWARNINGS=default
if [ -n "$RUN_FULL_TESTS" ]; then
- $PYTHON ../tools/test-installed-numpy.py -v --mode=full
+ export PYTHONWARNINGS="ignore::DeprecationWarning:virtualenv"
+ $PYTHON ../tools/test-installed-numpy.py -v --mode=full $COVERAGE_FLAG
else
$PYTHON ../tools/test-installed-numpy.py -v
fi
+
+ if [ -n "$RUN_COVERAGE" ]; then
+ # move back up to the source dir because we want to execute
+ # gcov on the source files after the tests have gone through
+ # the code paths
+ cd ..
+
+ # execute gcov on source files
+ find . -name '*.gcno' -type f -exec gcov -pb {} +
+
+ # move the C line coverage report files to the same path
+ # as the Python report data
+ mv *.gcov empty
+
+ # move back to the previous path for good measure
+ # as the Python coverage data is there
+ cd empty
+
+ # Upload coverage files to codecov
+ bash <(curl -s https://codecov.io/bash) -X gcov -X coveragepy
+ fi
+
if [ -n "$USE_ASV" ]; then
pushd ../benchmarks
$PYTHON `which asv` machine --machine travis
@@ -141,14 +176,29 @@ if [ -n "$USE_WHEEL" ] && [ $# -eq 0 ]; then
$PIP install -U virtualenv
# ensure some warnings are not issued
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result"
+ # use c99
+ export CFLAGS=$CFLAGS" -std=c99"
+ # adjust gcc flags if C coverage requested
+ if [ -n "$RUN_COVERAGE" ]; then
+ export NPY_DISTUTILS_APPEND_FLAGS=1
+ export CC='gcc --coverage'
+ export F77='gfortran --coverage'
+ export F90='gfortran --coverage'
+ export LDFLAGS='--coverage'
+ fi
$PYTHON setup.py bdist_wheel
# Make another virtualenv to install into
virtualenv --python=`which $PYTHON` venv-for-wheel
. venv-for-wheel/bin/activate
# Move out of source directory to avoid finding local numpy
pushd dist
- pip install --pre --no-index --upgrade --find-links=. numpy
- pip install nose pytest
+ $PIP install --pre --no-index --upgrade --find-links=. numpy
+ $PIP install nose pytest
+
+ if [ -n "$INSTALL_PICKLE5" ]; then
+ $PIP install pickle5
+ fi
+
popd
run_test
elif [ -n "$USE_SDIST" ] && [ $# -eq 0 ]; then
@@ -158,14 +208,20 @@ elif [ -n "$USE_SDIST" ] && [ $# -eq 0 ]; then
$PYTHON -c "import fcntl; fcntl.fcntl(1, fcntl.F_SETFL, 0)"
# ensure some warnings are not issued
export CFLAGS=$CFLAGS" -Wno-sign-compare -Wno-unused-result"
+ # use c99
+ export CFLAGS=$CFLAGS" -std=c99"
$PYTHON setup.py sdist
# Make another virtualenv to install into
virtualenv --python=`which $PYTHON` venv-for-wheel
. venv-for-wheel/bin/activate
# Move out of source directory to avoid finding local numpy
pushd dist
- pip install numpy*
- pip install nose pytest
+ $PIP install numpy*
+ $PIP install nose pytest
+ if [ -n "$INSTALL_PICKLE5" ]; then
+ $PIP install pickle5
+ fi
+
popd
run_test
elif [ -n "$USE_CHROOT" ] && [ $# -eq 0 ]; then
@@ -174,11 +230,10 @@ elif [ -n "$USE_CHROOT" ] && [ $# -eq 0 ]; then
# the chroot'ed environment will not have the current locale,
# avoid any warnings which may disturb testing
export LANG=C LC_ALL=C
- # run again in chroot with this time testing
+ # run again in chroot with this time testing with python3
sudo linux32 chroot $DIR bash -c \
- "cd numpy && PYTHON=python PIP=pip IN_CHROOT=1 $0 test"
+ "cd numpy && PYTHON=python3 PIP=pip3 IN_CHROOT=1 $0 test"
else
setup_base
run_test
fi
-