[adios] 57/207: WIP: Make code py2,3 agnostic

Alastair McKinstry mckinstry at moszumanska.debian.org
Fri Jun 12 06:04:36 UTC 2015


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

mckinstry pushed a commit to branch master
in repository adios.

commit ea575ce4308710f2d8bdc1546f1aa0885189af4f
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Thu Oct 24 17:43:53 2013 +0100

    WIP: Make code py2,3 agnostic
---
 debian/changelog             |   1 +
 debian/control               |   7 +-
 debian/patches/python3.patch | 451 +++++++++++++++++++++++++++++++++++++++++++
 debian/patches/series        |   3 +-
 4 files changed, 456 insertions(+), 6 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index b19ea25..73f12c0 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,6 +2,7 @@ adios (1.4.1-1) unstable; urgency=low
 
   * New upstream.
   * update config.{sub,guess} for the AArch64 port. Closes: #727312.
+  * Make python code python2-3 agnostic.
 
  -- Alastair McKinstry <mckinstry at debian.org>  Thu, 24 Oct 2013 19:27:47 +0100
 
diff --git a/debian/control b/debian/control
index a0d4018..2972b8e 100644
--- a/debian/control
+++ b/debian/control
@@ -2,15 +2,15 @@ Source: adios
 Section: science
 Priority: optional
 Maintainer: Alastair McKinstry <mckinstry at debian.org>
-Build-Depends: debhelper (>= 9), libnetcdf-dev, gfortran, libhdf5-mpi-dev | libhdf5-dev, libmxml-dev, python-all-dev, mpi-default-dev, autotools-dev,
-  python3-all-dev
+Build-Depends: debhelper (>= 9), libnetcdf-dev, gfortran, libhdf5-mpi-dev | libhdf5-dev, libmxml-dev, python-dev, mpi-default-dev, autotools-dev,
+  python3-dev
 Standards-Version: 3.9.4
 Homepage: http://www.olcf.ornl.gov/center-projects/adios/
 
 Package: libadios-dev
 Section: libdevel
 Architecture: any
-Multi-Arch: foreign
+Multi-Arch: same
 Depends:  ${misc:Depends}, ${shlibs:Depends}
 Description: ADIOS Adaptable IO system for simulations
  The Adaptable IO System (ADIOS) provides a simple, flexible way for scientists
@@ -22,7 +22,6 @@ Description: ADIOS Adaptable IO system for simulations
 
 
 Package: libadios-bin
-Section: utils
 Depends:  ${misc:Depends}, ${shlibs:Depends}, ${python:Depends}
 Architecture: any
 Multi-Arch: foreign
diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..d2b786b
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,451 @@
+Author: Alastair McKinstry <mckinstry at debian.org>
+Description: Make the python code python2-3 agnostic.
+Last-Updated:2013-10-25
+Forwarded: no
+
+Index: adios-1.4.1/utils/skel/bin/skel
+===================================================================
+--- adios-1.4.1.orig/utils/skel/bin/skel	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/bin/skel	2013-10-24 14:22:33.000000000 +0100
+@@ -1,5 +1,7 @@
+ #!/usr/bin/env python
+ 
++from __future__ import absolute_import, division, print_function, unicode_literals
++
+ import sys
+ import os.path
+ 
+@@ -61,7 +63,7 @@
+     try:
+         config = adios.adiosConfig (args.project + '_skel.xml')
+     except (IOError):
+-        print "Error reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first."
++        print( "Error reading " + args.project + "_skel.xml. Try running skel xml " + args.project + " first.")/
+         return 1
+ 
+     if args.subcommand == 'params':
+@@ -72,8 +74,8 @@
+     try:    
+         params = skelconf.skelConfig (args.project + '_params.xml')
+     except (IOError):
+-        print "Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,"
+-        print "then copy the generated " + args.project + "_params.xml.default, and edit to suit your needs."
++        print("Error reading " + args.project + "_params.xml. Try running skel params " + args.project + " first,")
++        print("then copy the generated " + args.project + "_params.xml.default, and edit to suit your needs.")
+         return 1
+ 
+     if args.subcommand == 'makefile':
+@@ -92,7 +94,7 @@
+         skel_submit.generate_submit_scripts (params)
+         return 0
+ 
+-    print 'Unknown subcommand, exiting.'
++    print('Unknown subcommand, exiting.')
+ 
+ 
+ if __name__ == "__main__":
+Index: adios-1.4.1/utils/skel/bin/skel_extract.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/bin/skel_extract.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/bin/skel_extract.py	2013-10-24 14:28:42.000000000 +0100
+@@ -1,5 +1,6 @@
+ #!/usr/bin/env python
+ 
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import argparse
+ import xml.dom.minidom
+ import sys
+@@ -45,7 +46,7 @@
+     # check the selected fields
+     for field in selected_fields:
+         if not field in keys:
+-            print 'Invalid selection, field ' + field
++            print('Invalid selection, field ' + field)
+             return
+ 
+     #Print the header
+Index: adios-1.4.1/utils/skel/lib/skelconf.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skelconf.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skelconf.py	2013-10-24 14:28:28.000000000 +0100
+@@ -1,5 +1,5 @@
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import xml.dom.minidom
+-
+ import skel_settings
+ 
+ 
+@@ -9,7 +9,7 @@
+ 
+         nodes = doc.childNodes
+         if (nodes.length != 1):
+-            print 'malformed param file, should contain only a single skel-config element'
++            print('malformed param file, should contain only a single skel-config element')
+             raise SystemExit
+         self.config_node = nodes[0]
+ 
+Index: adios-1.4.1/utils/gpp/ad_config.py
+===================================================================
+--- adios-1.4.1.orig/utils/gpp/ad_config.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/gpp/ad_config.py	2013-10-24 14:37:04.000000000 +0100
+@@ -1,3 +1,4 @@
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import xml.dom.minidom
+ import type_mapper
+ 
+Index: adios-1.4.1/utils/gpp/gpp.py
+===================================================================
+--- adios-1.4.1.orig/utils/gpp/gpp.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/gpp/gpp.py	2013-10-24 14:36:54.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import sys
+ import os
+ 
+Index: adios-1.4.1/utils/skel/lib/adios.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/adios.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/adios.py	2013-10-24 17:40:35.000000000 +0100
+@@ -1,5 +1,5 @@
++from __future__ import print_function
+ import xml.dom.minidom
+-
+ import typeMapper
+ 
+ class adiosConfig:
+@@ -12,7 +12,7 @@
+         doc = xml.dom.minidom.parse (config_file_name)
+         nodes = doc.childNodes
+         if (nodes.length != 1):
+-            print 'malformed adios config file, should contain only a single adios-config element'
++            print('malformed adios config file, should contain only a single adios-config element')
+             raise SystemExit
+         self.config_node = nodes[0]
+ 
+@@ -47,7 +47,7 @@
+ 
+     def get_buffer (self):
+         #return the buffer info
+-        print 'implement get_buffer'
++        print('implement get_buffer')
+ 
+     def get_host_language (self):
+         return self.host_language
+@@ -141,7 +141,7 @@
+             return None
+         else:
+             # place the dimensions in a list and remove the time-index if it is there.
+-            dims = filter (lambda x : x != self.time_index, self.var_node.getAttribute ('dimensions').split(',') )
++            dims = [x for x in self.var_node.getAttribute ('dimensions').split(',') if x != self.time_index]
+             cleandims = []
+             for d in dims:
+ 
+Index: adios-1.4.1/utils/skel/lib/argparse.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/argparse.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/argparse.py	2013-10-24 17:37:47.000000000 +0100
+@@ -81,7 +81,6 @@
+     'ZERO_OR_MORE',
+ ]
+ 
+-
+ import copy as _copy
+ import os as _os
+ import re as _re
+Index: adios-1.4.1/utils/skel/lib/skel_cat.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_cat.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_cat.py	2013-10-24 14:34:48.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import argparse
+ import os
+ import os.path
+Index: adios-1.4.1/utils/skel/lib/skel_install.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_install.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_install.py	2013-10-24 14:34:11.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import skel_settings
+ 
+ def main(argv=None):
+Index: adios-1.4.1/utils/skel/lib/skel_makefile.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_makefile.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_makefile.py	2013-10-24 15:03:13.000000000 +0100
+@@ -1,5 +1,7 @@
+ #!/usr/bin/env python
+ 
++# from __future__ import absolute_import, division, print_function, unicode_literals
++from __future__ import print_function
+ import argparse
+ import os
+ import sys
+@@ -121,10 +123,10 @@
+ 
+     lang = config.get_host_language ()
+     if 'c' == lang or 'C' == lang:
+-        print 'generating C flavored Makefile'
++        print('generating C flavored Makefile')
+         generate_makefiles_c (params)
+     else:
+-        print 'generating fortran flavored Makefile'
++        print('generating fortran flavored Makefile')
+         generate_makefiles_fortran (params)
+ 
+ 
+Index: adios-1.4.1/utils/skel/lib/skel_params.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_params.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_params.py	2013-10-24 14:33:23.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import sys
+ import os
+ import argparse
+Index: adios-1.4.1/utils/skel/lib/skel_settings.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_settings.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_settings.py	2013-10-24 15:04:44.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import absolute_import, division, print_function
+ import sys
+ import os.path
+ import shutil
+@@ -20,8 +20,8 @@
+                 continue
+             split_line = line.split('=')
+             if not len (split_line) == 2:
+-                print 'Malformed configuration line: ' + line
+-                print 'Ignoring'
++                print('Malformed configuration line: ' + line)
++                print('Ignoring')
+                 continue
+             self.settings_dict[split_line[0]] = split_line[1]
+ 
+@@ -53,7 +53,7 @@
+     if not os.path.exists (skel_settings_dir_name):
+         bindir = os.path.dirname (sys.argv[0])
+         shutil.copytree (bindir + '/../etc/skel', skel_settings_dir_name)
+-        print 'Created ' + skel_settings_dir_name
++        print('Created ' + skel_settings_dir_name)
+ 
+ 
+ def main(argv=None):
+Index: adios-1.4.1/utils/skel/lib/skel_source.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_source.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_source.py	2013-10-24 15:10:36.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import sys
+ import os
+ import argparse
+@@ -82,25 +83,25 @@
+         # same program var (as is done by genarray)
+         c_file.write ('\n\n// Scalar declarations')
+         declarations = set()
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if x.is_scalar()]:
+             declarations.add (adios.cFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+             c_file.write (d)
+ 
+         # Now the initializations
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if x.is_scalar()]:
+             c_file.write (adios.cFormatter.get_initialization (v, params.get_group (g.get_name() ) ) )
+ 
+         c_file.write ('\n\n// Array declarations')
+         declarations = set()
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             declarations.add (adios.cFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+             c_file.write ('\n' + d)
+ 
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             c_file.write (adios.cFormatter.get_initialization (v, params.get_group (g.get_name() ) ) )
+ 
+         if measure.use_sleep_before_open():
+@@ -213,7 +214,7 @@
+         # free the array memory
+         c_file.write ('\n\n// Free the arrays')
+         frees = set()
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             frees.add ('\nfree (' + v.get_gwrite() + ');')
+ 
+         for f in frees:
+@@ -290,7 +291,7 @@
+         # same program var (as is done by genarray)
+         f_file.write ('\n\n! Scalar declarations')
+         declarations = set()
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if  x.is_scalar()]:
+             declarations.add (adios.fortranFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+@@ -298,7 +299,7 @@
+ 
+         f_file.write ('\n\n! Array declarations')
+         declarations = set()
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             declarations.add (adios.fortranFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+@@ -328,13 +329,13 @@
+         # For now, just do the numerical values first, then come back and do the more
+         # complicated ones. This won't cover something like a depends on b, b depends on c,
+         # but it will work for the moment
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if x.is_scalar()]:
+             #split at the spaces, just print the ones where the third element is a number
+             init_str = adios.fortranFormatter.get_initialization (v, params.get_group (g.get_name() ) )
+             if init_str.split (None, 2)[2].isdigit():
+                 f_file.write (init_str)
+ 
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if x.is_scalar()]:
+             #split at the spaces, just print the ones where the third element is a number
+             init_str = adios.fortranFormatter.get_initialization (v, params.get_group (g.get_name() ) )
+             if not init_str.split (None, 2)[2].isdigit():
+@@ -343,7 +344,7 @@
+         f_file.write ('\n\n! Initialize the arrays')
+ 
+ 		# And the vector initializations
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             f_file.write (adios.fortranFormatter.get_initialization (v, params.get_group (g.get_name() ) ) )
+ 
+ 
+@@ -527,7 +528,7 @@
+         # same program var (as is done by genarray)
+         c_file.write ('\n\n// Scalar declarations')
+         declarations = set()
+-        for v in filter (lambda x : x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if x.is_scalar()]:
+             declarations.add (adios.cFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+@@ -535,7 +536,7 @@
+ 
+         c_file.write ('\n\n// Array declarations')
+         declarations = set()
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             declarations.add (adios.cFormatter.get_declaration (v, params.get_group (g.get_name() ) ) )
+ 
+         for d in declarations:
+@@ -612,7 +613,7 @@
+         # free the array memory
+         c_file.write ('\n\n// Free the arrays')
+         frees = set()
+-        for v in filter (lambda x : not x.is_scalar(), g.get_vars() ):
++        for v in [x for x in g.get_vars() if not x.is_scalar()]:
+             frees.add ('\nfree (' + v.get_gwrite() + ');')
+ 
+         for f in frees:
+Index: adios-1.4.1/utils/skel/lib/skel_submit.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_submit.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_submit.py	2013-10-24 14:33:44.000000000 +0100
+@@ -1,5 +1,5 @@
+ #!/usr/bin/env python
+-
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import argparse
+ import os
+ 
+Index: adios-1.4.1/utils/skel/lib/skel_xml.py
+===================================================================
+--- adios-1.4.1.orig/utils/skel/lib/skel_xml.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/utils/skel/lib/skel_xml.py	2013-10-24 14:36:39.000000000 +0100
+@@ -1,5 +1,6 @@
+ #!/usr/bin/env python
+ 
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import argparse
+ import xml.dom.minidom
+ 
+Index: adios-1.4.1/wrappers/numpy/example/ncdf2bp.py
+===================================================================
+--- adios-1.4.1.orig/wrappers/numpy/example/ncdf2bp.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/wrappers/numpy/example/ncdf2bp.py	2013-10-24 14:31:53.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import absolute_import, division, print_function, unicode_literals
+ from adios import *
+ from scipy.io import netcdf
+ import numpy as np
+Index: adios-1.4.1/wrappers/numpy/test/adios_noxml_test.py
+===================================================================
+--- adios-1.4.1.orig/wrappers/numpy/test/adios_noxml_test.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/wrappers/numpy/test/adios_noxml_test.py	2013-10-24 15:01:36.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import absolute_import, division, print_function, unicode_literals
+ from adios import *
+ import numpy as np
+ 
+@@ -17,7 +18,7 @@
+ size = 1
+ rank = 0
+ groupsize =  4 + 4 + 4 + 8 * 1 * NX
+-t = np.array(range(NX), dtype=np.float64)
++t = np.array(list(range(NX)), dtype=np.float64)
+ set_group_size(fd, groupsize)
+ write_int(fd, "NX", NX)
+ write_int(fd, "size", size)
+Index: adios-1.4.1/wrappers/numpy/test/adios_read_test.py
+===================================================================
+--- adios-1.4.1.orig/wrappers/numpy/test/adios_read_test.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/wrappers/numpy/test/adios_read_test.py	2013-10-24 15:01:06.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++
+ from adios import *
+ import numpy as np
+ 
+@@ -9,6 +10,6 @@
+ v = g.var["/temperature"]
+ v.printself()
+ 
+-print v.read()
++print(v.read())
+ 
+ f.close()
+Index: adios-1.4.1/wrappers/numpy/test/adios_write_test.py
+===================================================================
+--- adios-1.4.1.orig/wrappers/numpy/test/adios_write_test.py	2013-10-24 12:34:17.000000000 +0100
++++ adios-1.4.1/wrappers/numpy/test/adios_write_test.py	2013-10-24 14:59:45.000000000 +0100
+@@ -1,4 +1,5 @@
+ #!/usr/bin/env python
++from __future__ import absolute_import, division, print_function, unicode_literals
+ import adios
+ import numpy as np
+ 
+@@ -9,7 +10,7 @@
+ size = 1
+ rank = 0
+ groupsize =  4 + 4 + 4 + 8 * 1 * NX
+-t = np.array(range(NX), dtype=np.float64)
++t = np.array(list(range(NXi)), dtype=np.float64)
+ adios.set_group_size(fd, groupsize)
+ adios.write_int(fd, "NX", NX)
+ adios.write_int(fd, "size", size)
diff --git a/debian/patches/series b/debian/patches/series
index a92f6e1..8edb265 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -1,6 +1,5 @@
 sh4.patch
 mpi_in_place.patch
-# nompi_flag.patch
 security.patch
-# errno.patch
 netcdf-fix.patch
+python3.patch

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



More information about the debian-science-commits mailing list