[pyferret] 59/110: [WIP]: Testing python3

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jul 28 08:42:02 UTC 2017


This is an automated email from the git hooks/post-receive script.

mckinstry pushed a commit to branch debian/master
in repository pyferret.

commit 71442967256f7c520a543c6bc8fcbc70ccd96740
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Fri Aug 12 13:41:15 2016 +0100

    [WIP]: Testing python3
---
 debian/patches/python3.patch                       | 250 ++++++++++++++++++++-
 debian/python-ferret.install                       |   4 +-
 ...ython-ferret.install => python3-ferret.install} |   2 +-
 debian/rules                                       |   5 +-
 debian/site_specific.mk.in                         |   2 +-
 5 files changed, 255 insertions(+), 8 deletions(-)

diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index b27d347..2b04621 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -342,6 +342,35 @@ Index: pyferret-1.2.0/pviewmod/__init__.py
              except ImportError:
                  raise TypeError("The PQ viewers requires PyQt4")
              self.__vprocess = PipedImagerPQProcess(self.__cmndrecvpipe,
+@@ -225,7 +227,7 @@ if __name__ == "__main__":
+ 
+     # Test each known viewer.
+     for viewername in ( "PipedViewerPQ", "PipedImagerPQ", "NoDisplayPQ" ):
+-        print "Testing Viewer %s" % viewername
++        print ("Testing Viewer %s" % viewername)
+         # create the viewer
+         pviewer = PipedViewer(viewername)
+         mydrawcmnds = drawcmnds[:]
+@@ -243,11 +245,11 @@ if __name__ == "__main__":
+         
+         # submit the commands, pausing after each "show" command
+         for cmd in mydrawcmnds:
+-            print "Command: %s" % str(cmd)
++            print ("Command: %s" % str(cmd))
+             pviewer.submitCommand(cmd)
+             response = pviewer.checkForResponse()
+             while response:
+-                print "Response: %s" % str(response)
++                print ("Response: %s" % str(response))
+                 response = pviewer.checkForResponse()
+             if cmd["action"] == "show":
+                 raw_input("Press Enter to continue")
+@@ -257,4 +259,4 @@ if __name__ == "__main__":
+         if result != 0:
+             sys.exit(result)
+         else:
+-            print "Done with %s" % viewername
++            print ("Done with %s" % viewername)
 Index: pyferret-1.2.0/pviewmod/pyferretbindings.py
 ===================================================================
 --- pyferret-1.2.0.orig/pviewmod/pyferretbindings.py
@@ -2832,7 +2861,7 @@ Index: pyferret-1.2.0/pyfermod/stats/__init__.py
          raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
                           (distname, len(descript)))
      del descript
-@@ -1523,24 +1525,24 @@ if __name__ == "__main__":
+@@ -1523,31 +1525,31 @@ if __name__ == "__main__":
      foundstats = distf.stats("mvsk")
      expectedstats = ( mu, sigma**2, 0.0, 0.0 )
      if not numpy.allclose(foundstats, expectedstats):
@@ -2861,6 +2890,225 @@ Index: pyferret-1.2.0/pyfermod/stats/__init__.py
  
  
      # Pareto distribution
+     distname = "pareto"
+     descript = getdistparams(distname, None)
+     if len(descript) != 2:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1564,7 +1566,7 @@ if __name__ == "__main__":
+                           (alpha * (alpha - 3.0) * (alpha - 4.0)),
+                     )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
+                           (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
+     del xm, alpha, foundstats, expectedstats
+@@ -1573,7 +1575,7 @@ if __name__ == "__main__":
+     distparms.append(0.0)
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     sample = distf.rvs(25000)
+     # fitparms = getfitparams(sample, distname, distparms)
+@@ -1584,14 +1586,14 @@ if __name__ == "__main__":
+     #                                   (distname, str(distparms), str(fitparms)))
+     del distparms, distf, newparms # , sample, fitparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # Poisson distribution
+     distname = "poisson"
+     descript = getdistparams(distname, None)
+     if len(descript) != 1:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1602,26 +1604,26 @@ if __name__ == "__main__":
+     foundstats = distf.stats("mvsk")
+     expectedstats = ( mu, mu, 1.0 / math.sqrt(mu), 1.0 / mu )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
+                           (distname, distparms[0], str(expectedstats), str(foundstats)))
+     del mu, foundstats, expectedstats
+ 
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     # no poisson.fit function
+     del distparms, distf, newparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # Random Integer (Discrete Uniform) distribution
+     distname = "randint"
+     descript = getdistparams(distname, None)
+     if len(descript) != 2:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1636,7 +1638,7 @@ if __name__ == "__main__":
+     # expectedstats = ( 0.5 * (a + b), (n**2 - 1.0) / 12.0, 0.0, -6.0 * (n**2 + 1) / (5.0 * (n**2 - 1)) )
+     expectedstats = ( 0.5 * (a + b), (n**2 - 1.0) / 12.0, 0.0, )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         # raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
+         raise ValueError("(mean, var, skew) of %s(%.1f, %.1f): expected %s; found %s" % \
+                           (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
+@@ -1646,26 +1648,26 @@ if __name__ == "__main__":
+     expectedpmfs[n+1] = 0.0
+     foundpmfs = distf.pmf(xvals)
+     if not numpy.allclose(foundpmfs, expectedpmfs):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("pmfs(%.1f:%.1f:1.0) of %s(%.1f, %.1f): expected %s; found %s" % \
+               (a - 1.0, b + 1.1, distname, distparms[0], distparms[1], str(expectedpmfs), str(foundpmfs)))
+     del a, b, foundstats, n, expectedstats, xvals, expectedpmfs, foundpmfs
+ 
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     # no randint.fit function
+     del distparms, distf, newparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # Student's-t distribution
+     distname = "t"
+     descript = getdistparams(distname, None)
+     if len(descript) != 1:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 1; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1676,7 +1678,7 @@ if __name__ == "__main__":
+     foundstats = distf.stats("mvsk")
+     expectedstats = ( 0.0, degfree / (degfree - 2.0), 0.0, 6.0 / (degfree - 4.0) )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f): expected %s; found %s" % \
+                           (distname, distparms[0], str(expectedstats), str(foundstats)))
+     del degfree, foundstats, expectedstats
+@@ -1686,24 +1688,24 @@ if __name__ == "__main__":
+     distparms.append(1.0)
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     sample = distf.rvs(25000)
+     fitparms = getfitparams(sample, distname, distparms)
+     if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("fitparams of %s: expected %s; found %s" % \
+                                       (distname, str(distparms), str(fitparms)))
+     del distparms, distf, newparms, sample, fitparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # Uniform distribution
+     distname = "uniform"
+     descript = getdistparams(distname, None)
+     if len(descript) != 2:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1715,31 +1717,31 @@ if __name__ == "__main__":
+     foundstats = distf.stats("mvsk")
+     expectedstats = ( 0.5 * (a + b), (b - a)**2 / 12.0, 0.0, -6.0 / 5.0 )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
+                           (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
+     del a, b, foundstats, expectedstats
+ 
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     sample = distf.rvs(25000)
+     fitparms = getfitparams(sample, distname, distparms)
+     if not numpy.allclose(fitparms, distparms, rtol=0.1, atol=0.2):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("fitparams of %s: expected %s; found %s" % \
+                                       (distname, str(distparms), str(fitparms)))
+     del distparms, distf, newparms, sample, fitparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # Weibull distribution
+     distname = "weibull_min"
+     descript = getdistparams(distname, None)
+     if len(descript) != 2:
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("number of parameter description pairs for %s: expected 2; found %d:" % \
+                          (distname, len(descript)))
+     del descript
+@@ -1762,7 +1764,7 @@ if __name__ == "__main__":
+                       (gam2 - gam1**2)**2,
+                     )
+     if not numpy.allclose(foundstats, expectedstats):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("(mean, var, skew, kurtosis) of %s(%.1f, %.1f): expected %s; found %s" % \
+                           (distname, distparms[0], distparms[1], str(expectedstats), str(foundstats)))
+     del k, lambdaflt, foundstats, gam1, gam2, gam3, gam4, mu, sigma, expectedstats
+@@ -1771,7 +1773,7 @@ if __name__ == "__main__":
+     distparms.append(0.0)
+     newparms = getdistparams(distname, getdistparams(distname, distparms, tostd=False), tostd=True)
+     if not numpy.allclose(newparms, distparms):
+-        print "%s: FAIL" % distname
++        print ("%s: FAIL" % distname)
+         raise ValueError("conversion of full %s params to scipy then back to std changed" % distname)
+     # sample = distf.rvs(25000)
+     # fitparms = getfitparams(sample, distname, distparms)
+@@ -1782,9 +1784,9 @@ if __name__ == "__main__":
+     #                                   (distname, str(distparms), str(fitparms)))
+     del distparms, distf, newparms # , sample, fitparms
+ 
+-    print "%s: PASS" % distname
++    print ("%s: PASS" % distname)
+ 
+ 
+     # All successful
+-    print "Success"
++    print ("Success")
+ 
 Index: pyferret-1.2.0/pyfermod/stats/stats_cdf.py
 ===================================================================
 --- pyferret-1.2.0.orig/pyfermod/stats/stats_cdf.py
diff --git a/debian/python-ferret.install b/debian/python-ferret.install
index 4d74d66..1b27047 100644
--- a/debian/python-ferret.install
+++ b/debian/python-ferret.install
@@ -1,2 +1,2 @@
-lib/python2.7/site-packages/*	/usr/lib/python2.7/dist-packages
-efmem/ferret_ef_mem_subsc.so   /usr/lib/ferret-vis/efmem
+lib/python3*/site-packages/*	/usr/lib/python3/dist-packages
+#efmem/ferret_ef_mem_subsc.so   /usr/lib/ferret-vis/efmem
diff --git a/debian/python-ferret.install b/debian/python3-ferret.install
similarity index 51%
copy from debian/python-ferret.install
copy to debian/python3-ferret.install
index 4d74d66..9b6e09b 100644
--- a/debian/python-ferret.install
+++ b/debian/python3-ferret.install
@@ -1,2 +1,2 @@
 lib/python2.7/site-packages/*	/usr/lib/python2.7/dist-packages
-efmem/ferret_ef_mem_subsc.so   /usr/lib/ferret-vis/efmem
+# efmem/ferret_ef_mem_subsc.so   /usr/lib/ferret-vis/efmem
diff --git a/debian/rules b/debian/rules
index eb801c4..5b22ef4 100755
--- a/debian/rules
+++ b/debian/rules
@@ -27,12 +27,11 @@ override_dh_auto_build:
                 -e 's%@INSTALLDIR@%${INSTALLDIR}%' \
                 < debian/site_specific.mk.in > site_specific.mk
 	cp site_specific.mk external_functions/ef_utility
-	$(MAKE) HOSTTYPE=debian all
-
-override_dh_auto_install:
 	for p in $(PY2VERS) $(PY3VERS) ; do \
 		$(MAKE) HOSTTYPE=debian PYTHON_EXE=$$p clean all install ; \
 		done
+
+override_dh_auto_install:
 	# libpyferret.so needs a link because its linked by externally loaded modules
 	# FIXME: How to cope when there are two versions?
 	dh_link -p python-ferret /usr/lib/python2.7/dist-packages/pyferret/libpyferret.$(ARCH).so $(LIBDIR)/libpyferret.so
diff --git a/debian/site_specific.mk.in b/debian/site_specific.mk.in
index ed4d8f1..bf1b407 100644
--- a/debian/site_specific.mk.in
+++ b/debian/site_specific.mk.in
@@ -17,7 +17,7 @@ BUILDARCH	= @ARCH@
 ## Python 2.x executable to invoke for build and install.
 PYTHON_EXE	= @PYTHON@
 ## The assignment of PYTHONINCDIR should not need any modifications
-PYTHONINCDIR   := /usr/include/@PYTHON@
+PYTHONINCDIR   := /usr/include/$(PYTHON_EXE)
 
 ## Installation directory for built Ferret.  Using the "install"
 ## Makefile target circumvents the need to create the fer_*.tar.gz

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/pyferret.git



More information about the debian-science-commits mailing list