From b1d63ea32fa6fa4dd649b0a216a4c854a223a7dc Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 23 Mar 2016 16:43:14 +0100 Subject: [PATCH 01/36] Added appveyor yml file --- .appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..f8db6a4 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,3 @@ +environment: + matrix: + - PYTHON: "C:\\Python27" From 26d1265db8170c1484cdaf5b08e49d47a06810ed Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 24 Mar 2016 13:13:27 +0100 Subject: [PATCH 02/36] Renamed appveyor.yml temporarily --- .appveyor.yml => appveyor.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .appveyor.yml => appveyor.yml (100%) diff --git a/.appveyor.yml b/appveyor.yml similarity index 100% rename from .appveyor.yml rename to appveyor.yml From 3596c5f29a6cc4e7de4bf93a54bfb1170e24fe78 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:06:28 +0200 Subject: [PATCH 03/36] Added build_command to appveyor.yml file --- appveyor.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f8db6a4..0570634 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,10 @@ environment: + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" matrix: - PYTHON: "C:\\Python27" +build_script: + - "%CMD_IN_ENV% python setup.py build" From ccc4686b9327f998f9b8559f8d7a3bdad9bcd5fc Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:09:30 +0200 Subject: [PATCH 04/36] Added version etc to appveyor.yml --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 0570634..25cd3c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,6 @@ +version: 1.0.{build} +build: + verbosity: minimal environment: global: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the From 5c553267ddd061aefeb2a7015eb35b7deec0fa86 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:17:39 +0200 Subject: [PATCH 05/36] Fixing path to python in appveyor --- appveyor.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 25cd3c1..a9d83a8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,12 +2,7 @@ version: 1.0.{build} build: verbosity: minimal environment: - global: - # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the - # /E:ON and /V:ON options are not enabled in the batch script intepreter - # See: http://stackoverflow.com/a/13751649/163740 - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" matrix: - PYTHON: "C:\\Python27" build_script: - - "%CMD_IN_ENV% python setup.py build" + - "python setup.py build" From 2bbe434ca1cc3ab18a6f4027acb7e441b473a371 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:35:35 +0200 Subject: [PATCH 06/36] Solving compilation error in Visual Studio in LibV2 --- efel/cppcore/LibV2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/efel/cppcore/LibV2.cpp b/efel/cppcore/LibV2.cpp index 91f8bb0..57349c3 100644 --- a/efel/cppcore/LibV2.cpp +++ b/efel/cppcore/LibV2.cpp @@ -245,7 +245,8 @@ static int __AP_fall_indices(const vector& v, const vector& apbi, vector vpeak(&v[pi[i]], &v[apei[i]]); transform(vpeak.begin(), vpeak.end(), vpeak.begin(), bind2nd(std::minus(), halfheight)); - transform(vpeak.begin(), vpeak.end(), vpeak.begin(), std::ptr_fun(::fabs)); + transform(vpeak.begin(), vpeak.end(), vpeak.begin(), + static_cast(fabs)); apfi[i] = distance(vpeak.begin(), min_element(vpeak.begin(), vpeak.end())) + pi[i]; } From 4c001ea9a9a21cdc0e7742d1458ac46a6cb0985e Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 23 Mar 2016 16:43:14 +0100 Subject: [PATCH 07/36] Added appveyor yml file --- .appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .appveyor.yml diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..f8db6a4 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,3 @@ +environment: + matrix: + - PYTHON: "C:\\Python27" From c0eee4216e5019f1f26dd2bfc929c9cf5129c311 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 24 Mar 2016 13:13:27 +0100 Subject: [PATCH 08/36] Renamed appveyor.yml temporarily --- .appveyor.yml => appveyor.yml | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .appveyor.yml => appveyor.yml (100%) diff --git a/.appveyor.yml b/appveyor.yml similarity index 100% rename from .appveyor.yml rename to appveyor.yml From a488b28b1265a66f6afbeee4bc9bd002b33ba35d Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:06:28 +0200 Subject: [PATCH 09/36] Added build_command to appveyor.yml file --- appveyor.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index f8db6a4..0570634 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,10 @@ environment: + global: + # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the + # /E:ON and /V:ON options are not enabled in the batch script intepreter + # See: http://stackoverflow.com/a/13751649/163740 + CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" matrix: - PYTHON: "C:\\Python27" +build_script: + - "%CMD_IN_ENV% python setup.py build" From c409dbff746a0fe402a1cd53fa8641ae15f81bf4 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:09:30 +0200 Subject: [PATCH 10/36] Added version etc to appveyor.yml --- appveyor.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 0570634..25cd3c1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,3 +1,6 @@ +version: 1.0.{build} +build: + verbosity: minimal environment: global: # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the From 8c5561dcc6a4f3708e495f9f66d6f167294ee5b5 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:17:39 +0200 Subject: [PATCH 11/36] Fixing path to python in appveyor --- appveyor.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 25cd3c1..a9d83a8 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,12 +2,7 @@ version: 1.0.{build} build: verbosity: minimal environment: - global: - # SDK v7.0 MSVC Express 2008's SetEnv.cmd script will fail if the - # /E:ON and /V:ON options are not enabled in the batch script intepreter - # See: http://stackoverflow.com/a/13751649/163740 - CMD_IN_ENV: "cmd /E:ON /V:ON /C .\\appveyor\\run_with_env.cmd" matrix: - PYTHON: "C:\\Python27" build_script: - - "%CMD_IN_ENV% python setup.py build" + - "python setup.py build" From c8a1094d997a3e5c95929dbdec1cc40391e5446c Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:35:35 +0200 Subject: [PATCH 12/36] Solving compilation error in Visual Studio in LibV2 --- efel/cppcore/LibV2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/efel/cppcore/LibV2.cpp b/efel/cppcore/LibV2.cpp index 91f8bb0..57349c3 100644 --- a/efel/cppcore/LibV2.cpp +++ b/efel/cppcore/LibV2.cpp @@ -245,7 +245,8 @@ static int __AP_fall_indices(const vector& v, const vector& apbi, vector vpeak(&v[pi[i]], &v[apei[i]]); transform(vpeak.begin(), vpeak.end(), vpeak.begin(), bind2nd(std::minus(), halfheight)); - transform(vpeak.begin(), vpeak.end(), vpeak.begin(), std::ptr_fun(::fabs)); + transform(vpeak.begin(), vpeak.end(), vpeak.begin(), + static_cast(fabs)); apfi[i] = distance(vpeak.begin(), min_element(vpeak.begin(), vpeak.end())) + pi[i]; } From 8a8f100c9bed3557ad36621743c2c65bfa695ee7 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:40:21 +0200 Subject: [PATCH 13/36] Solve another instance of the problem in the previous commit --- efel/cppcore/LibV2.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/efel/cppcore/LibV2.cpp b/efel/cppcore/LibV2.cpp index 57349c3..ce76fac 100644 --- a/efel/cppcore/LibV2.cpp +++ b/efel/cppcore/LibV2.cpp @@ -199,7 +199,8 @@ static int __AP_rise_indices(const vector& v, const vector& apbi, vpeak.resize(pi[i] - apbi[i]); transform(v.begin() + apbi[i], v.begin() + pi[i], vpeak.begin(), bind2nd(std::minus(), halfheight)); - transform(vpeak.begin(), vpeak.end(), vpeak.begin(), std::ptr_fun(::fabs)); + transform(vpeak.begin(), vpeak.end(), vpeak.begin(), + static_cast(fabs)); apri[i] = distance(vpeak.begin(), min_element(vpeak.begin(), vpeak.end())) + apbi[i]; } From 2e12d6d64bae1c40aa2ea10aa3e5c3ab940f8980 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:44:54 +0200 Subject: [PATCH 14/36] And another instance of the problem in the last two commits solved --- efel/cppcore/LibV3.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/efel/cppcore/LibV3.cpp b/efel/cppcore/LibV3.cpp index bb6a0ab..38c05bb 100644 --- a/efel/cppcore/LibV3.cpp +++ b/efel/cppcore/LibV3.cpp @@ -958,7 +958,8 @@ static int __AP_rise_indices(const vector& v, const vector& apbi, vpeak.resize(pi[i] - apbi[i]); transform(v.begin() + apbi[i], v.begin() + pi[i], vpeak.begin(), bind2nd(std::minus(), halfheight)); - transform(vpeak.begin(), vpeak.end(), vpeak.begin(), std::ptr_fun(::fabs)); + transform(vpeak.begin(), vpeak.end(), vpeak.begin(), + static_cast(fabs)); apri[i] = distance(vpeak.begin(), min_element(vpeak.begin(), vpeak.end())) + apbi[i]; } @@ -1004,7 +1005,8 @@ static int __AP_fall_indices(const vector& v, const vector& apbi, vector vpeak(&v[pi[i]], &v[apei[i]]); transform(vpeak.begin(), vpeak.end(), vpeak.begin(), bind2nd(std::minus(), halfheight)); - transform(vpeak.begin(), vpeak.end(), vpeak.begin(), std::ptr_fun(::fabs)); + transform(vpeak.begin(), vpeak.end(), vpeak.begin(), + static_cast(fabs)); apfi[i] = distance(vpeak.begin(), min_element(vpeak.begin(), vpeak.end())) + pi[i]; } From 0020bbc38d93c3c3c6b10e070974cc8f68aba878 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:49:05 +0200 Subject: [PATCH 15/36] Visual studio doesn't recognize or operator in LibV5 --- efel/cppcore/LibV5.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/efel/cppcore/LibV5.cpp b/efel/cppcore/LibV5.cpp index 826d2eb..9d822b5 100644 --- a/efel/cppcore/LibV5.cpp +++ b/efel/cppcore/LibV5.cpp @@ -1810,8 +1810,8 @@ static int __AP_phaseslope(const vector& v, const vector& t, apbegin_index = apbi[i]; range_min_index = apbegin_index - int(range); range_max_index = apbegin_index + int(range); - if (range_min_index < 0 or range_max_index < 0) return -1; - if (range_min_index > (int)t.size() or range_max_index > (int)t.size()) + if (range_min_index < 0 || range_max_index < 0) return -1; + if (range_min_index > (int)t.size() || range_max_index > (int)t.size()) return -1; if (v[range_max_index] - v[range_min_index] == 0) return -1; ap_phaseslope = (dvdt[range_max_index] - dvdt[range_min_index]) / From 722325cea5e88c5c3ff0cae4a4191a52b68fd958 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 12:58:40 +0200 Subject: [PATCH 16/36] fixing time() not found in Visual Studio --- efel/cppcore/cfeature.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/efel/cppcore/cfeature.cpp b/efel/cppcore/cfeature.cpp index 3a6d818..4140f98 100644 --- a/efel/cppcore/cfeature.cpp +++ b/efel/cppcore/cfeature.cpp @@ -22,6 +22,8 @@ #include #include +#include + using std::cout; using std::endl; From 6297d6d862512feae821dd1ee5edb058aa3aa3a3 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 13:13:08 +0200 Subject: [PATCH 17/36] Run nosetests from appveyor Switch to using setup.py nosetests to run all tests --- .gitignore | 2 ++ Makefile | 10 ++++------ appveyor.yml | 2 ++ efel/.gitignore | 1 + setup.cfg | 7 +++++++ 5 files changed, 16 insertions(+), 6 deletions(-) diff --git a/.gitignore b/.gitignore index c9cc692..496eab0 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ /build.sh.lviz *.pyc /build.sh +.coverage +coverage.xml diff --git a/Makefile b/Makefile index 16cc83e..7b40c30 100644 --- a/Makefile +++ b/Makefile @@ -29,14 +29,12 @@ update_version: git add GITHASH.txt && \ git add VERSION.txt && \ git commit -m 'Updated version number' -test: install +test: pip install nose coverage --upgrade - cd efel/tests; nosetests -s -v -x --with-coverage --cover-xml \ - --cover-package efel -test3: install3 + python setup.py nosetests +test3: pip3 install nose coverage --upgrade - cd efel/tests; nosetests-3.4 -s -v -x --with-coverage --cover-xml \ - --cover-package efel + python setup.py nosetests pypi: test pip install twine --upgrade rm -rf dist diff --git a/appveyor.yml b/appveyor.yml index a9d83a8..d35d3fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,3 +6,5 @@ environment: - PYTHON: "C:\\Python27" build_script: - "python setup.py build" +test_script: + - "python setup.py nosetests" diff --git a/efel/.gitignore b/efel/.gitignore index 0d20b64..2dbc39f 100644 --- a/efel/.gitignore +++ b/efel/.gitignore @@ -1 +1,2 @@ *.pyc +/cppcore.so diff --git a/setup.cfg b/setup.cfg index 9d2ff1f..1873836 100644 --- a/setup.cfg +++ b/setup.cfg @@ -14,3 +14,10 @@ parentdir_prefix = # Package support both python 2.6 and 2.7 [bdist_wheel] universal = 1 + +[nosetests] +verbosity=2 +detailed-errors=1 +with-coverage=1 +cover-package=efel +cover-xml=1 From 3791a68f8c7a051b98a1f16a57c41def08723501 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 13:17:40 +0200 Subject: [PATCH 18/36] Trying Makefile for tests in appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d35d3fd..a3ce60c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,4 +7,4 @@ environment: build_script: - "python setup.py build" test_script: - - "python setup.py nosetests" + - "make test" From 6a29595848fc5a0b38b9e3861414063517e4561c Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Wed, 30 Mar 2016 13:21:22 +0200 Subject: [PATCH 19/36] Install nose and coverage in appveyor --- appveyor.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index a3ce60c..369ac11 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,4 +7,5 @@ environment: build_script: - "python setup.py build" test_script: - - "make test" + - "pip install nose coverage --upgrade" + - "python setup.py nosetests" From d286e6b344a90b7119c13e71747b9bbc671cece9 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 09:25:53 +0200 Subject: [PATCH 20/36] Installing pip in appveyor --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 369ac11..33aef37 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,6 +5,8 @@ environment: matrix: - PYTHON: "C:\\Python27" build_script: + - ps: Invoke-WebRequest "https://bootstrap.pypa.io/get-pip.py" -OutFile "c:\\get-pip.py" + - "python c:\\get-pip.py" - "python setup.py build" test_script: - "pip install nose coverage --upgrade" From da1689e038ca279769c49dfe93e96725a0de5d94 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 09:30:19 +0200 Subject: [PATCH 21/36] Added bdist_wheel build to appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 33aef37..768e31e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -7,7 +7,7 @@ environment: build_script: - ps: Invoke-WebRequest "https://bootstrap.pypa.io/get-pip.py" -OutFile "c:\\get-pip.py" - "python c:\\get-pip.py" - - "python setup.py build" + - "python setup.py build bdist_wheel" test_script: - "pip install nose coverage --upgrade" - "python setup.py nosetests" From 445a7100df56f7d110905bcf8ceb03229b27ed2f Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 09:36:39 +0200 Subject: [PATCH 22/36] Setting path of pip in appveyor --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 768e31e..f9d42b4 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,8 +5,8 @@ environment: matrix: - PYTHON: "C:\\Python27" build_script: - - ps: Invoke-WebRequest "https://bootstrap.pypa.io/get-pip.py" -OutFile "c:\\get-pip.py" - - "python c:\\get-pip.py" + - "set PATH=C:\\scripts;%PATH%" + - "pip install pip --upgrade" - "python setup.py build bdist_wheel" test_script: - "pip install nose coverage --upgrade" From f9c006938c476bb795d0bbca0a65afb4eb0684e4 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 09:37:49 +0200 Subject: [PATCH 23/36] Fix parse error appveyor script --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index f9d42b4..75943fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: matrix: - PYTHON: "C:\\Python27" build_script: - - "set PATH=C:\\scripts;%PATH%" + - "set PATH=C:\\\\scripts;%PATH%" - "pip install pip --upgrade" - "python setup.py build bdist_wheel" test_script: From c897e5d77ceb949a744bf69336b6acccaae02259 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 10:59:24 +0200 Subject: [PATCH 24/36] Fixing pip in appveyor --- appveyor.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 75943fd..525f5fd 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,9 +5,8 @@ environment: matrix: - PYTHON: "C:\\Python27" build_script: - - "set PATH=C:\\\\scripts;%PATH%" - - "pip install pip --upgrade" + - "python -m pip install pip --upgrade" - "python setup.py build bdist_wheel" test_script: - - "pip install nose coverage --upgrade" + - "python -m pip install nose coverage --upgrade" - "python setup.py nosetests" From 8cb96412dc79b6dddc6e678cfb7f7a7e7026f4aa Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 11:04:00 +0200 Subject: [PATCH 25/36] Remove bdist_wheel build from appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 525f5fd..019254d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -6,7 +6,7 @@ environment: - PYTHON: "C:\\Python27" build_script: - "python -m pip install pip --upgrade" - - "python setup.py build bdist_wheel" + - "python setup.py build" test_script: - "python -m pip install nose coverage --upgrade" - "python setup.py nosetests" From 503b904ac7a66c2034dab282237adcbdbb68ab3a Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 11:33:00 +0200 Subject: [PATCH 26/36] Installing numpy separately in appveyor --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 019254d..277c055 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,7 +5,7 @@ environment: matrix: - PYTHON: "C:\\Python27" build_script: - - "python -m pip install pip --upgrade" + - "python -m pip install numpy" - "python setup.py build" test_script: - "python -m pip install nose coverage --upgrade" From 55a898955f0672a3ab7b4a5cb0634779ea0a8cc1 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 12:45:45 +0200 Subject: [PATCH 27/36] Trying to fix mimetypes in efel.io for appveyor --- efel/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efel/io.py b/efel/io.py index b822e95..49000a2 100644 --- a/efel/io.py +++ b/efel/io.py @@ -30,7 +30,7 @@ # pylint:enable=E0611,F0401 import mimetypes - +mimetypes.init([]) def load_fragment(fragment_url, mime_type=None): """Load fragment From 65f066b69c7ac4954fa54b577a1d12d64271513c Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 12:52:24 +0200 Subject: [PATCH 28/36] Printing more information in case mime type of fragment url can't be found --- efel/io.py | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/efel/io.py b/efel/io.py index 49000a2..bf9f1a8 100644 --- a/efel/io.py +++ b/efel/io.py @@ -1,24 +1,5 @@ """IO handler for eFEL""" -""" -Copyright (c) 2015, EPFL/Blue Brain Project - - This file is part of eFEL - - This library is free software; you can redistribute it and/or modify it under - the terms of the GNU Lesser General Public License version 3.0 as published - by the Free Software Foundation. - - This library 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 Lesser General Public License for more - details. - - You should have received a copy of the GNU Lesser General Public License - along with this library; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -""" - import os # Python 2 has urlparse module, Python 3 has urllib.parse @@ -30,7 +11,7 @@ # pylint:enable=E0611,F0401 import mimetypes -mimetypes.init([]) + def load_fragment(fragment_url, mime_type=None): """Load fragment @@ -51,7 +32,8 @@ def load_fragment(fragment_url, mime_type=None): if mime_type is None: raise TypeError( 'load_fragment: impossible to guess MIME type from url, ' - 'please specify the type manually as argument: %s' % path) + 'please specify the type manually as argument: path=%s url=%s' % + (path, fragment_url)) if scheme == 'file': file_handle = open(os.path.join(server_loc, path), 'r') From 51082aefb5ee409a2e6adef8d018ca62b41b9308 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 13:06:15 +0200 Subject: [PATCH 29/36] Use pathname2url to create urls for appveyor --- efel/tests/test_basic.py | 19 ++++++++++++------- setup.cfg | 1 + 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/efel/tests/test_basic.py b/efel/tests/test_basic.py index 12752a2..13b2b43 100644 --- a/efel/tests/test_basic.py +++ b/efel/tests/test_basic.py @@ -32,6 +32,7 @@ """ import os +import urllib import nose.tools as nt @@ -43,14 +44,18 @@ 'testdata') -meanfrequency1_url = 'file://%s' % os.path.join(os.path.abspath(testdata_dir), - 'basic', - 'mean_frequency_1.txt') +meanfrequency1_url = 'file://%s' % urllib.pathname2url( + os.path.join( + os.path.abspath(testdata_dir), + 'basic', + 'mean_frequency_1.txt')) -zeroISIlog1_url = 'file://%s' % os.path.join(os.path.abspath(testdata_dir), - 'basic', - 'zero_ISI_log_slope_skip' - '95824004.abf.csv') +zeroISIlog1_url = 'file://%s' % urllib.pathname2url( + os.path.join( + os.path.abspath(testdata_dir), + 'basic', + 'zero_ISI_log_slope_skip' + '95824004.abf.csv')) def test_import(): diff --git a/setup.cfg b/setup.cfg index 1873836..8d86c1c 100644 --- a/setup.cfg +++ b/setup.cfg @@ -17,6 +17,7 @@ universal = 1 [nosetests] verbosity=2 +nocapture=1 detailed-errors=1 with-coverage=1 cover-package=efel From 7c3b6b1601f061677a26c1b45112c133ad016bbd Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 13:13:17 +0200 Subject: [PATCH 30/36] Fix file:// from last commit --- efel/tests/test_basic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/efel/tests/test_basic.py b/efel/tests/test_basic.py index 13b2b43..cd62a0e 100644 --- a/efel/tests/test_basic.py +++ b/efel/tests/test_basic.py @@ -44,13 +44,13 @@ 'testdata') -meanfrequency1_url = 'file://%s' % urllib.pathname2url( +meanfrequency1_url = 'file:%s' % urllib.pathname2url( os.path.join( os.path.abspath(testdata_dir), 'basic', 'mean_frequency_1.txt')) -zeroISIlog1_url = 'file://%s' % urllib.pathname2url( +zeroISIlog1_url = 'file:%s' % urllib.pathname2url( os.path.join( os.path.abspath(testdata_dir), 'basic', From ca6ea5c01a77788c7bd0a14dceb3a4a9dfc4f8cf Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 13:23:43 +0200 Subject: [PATCH 31/36] Antoher fix for file url in efel.io --- efel/tests/test_basic.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/efel/tests/test_basic.py b/efel/tests/test_basic.py index cd62a0e..73f2780 100644 --- a/efel/tests/test_basic.py +++ b/efel/tests/test_basic.py @@ -33,6 +33,7 @@ import os import urllib +import urlparse import nose.tools as nt @@ -44,18 +45,18 @@ 'testdata') -meanfrequency1_url = 'file:%s' % urllib.pathname2url( +meanfrequency1_url = urlparse.urljoin('file:', urllib.pathname2url( os.path.join( os.path.abspath(testdata_dir), 'basic', - 'mean_frequency_1.txt')) + 'mean_frequency_1.txt'))) -zeroISIlog1_url = 'file:%s' % urllib.pathname2url( +zeroISIlog1_url = urlparse.urljoin('file:', urllib.pathname2url( os.path.join( os.path.abspath(testdata_dir), 'basic', 'zero_ISI_log_slope_skip' - '95824004.abf.csv')) + '95824004.abf.csv'))) def test_import(): From 90c15f5fdb59969ed2485271e5b329f5f120f264 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Thu, 31 Mar 2016 13:44:15 +0200 Subject: [PATCH 32/36] Added normpath call to solve Windows file URL mess in efel.io --- efel/io.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/efel/io.py b/efel/io.py index bf9f1a8..8a8aba6 100644 --- a/efel/io.py +++ b/efel/io.py @@ -23,7 +23,7 @@ def load_fragment(fragment_url, mime_type=None): scheme = parsed_url.scheme server_loc = parsed_url.netloc - path = parsed_url.path + path = os.path.normpath(parsed_url.path) fragment_string = parsed_url.fragment if mime_type is None: From 03d87b43546c31768b930fd4ac3ea90cac63641e Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Fri, 1 Apr 2016 09:29:10 +0200 Subject: [PATCH 33/36] Adding lstrip to path in efel.io to fix windows url parsing --- efel/io.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/efel/io.py b/efel/io.py index 8a8aba6..d5c2929 100644 --- a/efel/io.py +++ b/efel/io.py @@ -19,11 +19,11 @@ def load_fragment(fragment_url, mime_type=None): Load a fragment (e.g. time series data) from a given URL """ - parsed_url = up.urlparse(fragment_url) + parsed_url = up.urlsplit(fragment_url) scheme = parsed_url.scheme server_loc = parsed_url.netloc - path = os.path.normpath(parsed_url.path) + path = parsed_url.path fragment_string = parsed_url.fragment if mime_type is None: @@ -36,6 +36,7 @@ def load_fragment(fragment_url, mime_type=None): (path, fragment_url)) if scheme == 'file': + path = path.lstrip('\\') file_handle = open(os.path.join(server_loc, path), 'r') if 'text/' in mime_type: From f6b0411a09e472e00bfe22de4f961bc67644ef0a Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Fri, 1 Apr 2016 09:36:06 +0200 Subject: [PATCH 34/36] Fixing last commit --- efel/io.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/efel/io.py b/efel/io.py index d5c2929..6eedf26 100644 --- a/efel/io.py +++ b/efel/io.py @@ -26,6 +26,8 @@ def load_fragment(fragment_url, mime_type=None): path = parsed_url.path fragment_string = parsed_url.fragment + path = path.lstrip('\\') + if mime_type is None: mimetypes.init() mime_type, _ = mimetypes.guess_type(path) @@ -36,7 +38,6 @@ def load_fragment(fragment_url, mime_type=None): (path, fragment_url)) if scheme == 'file': - path = path.lstrip('\\') file_handle = open(os.path.join(server_loc, path), 'r') if 'text/' in mime_type: From 69cda61c521e5221188d9adf3a867000ca0c9251 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Fri, 1 Apr 2016 10:25:03 +0200 Subject: [PATCH 35/36] Fixing previous commit --- efel/io.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/efel/io.py b/efel/io.py index 6eedf26..4732ea2 100644 --- a/efel/io.py +++ b/efel/io.py @@ -23,11 +23,9 @@ def load_fragment(fragment_url, mime_type=None): scheme = parsed_url.scheme server_loc = parsed_url.netloc - path = parsed_url.path + path = os.path.normpath(parsed_url.path).lstrip('\\') fragment_string = parsed_url.fragment - path = path.lstrip('\\') - if mime_type is None: mimetypes.init() mime_type, _ = mimetypes.guess_type(path) From 8b5d9f27f9a705a166988ddb7fc2e21b05d40c17 Mon Sep 17 00:00:00 2001 From: Werner Van Geit Date: Fri, 1 Apr 2016 11:42:41 +0200 Subject: [PATCH 36/36] Hardcoding csv as mimetype in case automatic detection fails (fix for Windows) --- efel/io.py | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/efel/io.py b/efel/io.py index 4732ea2..007dedd 100644 --- a/efel/io.py +++ b/efel/io.py @@ -1,4 +1,32 @@ -"""IO handler for eFEL""" +"""IO handler for eFEL + +This module provides the user-facing Python API of the eFEL. +The convenience functions defined here call the underlying 'cppcore' library +to hide the lower level API from the user. +All functions in this module can be called as efel.functionname, it is +not necessary to include 'api' as in efel.api.functionname. + + +Copyright (c) 2015, EPFL/Blue Brain Project + + This file is part of eFEL + + This library is free software; you can redistribute it and/or modify it under + the terms of the GNU Lesser General Public License version 3.0 as published + by the Free Software Foundation. + + This library 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 Lesser General Public License for more + details. + + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. +""" + + +# pylint: disable=R0912 import os @@ -30,10 +58,15 @@ def load_fragment(fragment_url, mime_type=None): mimetypes.init() mime_type, _ = mimetypes.guess_type(path) if mime_type is None: - raise TypeError( - 'load_fragment: impossible to guess MIME type from url, ' - 'please specify the type manually as argument: path=%s url=%s' % - (path, fragment_url)) + _, ext = os.path.splitext(path) + if ext.lower() == '.csv': + mime_type = 'text/csv' + else: + raise TypeError( + 'load_fragment: impossible to guess MIME type from url, ' + 'please specify the type manually as argument: ' + 'path=%s, url=%s' % + (path, fragment_url)) if scheme == 'file': file_handle = open(os.path.join(server_loc, path), 'r')