From d8a171106746669ace8ea5e06dd820bb501531b5 Mon Sep 17 00:00:00 2001 From: Debian Science Team Date: Sun, 11 Oct 2020 18:08:21 +0100 Subject: [PATCH] scripts_python3 Gbp-Pq: Name scripts_python3.patch --- scripts/dolfin-order/dolfin-order | 6 +++--- scripts/dolfin-plot/dolfin-plot | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/scripts/dolfin-order/dolfin-order b/scripts/dolfin-order/dolfin-order index e0150c5..3963fe3 100755 --- a/scripts/dolfin-order/dolfin-order +++ b/scripts/dolfin-order/dolfin-order @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # # Copyright (C) 2008 Anders Logg # @@ -33,7 +33,7 @@ def main(args): # Convert each mesh for filename in args: - print "Ordering %s" % filename + print( "Ordering {:s}".format(filename) ) # Read and order mesh mesh = Mesh(filename) @@ -54,7 +54,7 @@ def main(args): def usage(): "Print usage instructions" - print "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]" + print( "Usage: dolfin-order mesh0.xml[.gz] [mesh1.xml[.gz] mesh2.xml[.gz] ...]" ) if __name__ == "__main__": main(sys.argv[1:]) diff --git a/scripts/dolfin-plot/dolfin-plot b/scripts/dolfin-plot/dolfin-plot index 04e81e2..4c1cc71 100755 --- a/scripts/dolfin-plot/dolfin-plot +++ b/scripts/dolfin-plot/dolfin-plot @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 "Script for simple command-line plotting." @@ -25,14 +25,16 @@ # Last changed: 2010-12-22 import sys +import ffc +import matplotlib.pyplot as plt # Try importing DOLFIN try: from dolfin import * except: - print """\ + print( """\ Unable to import DOLFIN. The DOLFIN Python module is required -to run this script. Check that DOLFIN is in your PYTHONPATH.""" +to run this script. Check that DOLFIN is in your PYTHONPATH.""" ) sys.exit(1) def usage(): @@ -40,13 +42,13 @@ def usage(): # Build list of supported elements element_list = "" - for e in supported_elements_for_plotting: - if e in supported_elements: + for e in ffc.supported_elements_for_plotting: + if e in ffc.supported_elements: element_list += (" %s\n" % e) else: element_list += (" %s (*)\n" % e) - print """\ + print( """\ Usage: 1. dolfin-plot @@ -73,7 +75,7 @@ List of supported element families: %s A (*) indicates that the element is not supported by DOLFIN/FFC, but the element may still be plotted. -""" % element_list +""" % element_list ) # Check command-line arguments if len(sys.argv) < 2: @@ -93,16 +95,16 @@ options = dict([arg.split("=") for arg in sys.argv[1:] if "=" in arg]) if len(args) == 1: # Read mesh - print "Reading mesh from file '%s'." % args[0] + print( "Reading mesh from file '%s'." % args[0] ) try: mesh = Mesh(args[0]) except: - print "Unable to read mesh from file." + print( "Unable to read mesh from file." ) sys.exit(1) # Plot mesh - print "Plotting mesh." - plot(mesh, title="Mesh", interactive=True) + print( "Plotting mesh." ) + plot(mesh, title="Mesh") sys.exit(0) @@ -120,7 +122,7 @@ if len(args) in (2, 3, 4): # Create element - print "Creating finite element." + print( "Creating finite element." ) if len(args) == 3 or len(args) == 2: element = FiniteElement(family, domain, degree) @@ -139,8 +141,9 @@ if len(args) in (2, 3, 4): rotate = int(options["rotate"]) # Plot element - print "Plotting finite element." + print( "Plotting finite element." ) plot(element, rotate=rotate) + plt.show() sys.exit(0) -- 2.30.2