[xdmf] 05/38: WIP

Alastair McKinstry mckinstry at moszumanska.debian.org
Thu Apr 13 15:16:32 UTC 2017


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

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

commit 60b7b457d98047e212bc78dcc310004413f030b4
Author: Alastair McKinstry <mckinstry at debian.org>
Date:   Tue Feb 16 01:06:52 2016 +0000

    WIP
---
 debian/patches/python3.patch | 275 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 275 insertions(+)

diff --git a/debian/patches/python3.patch b/debian/patches/python3.patch
new file mode 100644
index 0000000..5df9803
--- /dev/null
+++ b/debian/patches/python3.patch
@@ -0,0 +1,275 @@
+Index: xdmf-2.1.dfsg.1/Examples/Python/FromOBJ.py
+===================================================================
+--- xdmf-2.1.dfsg.1.orig/Examples/Python/FromOBJ.py
++++ xdmf-2.1.dfsg.1/Examples/Python/FromOBJ.py
+@@ -23,11 +23,12 @@
+ #/*     for more information.                                       */
+ #/*                                                                 */
+ #/*******************************************************************/
++from __future__ import print_function
+ import sys
+ import string
+ 
+ 
+-print 'Loading vtk'
++print ('Loading vtk')
+ from libVTKCommonPython import *
+ from libVTKGraphicsPython import *
+ from libVTKImagingPython import *
+@@ -35,7 +36,7 @@ from libVTKPatentedPython import *
+ from libVTKContribPython import *
+ from libVTKLocalPython import *
+ 
+-print 'Loading Xdmf'
++print ('Loading Xdmf')
+ import Xdmf
+ 
+ 
+@@ -51,14 +52,14 @@ class FromOBJ :
+ 	def CreateXdmf( self ) :
+ 		ObjReader = vtkOBJReader()
+ 		ObjReader.SetFileName( self.FileName )
+-		print 'Reading ' + self.FileName
++		print ('Reading ' + self.FileName)
+ 		ObjReader.Update()
+ 		TriFilter = vtkTriangleFilter()
+ 		TriFilter.SetInput( ObjReader.GetOutput() )
+ 		TriFilter.Update()
+ 		if self.Convert == 1 :
+ 			Points = TriFilter.GetOutput().GetPoints()
+-			print 'Converting %d Points' % Points.GetNumberOfPoints()
++			print ('Converting %d Points' % Points.GetNumberOfPoints())
+ 			for i in range ( Points.GetNumberOfPoints() ) :
+ 				x, y, z = Points.GetPoint( i )
+ 				x = x * .0254
+@@ -99,6 +100,6 @@ if __name__ == '__main__' :
+ 	FileName = sys.argv[ argc - 1 ]
+ 	fobj = FromOBJ( FileName )
+ 	if argc > 2 :
+-		print 'Converting From inches'
++		print ('Converting From inches')
+ 		fobj.Convert = 1
+ 	fobj.CreateXdmf()
+Index: xdmf-2.1.dfsg.1/Examples/Python/NdgmCp.py
+===================================================================
+--- xdmf-2.1.dfsg.1.orig/Examples/Python/NdgmCp.py
++++ xdmf-2.1.dfsg.1/Examples/Python/NdgmCp.py
+@@ -24,6 +24,7 @@
+ #/*                                                                 */
+ #/*******************************************************************/
+ 
++from __future__ import print_function
+ import os
+ import sys
+ import string
+@@ -72,18 +73,18 @@ class NdgmCp :
+ 					self.FromStart = int( entry[1] )
+ 					self.FromEnd = int( entry[2] )
+ 					self.FromLength = self.FromEnd - self.FromStart
+-		print 'Source Data is %d bytes' % self.FromLength
++		print ('Source Data is %d bytes' % self.FromLength)
+ 
+ 	def Put( self ) :
+ 		if self.ToIsFile :
+ 			if self.FromIsFile :
+ 				Cmd = 'cp ' + self.From + ' ' + self.To
+-				print Cmd
++				print (Cmd)
+ 				os.system( Cmd )
+ 			else :
+ 				From = str(self.FromStart) + ':' + str(self.FromEnd)
+ 				Cmd = 'ice ndgm_cat ' + From + ' ' + self.To
+-				print Cmd
++				print (Cmd)
+ 				os.system( Cmd )
+ 		else :
+ 			Found = 0
+@@ -114,7 +115,7 @@ class NdgmCp :
+ 			else :
+ 				From = str(self.FromStart) + ':' + str(self.FromEnd)
+ 			Cmd = 'ice ndgm_cat ' + From + ' ' + str( self.ToStart )
+-			print Cmd
++			print (Cmd)
+ 			os.system( Cmd )
+ 
+ if __name__ == '__main__' :
+Index: xdmf-2.1.dfsg.1/Examples/Python/NdgmLs.py
+===================================================================
+--- xdmf-2.1.dfsg.1.orig/Examples/Python/NdgmLs.py
++++ xdmf-2.1.dfsg.1/Examples/Python/NdgmLs.py
+@@ -24,7 +24,7 @@
+ #/*                                                                 */
+ #/*******************************************************************/
+ 
+-
++from __future__ import print_function
+ import sys
+ import string
+ import Xdmf
+@@ -41,7 +41,7 @@ class NdgmLs :
+ 	def Ls( self ) :
+ 		status = self.Ndgm.Open()
+ 		if status <= 0 :
+-			print "Can't Connect to NDGM Server on " + self.Ndgm.GetNdgmHost()
++			print ("Can't Connect to NDGM Server on " + self.Ndgm.GetNdgmHost())
+ 			return None
+ 		# Get the Length
+ 		Length = self.Ndgm.GetTotalLength()
+@@ -82,10 +82,10 @@ if __name__ == '__main__' :
+ 	e = n.Format()
+ 	NumberOfEntries = len( e )
+ 	if NumberOfEntries < 1 :
+-		print '-1 : No Entries in NDGM'
++		print ('-1 : No Entries in NDGM')
+ 	else :
+ 		for i in range( NumberOfEntries ) :
+-			print '%2d : %s' % ( i, e[ i ])
++			print ('%2d : %s' % ( i, e[ i ]))
+ 		
+ 		
+ 
+Index: xdmf-2.1.dfsg.1/Examples/Python/PipeView.py
+===================================================================
+--- xdmf-2.1.dfsg.1.orig/Examples/Python/PipeView.py
++++ xdmf-2.1.dfsg.1/Examples/Python/PipeView.py
+@@ -24,19 +24,26 @@
+ #/*                                                                 */
+ #/*******************************************************************/
+ 
++from __future__ import print_function
+ import getopt
+ import sys
+ import string
+ 
+ 
+-print 'Loading Xdmf'
++print ('Loading Xdmf')
+ import Xdmf
+-print 'Loading vtk'
++print ('Loading vtk')
+ from vtk import *
+ from libvtkXdmfPython import *
+ import vtkRenderWidget
+ 
+-import Tkinter
++try:
++    import tkinter
++except:
++    # For Python2
++    import Tkinter
++    tkinter = Tkinter
++
+ # from vtkPipeline import *
+ import vtkPipeline.vtkPipeline
+ 
+@@ -57,7 +64,7 @@ class ViewAll:
+ 		sys.exit()
+ 
+ 	def SetUpPipeline( self, Ren ) :
+-		root = Tkinter.Tk()
++		root = tkinter.Tk()
+ 		root.title("XDMF Viewer")
+ 		wid = vtkRenderWidget.vtkTkRenderWidget (root, width=500, height=500)
+ 		wid.pack (expand='true', fill='both')
+@@ -73,12 +80,12 @@ class ViewAll:
+ 		root.mainloop ()
+ 
+ 	def View ( self, FileName ):
+-		print 'Parsing ' + FileName
++		print ('Parsing ' + FileName)
+ 
+ 		if( self.EndGrid <= 0 ) :
+ 			self.FindGrids( FileName )
+ 			self.EndGrid = self.NumberOfGrids - 1
+-		
++
+ 		Ren = vtkRenderer()
+ 		for GridIndex in range( self.StartGrid, self.EndGrid + 1 ) :
+ 			Reader = vtkXdmfReader()
+@@ -96,7 +103,7 @@ class ViewAll:
+ 			Index = GridIndex - self.StartGrid
+ 			if Index < len( self.Attributes ) :
+ 				AttrIndex = self.Attributes[ Index ]
+-				print 'Setting Attribute %d On' % AttrIndex
++				print ('Setting Attribute %d On' % AttrIndex)
+ 				Reader.SetAttributeStatusOn( AttrIndex )
+ 			
+ 	
+@@ -111,25 +118,25 @@ class ViewAll:
+ 			# if necessary
+ 			Gridptr = Reader.GetXdmfGridHandle()
+ 			Grid = Xdmf.HandleToXdmfGrid( Gridptr )
+-			print 'Grid %d has %d ' % (GridIndex, Grid.GetNumberOfElements()) + \
+-				Grid.GetTopologyTypeAsString()
++			print ('Grid %d has %d ' % (GridIndex, Grid.GetNumberOfElements()) + \
++				Grid.GetTopologyTypeAsString())
+ 			Nattr = Grid.GetNumberOfAttributes()
+-			print '<XdmfGrid> has %d Attributes' % Nattr
++			print ('<XdmfGrid> has %d Attributes' % Nattr)
+ 			for i in range( Nattr ) :
+ 				Attribute = Grid.GetAttribute( i )
+-				print '\tAttribute #%d' % i
+-				print '\t\tName: ' + Attribute.GetName()
+-				print '\t\tCenter: ' + Attribute.GetAttributeCenterAsString()
+-				print '\t\tType: ' + Attribute.GetAttributeTypeAsString()
++				print ('\tAttribute #%d' % i)
++				print ('\t\tName: ' + Attribute.GetName())
++				print ('\t\tCenter: ' + Attribute.GetAttributeCenterAsString())
++				print ('\t\tType: ' + Attribute.GetAttributeTypeAsString())
+ 	
+ 			# List All of the Available Arrays
+ 			PointData = Reader.GetOutput().GetPointData()
+ 			for i in range( PointData.GetNumberOfArrays() ) :
+ 				Array = PointData.GetArray( i )
+-				print '\tArray #%d ' % i
+-				print '\t\tName: ' + Array.GetName()
++				print ('\tArray #%d ' % i)
++				print ('\t\tName: ' + Array.GetName())
+ 				Min, Max = Array.GetRange()
+-				print '\t\tRange: %f -> %f' % (Min, Max)
++				print ('\t\tRange: %f -> %f' % (Min, Max))
+ 	
+ 	
+ 	
+@@ -166,12 +173,12 @@ class ViewAll:
+ 		# iRen.Start()
+ 
+ 	def usage (self) :
+-		print 'Options : --start=Grid# --end=Grid# --attribute=Index --attribute=Index ... File.xmf'
++		print ('Options : --start=Grid# --end=Grid# --attribute=Index --attribute=Index ... File.xmf')
+ 		sys.exit(0)
+ 
+ 	def Options( self, opts ) :
+ 		argc = len( opts )
+-		print '%d Args = ' % argc + str( opts )
++		print ('%d Args = ' % argc + str( opts ))
+ 		try :
+ 			opts, args = getopt.getopt(opts,
+ 					"aseh:",
+@@ -180,8 +187,8 @@ class ViewAll:
+ 		except getopt.GetoptError:
+ 			self.usage()
+ 			sys.exit(2)
+-		print 'opts = ' + str( opts )
+-		print 'args = ' + str( args )
++		print ('opts = ' + str( opts ))
++		print ('args = ' + str( args ))
+ 		output = None
+ 		for o, a in opts:
+ 			if o in ("-h", "--help"):
+@@ -192,11 +199,11 @@ class ViewAll:
+ 			if o in ("-e", "--end"):
+ 				self.EndGrid = int(a)
+ 			if o in ("-a", "--attribute"):
+-				print 'Appending ' + a
++				print ('Appending ' + a)
+ 				self.Attributes.append( int(a) )
+-		print 'StartGrid %d' % self.StartGrid
+-		print 'EndGrid %d' % self.EndGrid
+-		print 'Attributes = ' + str( self.Attributes )
++		print ('StartGrid %d' % self.StartGrid)
++		print ('EndGrid %d' % self.EndGrid)
++		print ('Attributes = ' + str( self.Attributes ))
+ if __name__ == '__main__' :
+ 	argc = len( sys.argv )
+ 	viewer = ViewAll()

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



More information about the debian-science-commits mailing list