[pyferret] 74/110: Python3 fixes
Alastair McKinstry
mckinstry at moszumanska.debian.org
Fri Jul 28 08:42:12 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 f91707fc600bafae5cf0ced9a714409b320e7b7e
Author: Alastair McKinstry <mckinstry at debian.org>
Date: Sat Aug 13 23:24:03 2016 +0100
Python3 fixes
---
debian/patches/python3.patch | 44 +++++++++++++++++++++++++++++++++++++++-----
1 file changed, 39 insertions(+), 5 deletions(-)
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
index 1857d70..fbadbbf 100644
--- a/debian/patches/python3.patch
+++ b/debian/patches/python3.patch
@@ -15,6 +15,17 @@ Index: pyferret-7.0.0/ferretmagic.py
import os.path
import tempfile
import math
+@@ -238,8 +239,8 @@ class ferretMagics(Magics):
+ rmtree(temp_dir)
+
+ # Error in ferret code - Delete temporary directory
+- else:
+- rmtree(temp_dir)
++ else:
++ rmtree(temp_dir)
+
+ # Publication
+ for source, data in display_data:
@@ -422,8 +423,8 @@ class ferretMagics(Magics):
self._shell.ferret_locked = True
@@ -461,8 +472,16 @@ Index: pyferret-7.0.0/pyfermod/__init__.py
try:
import rlcompleter
except ImportError:
-@@ -60,46 +61,46 @@ import libpyferret
- from libpyferret import *
+@@ -54,52 +55,52 @@ if os.environ.get('FER_MODEL_RUNS') is N
+ if os.environ.get('FER_LIBS') is None:
+ os.environ['FER_LIBS'] = '/usr/lib/ferret-vis/efmem:/usr/lib/ferret-vis/external_functions'
+
+-import libpyferret
++from . import libpyferret
+ # also import everything (not starting with an underscore) from libpyferret
+ # so constants in that module are seen as part of this module
+-from libpyferret import *
++from .libpyferret import *
# methods for transferring data between the Ferret engine and Python
-import datamethods
@@ -788,7 +807,7 @@ Index: pyferret-7.0.0/pyfermod/eofanal/eofanalysis.py
- print 'Null-space vector %d has norm^2: %#.4f' % (k, sqnorm)
- print formatter.pformat(nullvec)
+ print ('Null-space vector %d has norm^2: %#.4f' % (k, sqnorm))
-+ print (formatter.pformat(nullvec)))
++ print (formatter.pformat(nullvec))
tafvec = numpy.array(fmat * numpy.matrix(nullvec).T).squeeze()
sqnorm = numpy.dot(tafvec, tafvec)
- print 'F * NSV %d has norm^2: %#.4f' % (k, sqnorm)
@@ -1275,7 +1294,7 @@ Index: pyferret-7.0.0/pyfermod/regrid/regrid2dtests.py
+ print ("expect = %#6.4f, found = %#6.4f for lon = %7.3f, " \
"lat = %7.3f" % (expect_data[i, j], regrid_data[i, j],
- self.curv_center_lons[i][j], self.curv_center_lats[i][j])
-+ self.curv_center_lons[i][j], self.curv_center_lats[i][j])))
++ self.curv_center_lons[i][j], self.curv_center_lats[i][j]))
if mismatch_found:
self.fail("data mismatch found")
@@ -3231,7 +3250,7 @@ Index: pyferret-7.0.0/pyfermod/stats/stats_helper.py
the parameters for a probability distribution.
"""
+from __future__ import print_function
-+from builtins.past import xrange
++from past.builtins import xrange
import numpy
import pyferret
import pyferret.stats
@@ -4429,3 +4448,18 @@ Index: pyferret-7.0.0/setup.py
# Linking in the rest of the system libraries were moved to addn_link_flags
# in order to make sure the appropriate netcdff, netcdf, hdf5_hl, hdf5, and
+Index: pyferret-7.0.0/fmt/src/tm_ftoc_readline.c
+===================================================================
+--- pyferret-7.0.0.orig/fmt/src/tm_ftoc_readline.c
++++ pyferret-7.0.0/fmt/src/tm_ftoc_readline.c
+@@ -66,6 +66,10 @@
+ #include <string.h>
+ #include "pyferret.h"
+
++#if PY_MAJOR_VERSION >=3
++#define PyString_AsString(x) PyUnicode_AsUTF8(x)
++#endif
++
+ /* Easier way of handling FORTRAN calls with underscore/no underscore */
+ #ifdef NO_ENTRY_NAME_UNDERSCORES
+ #define FORTRAN(a) a
--
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