From 261c0b4c416e28b9201c244342937d32d6564002 Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 19 Jul 2017 20:38:25 +0100 Subject: [PATCH 01/62] First guess at switching to venv --- scripts/firedrake-install | 63 ++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 37 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 9701395f91..10c89b6617 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -1,4 +1,4 @@ -#! /usr/bin/env python +#! /usr/bin/env python3 from __future__ import absolute_import, print_function, division import logging import platform @@ -98,8 +98,8 @@ if mode == "install": 3. The core set of Python packages is downloaded to ./firedrake/src/ and installed to the specified location. -The install creates a virtualenv in ./firedrake and installs inside -that virtualenv. +The install creates a venv in ./firedrake and installs inside +that venv. The installer will ensure that the required configuration options are passed to PETSc. In addition, any configure options which you provide @@ -138,9 +138,9 @@ honoured.""", help="C compiler to use when building with MPI (default is 'mpicc')") parser.add_argument("--show-petsc-configure-options", action="store_true", help="Print out the configure options passed to PETSc") - parser.add_argument("--virtualenv-name", default="firedrake", + parser.add_argument("--venv-name", default="firedrake", type=str, action="store", - help="Name of the virtualenv to create (default is 'firedrake')") + help="Name of the venv to create (default is 'firedrake')") parser.add_argument("--install", action="append", dest="packages", help="Additional packages to be installed. The address should be in format vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir . Some additional packages have shortcut install options for more information see --install_help.") parser.add_argument("--install-help", action="store_true", @@ -303,16 +303,15 @@ sitepackages = "/usr/local/lib/python%d.%d/site-packages/" % (v.major, v.minor) old_git_packages = ["instant", "ffc"] if mode == "install": - firedrake_env = os.path.abspath(args.virtualenv_name) + firedrake_env = os.path.abspath(args.venv_name) else: - try: - firedrake_env = os.environ["VIRTUAL_ENV"] - except KeyError: - quit("Unable to retrieve virtualenv name from the environment.\n Please ensure the virtualenv is active before running firedrake-update.") + # venv is the directory above the update script. Strictly, it + # doesn't need to be active. + firedrake_env = os.path.realpath(__file__) + "/../" -# virtualenv install +# venv install python = ["%s/bin/python" % firedrake_env] -# Use the pip from the virtualenv +# Use the pip from the venv pip = ["%s/bin/pip" % firedrake_env] if jenkins: # Explicitly run python on pip because Jenkins can make illegaly long shebang lines. @@ -492,7 +491,7 @@ index 1353c04..e136e6f 100644 -- 2.7.0.297.g563e384 """ - try: + try: p = subprocess.Popen(["git", "am"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT) p.communicate(input=patch) @@ -646,8 +645,8 @@ def pip_uninstall(package): again = True i = 0 while again: - # List installed packages, "locally". In a virtualenv, - # this just tells me packages in the virtualenv, otherwise it + # List installed packages, "locally". In a venv, + # this just tells me packages in the venv, otherwise it # gives me everything. lines = check_output(pip + ["freeze", "-l"]) again = False @@ -870,7 +869,7 @@ def build_and_install_adjoint(): with directory("libadjoint"): dir_util.mkpath("build") with directory("build"): - log.info("Configuring libadjoint for virtualenv installation in %s" % os.environ["VIRTUAL_ENV"]) + log.info("Configuring libadjoint for venv installation in %s" % os.environ["VIRTUAL_ENV"]) check_call(["cmake", "-DCMAKE_INSTALL_PREFIX=%s" % os.environ["VIRTUAL_ENV"], ".."], env=env) log.info("Installing libadjoint.") check_call(["make", "install"]) @@ -1044,28 +1043,18 @@ else: if mode == "install": if os.path.exists(firedrake_env): - log.warning("Specified virtualenv '%s' already exists", firedrake_env) - quit("Can't install into existing virtualenv '%s'" % firedrake_env) - try: - import virtualenv - except: - log.info("Installing virtualenv.") - # sys.real_prefix exists if we are already in the virtualenv - if hasattr(sys, "real_prefix"): - check_call(["pip", "install", "virtualenv"]) - else: - check_call(["pip", "install", "--user", "virtualenv"]) - quit("Virtual env installed. Please run firedrake-%s again." % mode) - log.info("Creating firedrake virtualenv in '%s'." % firedrake_env) - virtualenv.create_environment(firedrake_env, site_packages=False) + log.warning("Specified venv '%s' already exists", firedrake_env) + quit("Can't install into existing venv '%s'" % firedrake_env) + + log.info("Creating firedrake venv in '%s'." % firedrake_env) + import venv + venv.create_environment(firedrake_env, site_packages=False) # Ensure pip and setuptools are at the latest version. run_pip(["install", "-U", "setuptools"]) run_pip(["install", "-U", "pip"]) -virtual_env_vars = dict(__file__='%s/bin/activate_this.py' % firedrake_env) -exec(open("%s/bin/activate_this.py" % firedrake_env).read(), virtual_env_vars) -# Activating the virtual_env from within Python does not automatically set the environment variable. -os.environ["VIRTUAL_ENV"] = virtual_env_vars["base"] + # We haven't activated the venv so we need to manually set the environment. + os.environ["VIRTUAL_ENV"] = firedrake_env os.chdir(firedrake_env) @@ -1253,11 +1242,11 @@ os.chdir("../..") log.info("\n\nSuccessfully installed Firedrake.\n") -log.info("\nFiredrake has been installed in a python virtualenv. You activate it with:\n") +log.info("\nFiredrake has been installed in a python venv. You activate it with:\n") log.info(" . %s/bin/activate\n" % firedrake_env) -log.info("The virtualenv can be deactivated by running:\n") +log.info("The venv can be deactivated by running:\n") log.info(" deactivate\n\n") -log.info("To upgrade Firedrake activate the virtualenv and run firedrake-update\n") +log.info("To upgrade Firedrake activate the venv and run firedrake-update\n") try: From 31cd05bcda23e2f55b521e16d2ef9572ac2e7e31 Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 19 Jul 2017 20:41:44 +0100 Subject: [PATCH 02/62] accidental space --- scripts/firedrake-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 10c89b6617..35c4adfcfc 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -491,7 +491,7 @@ index 1353c04..e136e6f 100644 -- 2.7.0.297.g563e384 """ - try: + try: p = subprocess.Popen(["git", "am"], stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.STDOUT) p.communicate(input=patch) From 8061b6ee033642932bc87e7ea7b9bd9bf6cc5832 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 11:09:24 +0100 Subject: [PATCH 03/62] remove legacy hacks --- scripts/firedrake-install | 116 ++++++++++---------------------------- 1 file changed, 30 insertions(+), 86 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 35c4adfcfc..3ef610823b 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -52,7 +52,7 @@ class FiredrakeConfiguration(dict): if o in args.__dict__.keys(): self["options"][o] = args.__dict__[o] - _persistent_options = ["developer", "package_manager", + _persistent_options = ["package_manager", "minimal_petsc", "mpicc", "disable_ssh", "show_petsc_configure_options", "adjoint", "slepc", "slope", "packages", "honour_pythonpath", @@ -151,40 +151,15 @@ honoured.""", if args.package_branch: branches = {package: branch for package, branch in args.package_branch} - args.developer = True # All new installations are developer mode, since there is no advantage to non-developer mode installs. args.prefix = False # Disabled as untested args.packages = args.packages or [] config = FiredrakeConfiguration(args) else: - class LegacyState(object): - pass - # The following args modifications are retained for backwards compatibility. - # new options should not be added here. - args = LegacyState() - args.developer = False - args.package_manager = False - args.minimal_petsc = False - args.rebuild_script = False - args.mpicc = False - args.disable_ssh = False - args.show_petsc_configure_options = False - args.adjoint = False - args.slope = False - args.slepc = False - - legacy_args = args.__dict__.copy() - legacy = False - try: - import firedrake_configuration - config = firedrake_configuration.get_config() - if config is None: - legacy = True - except ImportError: - legacy = True - - if legacy: - config = {"options": args.__dict__} + import firedrake_configuration + config = firedrake_configuration.get_config() + if config is None: + raise InstallError("Failed to find existing Firedrake configuration") parser = ArgumentParser(description="""Update this firedrake install to the latest versions of all packages.""", formatter_class=RawDescriptionHelpFormatter) @@ -227,11 +202,6 @@ else: args.rebuild = True config = deep_update(config, FiredrakeConfiguration(args)) - if legacy: - del legacy_args["adjoint"] - del legacy_args["slope"] - del legacy_args["slepc"] - config["options"] = deep_update(config["options"], legacy_args) if args.install_help: help_string = """ @@ -312,10 +282,7 @@ else: # venv install python = ["%s/bin/python" % firedrake_env] # Use the pip from the venv -pip = ["%s/bin/pip" % firedrake_env] -if jenkins: - # Explicitly run python on pip because Jenkins can make illegaly long shebang lines. - pip = python + pip +pip = python + ["-m", "pip"] pipinstall = pip + ["install", "--no-binary", ",".join(wheel_blacklist)] pyinstall = python + ["setup.py", "install"] sitepackages = "%s/lib/python%d.%d/site-packages" % (firedrake_env, v.major, v.minor) @@ -620,8 +587,8 @@ def install(package): log.info("Installing %s" % package) if package == "petsc/": build_and_install_petsc() - # The following outrageous hack works around the fact that petsc cannot be installed in developer mode. - elif options["developer"] and package not in ["petsc/", "petsc4py/", "slepc/", "slepc4py/"]: + # The following outrageous hack works around the fact that petsc and co. cannot be installed in developer mode. + elif package not in ["petsc4py/", "slepc/", "slepc4py/"]: run_pip_install(["-e", package]) else: run_pip_install(["--ignore-installed", package]) @@ -664,14 +631,14 @@ def pip_uninstall(package): def build_and_install_petsc(): import hashlib - import urllib + import urllib.request tarball = "eigen-3.3.3.tgz" url = "https://bitbucket.org/eigen/eigen/get/3.3.3.tar.gz" sha = hashlib.sha256() expect = "94878cbfa27b0d0fbc64c00d4aafa137f678d5315ae62ba4aecddbd4269ae75f" if not os.path.exists(tarball): log.info("Downloading Eigen from '%s' to '%s'" % (url, tarball)) - urllib.urlretrieve(url, filename=tarball) + urllib.request.urlretrieve(url, filename=tarball) else: log.info("Eigen tarball already downloaded to '%s'" % tarball) log.info("Checking Eigen tarball integrity") @@ -1048,7 +1015,7 @@ if mode == "install": log.info("Creating firedrake venv in '%s'." % firedrake_env) import venv - venv.create_environment(firedrake_env, site_packages=False) + venv.EnvBuilder(with_pip=True).create(firedrake_env) # Ensure pip and setuptools are at the latest version. run_pip(["install", "-U", "setuptools"]) run_pip(["install", "-U", "pip"]) @@ -1099,23 +1066,21 @@ if mode == "install": pipinstall.append("--no-deps") for p in packages: install(p+"/") - if options["developer"]: - sys.path.append(os.getcwd() + "/" + p) + sys.path.append(os.getcwd() + "/" + p) # Work around easy-install.pth bug. - if options["developer"]: - try: - packages.remove("petsc") - except ValueError: - pass - packages.remove("petsc4py") - packages.remove("firedrake") - v = sys.version_info - if v.major <= 2: - easyinstall = open("../lib/python%d.%d/site-packages/easy-install.pth" % (v.major, v.minor), "r").readlines() - new_packages = [os.getcwd() + "/" + p + "\n" for p in packages] - open("../lib/python%d.%d/site-packages/easy-install.pth" % (v.major, v.minor), "w").writelines( - easyinstall[:1] + new_packages + easyinstall[1:]) + try: + packages.remove("petsc") + except ValueError: + pass + packages.remove("petsc4py") + packages.remove("firedrake") + v = sys.version_info + if v.major <= 2: + easyinstall = open("../lib/python%d.%d/site-packages/easy-install.pth" % (v.major, v.minor), "r").readlines() + new_packages = [os.getcwd() + "/" + p + "\n" for p in packages] + open("../lib/python%d.%d/site-packages/easy-install.pth" % (v.major, v.minor), "w").writelines( + easyinstall[:1] + new_packages + easyinstall[1:]) build_update_script() @@ -1149,34 +1114,13 @@ else: packages.remove("petsc") packages.remove("petsc4py") - # Forcibly upgrade old installations to developer mode. - if not options["developer"]: - forced_developer = True - args.clean = True - options["developer"] = True - else: - forced_developer = False - if args.clean: - try: - clean_obsolete_packages() - for package in packages: - pip_uninstall(package) - if args.rebuild: - pip_uninstall("petsc") - pip_uninstall("petsc4py") - except: - if forced_developer: - log.error("*************************************************************") - log.error("* Uninstalling packages failed while attemping to upgrade *") - log.error("* your installation to developer mode. *") - log.error("* *") - log.error("* Please try running firedrake-update again, and if the *") - log.error("* problem persists, please raise an issue via github, the *") - log.error("* email list or the slack channel. *") - log.error("*************************************************************") - - raise + clean_obsolete_packages() + for package in packages: + pip_uninstall(package) + if args.rebuild: + pip_uninstall("petsc") + pip_uninstall("petsc4py") for p in packages: try: From a6fe5b3b9df1fd3e5b7d01a58e655acd80acd781 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 11:21:32 +0100 Subject: [PATCH 04/62] idiot-proofing --- scripts/firedrake-install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 3ef610823b..96da77cf12 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -33,7 +33,6 @@ class InstallError(Exception): # Exception for generic install problems. pass - class FiredrakeConfiguration(dict): """A dictionary extended to facilitate the storage of Firedrake configuration information.""" @@ -236,6 +235,9 @@ log = logging.getLogger() log.info("Running %s" % " ".join(sys.argv)) +# Python version idiot check as soon as logging is up +if sys.version_info.major != 3: + quit("Firedrake requires Python 3. firedrake-%s was run with Python %s" % (mode, sys.version)) @atexit.register def print_log_location(): From d39a660d389016b4e1ccc08a3d8f6ba37af33a2c Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 12:28:39 +0100 Subject: [PATCH 05/62] Decode subprocess output strings before logging --- scripts/firedrake-install | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 96da77cf12..62f0d253b5 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -322,9 +322,9 @@ if mode == "update" and petsc_int_type_changed: def check_call(arguments, env=None): try: - log.debug(subprocess.check_output(arguments, stderr=subprocess.STDOUT, env=env)) + log.debug(subprocess.check_output(arguments, stderr=subprocess.STDOUT, env=env).decode()) except subprocess.CalledProcessError as e: - log.debug(e.output) + log.debug(e.output.decode()) raise @@ -338,7 +338,7 @@ def check_output(args, env=None): # Python 3 return result.decode() except subprocess.CalledProcessError as e: - log.debug(e.output) + log.debug(e.output.decode()) raise From d986f9302796c5cc5e2bb7c1de65f28867a0dc5f Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 14:55:52 +0100 Subject: [PATCH 06/62] remove more legacy crud --- Jenkinsfile | 2 - scripts/firedrake-install | 99 ++++----------------------------------- 2 files changed, 8 insertions(+), 93 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index b92788ba06..14a3ee42c3 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,9 +21,7 @@ pipeline { sh 'mkdir tmp' dir('tmp') { timestamps { - sh 'pip install virtualenv' sh '../scripts/firedrake-install --disable-ssh --minimal-petsc ${SLEPC} --adjoint --slope --install thetis --install gusto ${PACKAGE_MANAGER}' - sh '$HOME/.local/bin/virtualenv --relocatable firedrake' } } } diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 62f0d253b5..561f29c5fe 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -1,5 +1,4 @@ #! /usr/bin/env python3 -from __future__ import absolute_import, print_function, division import logging import platform import subprocess @@ -191,8 +190,6 @@ else: args = parser.parse_args() - args.rebuild_script = legacy_args["rebuild_script"] - args.packages = list(set(args.packages)) # remove duplicates petsc_int_type_changed = False @@ -266,13 +263,9 @@ options = config["options"] # Apply short cut package names. options["packages"] = [firedrake_apps.get(p, (None, p))[1] for p in options["packages"]] -# Where are packages installed relative to --root? -# This is a bit of a hack. -v = sys.version_info -sitepackages = "/usr/local/lib/python%d.%d/site-packages/" % (v.major, v.minor) # Record of obsolete packages which --clean should remove from old installs. -old_git_packages = ["instant", "ffc"] +old_git_packages = [] if mode == "install": firedrake_env = os.path.abspath(args.venv_name) @@ -287,7 +280,6 @@ python = ["%s/bin/python" % firedrake_env] pip = python + ["-m", "pip"] pipinstall = pip + ["install", "--no-binary", ",".join(wheel_blacklist)] pyinstall = python + ["setup.py", "install"] -sitepackages = "%s/lib/python%d.%d/site-packages" % (firedrake_env, v.major, v.minor) if "PYTHONPATH" in os.environ and not args.honour_pythonpath: quit("""The PYTHONPATH environment variable is set. This is probably an error. @@ -398,76 +390,6 @@ def git_url(plain_url, protocol): raise ValueError("Unknown git protocol: %s" % protocol) -def update_and_apply_petsc_fix(): - HEAD1 = check_output(["git", "rev-parse", "HEAD~"]).strip() - # Fetch from upstream - check_call(["git", "fetch", "origin"]) - # Check if we've applied horrific monkey-patching - magic_sha = "156a1856fd44f55220132393778f0fda1e6096e3" - if HEAD1 == magic_sha: - # Yes, check if the upstream branch pointer has - # changed, in which case we can reset to upstream. - log.info("Already applied eigen fix, checking if upstream is newer") - remote_sha = check_output(["git", "rev-parse", "origin/firedrake"]).strip() - if remote_sha != magic_sha: - log.info("Upstream is newer, resetting to upstream") - check_call(["git", "reset", "--hard", magic_sha]) - check_call(["git", "pull"]) - else: - # Update, then check if we need to apply a patch. - check_call(["git", "pull"]) - HEAD = check_output(["git", "rev-parse", "HEAD"]).strip() - if HEAD == magic_sha: - # No, and we need to, so apply the fix. - log.info("Apply temporary --download-eigen fix") - patch = """\ -From a2a264416ccac135640344f54852f6b74bf9de1e Mon Sep 17 00:00:00 2001 -From: Lawrence Mitchell -Date: Tue, 11 Apr 2017 10:35:04 +0100 -Subject: [PATCH] Temporary workaround for --download-eigen --prefix issues - ---- - config/BuildSystem/config/package.py | 2 ++ - config/BuildSystem/config/packages/eigen.py | 2 +- - 2 files changed, 3 insertions(+), 1 deletion(-) - -diff --git a/config/BuildSystem/config/package.py b/config/BuildSystem/config/package.py -index ba78667..6aa03bb 100644 ---- a/config/BuildSystem/config/package.py -+++ b/config/BuildSystem/config/package.py -@@ -351,6 +351,8 @@ class Package(config.base.Configure): - def generateGuesses(self): - d = self.checkDownload() - if d: -+ if not self.liblist: -+ yield('Download '+self.PACKAGE, d, [], self.getIncludeDirs(d, self.includedir)) - for libdir in [self.libdir, self.altlibdir]: - libdirpath = os.path.join(d, libdir) - if not os.path.isdir(libdirpath): -diff --git a/config/BuildSystem/config/packages/eigen.py b/config/BuildSystem/config/packages/eigen.py -index 1353c04..e136e6f 100644 ---- a/config/BuildSystem/config/packages/eigen.py -+++ b/config/BuildSystem/config/packages/eigen.py -@@ -7,7 +7,7 @@ class Configure(config.package.CMakePackage): - self.download = ['hg://https://bitbucket.org/eigen/eigen/'] - self.functions = [] - self.includes = ['Eigen/Core'] -- self.liblist = [[]] -+ self.liblist = [] - self.cxx = 1 - self.includedir = os.path.join('include', 'eigen3') - self.useddirectly = 0 --- -2.7.0.297.g563e384 -""" - try: - p = subprocess.Popen(["git", "am"], stdout=subprocess.PIPE, - stdin=subprocess.PIPE, stderr=subprocess.STDOUT) - p.communicate(input=patch) - except subprocess.CalledProcessError as e: - log.debug(e.output) - raise - def git_clone(url): name, plain_url, branch = split_requirements_url(url) @@ -499,8 +421,6 @@ def git_clone(url): except subprocess.CalledProcessError: log.error("Failed to check out branch %s" % branch) raise - if name == "petsc": - update_and_apply_petsc_fix() return name @@ -543,10 +463,7 @@ def git_update(name, url=None): and "github.com/firedrakeproject" in plain_url: log.info("Updating git remote for %s" % name) check_call(["git", "remote", "set-url", "origin", new_url]) - if name == "petsc": - update_and_apply_petsc_fix() - else: - check_call(["git", "pull"]) + check_call(["git", "pull"]) git_sha_new = check_output(["git", "rev-parse", "HEAD"]) return git_sha != git_sha_new @@ -656,6 +573,7 @@ def build_and_install_petsc(): expect, actual) else: log.info("Eigen tarball hash valid") + log.info("Building PETSc. \nDepending on your platform, may take between a few minutes and an hour or more to build!") run_pip_install(["--ignore-installed", "petsc/"]) @@ -765,7 +683,7 @@ def build_and_install_libspatialindex(): check_call(["sed", "-i", "-e", "/^SUBDIRS/s/ test//", "Makefile.am"]) # Build and install check_call(["./autogen.sh"]) - check_call(["./configure", "--prefix=" + sys.prefix, + check_call(["./configure", "--prefix=" + firedrake_env, "--enable-shared", "--disable-static"]) check_call(["make"]) check_call(["make", "install"]) @@ -862,8 +780,8 @@ def build_and_install_slope(): # Build and install (hack: need to do this manually as SLOPE is # still stupid and doesn't have a proper configure+make+install system) check_call(["make"]) - check_call(["mv"] + glob(os.path.join('lib', '*')) + [os.path.join(sys.prefix, 'lib')]) - include_dir = os.path.join(sys.prefix, 'include', 'SLOPE') + check_call(["mv"] + glob(os.path.join('lib', '*')) + [os.path.join(firedrake_env, 'lib')]) + include_dir = os.path.join(firedrake_env, 'include', 'SLOPE') check_call(["mkdir", "-p", include_dir]) check_call(["cp"] + glob(os.path.join('sparsetiling', 'include', '*')) + [include_dir]) # Also install the Python interface @@ -1000,8 +918,8 @@ elif osname == "Linux": log.info("* MPI") log.info("* Blas and Lapack") log.info("* Git, Mercurial") - log.info("* Python version 2.7") - log.info("* pip and the Python headers") + log.info("* Python version >=3.5") + log.info("* The Python headers") log.info("* autoconf, automake, libtool") log.info("* CMake") log.info("* zlib") @@ -1055,7 +973,6 @@ if mode == "install": if not args.honour_petsc_dir: pipinstall.append("--no-deps") packages.remove("petsc") - log.info("Depending on your platform, PETSc may take an hour or more to build!") install("petsc/") pipinstall.pop() From 6f490d4b02094f507da1474387df1b12ce737198 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 15:00:11 +0100 Subject: [PATCH 07/62] idiv rename --- tests/regression/test_expressions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/regression/test_expressions.py b/tests/regression/test_expressions.py index 733c5789f8..ecfb51ae2e 100644 --- a/tests/regression/test_expressions.py +++ b/tests/regression/test_expressions.py @@ -1,5 +1,5 @@ from __future__ import absolute_import, print_function, division -from operator import iadd, isub, imul, idiv +from operator import iadd, isub, imul, itruediv from functools import partial from itertools import permutations @@ -141,7 +141,7 @@ def interpolatetest(f, expr, x): iaddtest = partial(ioptest, op=iadd) isubtest = partial(ioptest, op=isub) imultest = partial(ioptest, op=imul) -idivtest = partial(ioptest, op=idiv) +itruedivtest = partial(ioptest, op=itruediv) common_tests = [ @@ -157,8 +157,8 @@ def interpolatetest(f, expr, x): 'isubtest(two, 1, 1)', 'imultest(one, 2, 2)', 'imultest(one, two, 2)', - 'idivtest(two, 2, 1)', - 'idivtest(one, two, 0.5)', + 'itruedivtest(two, 2, 1)', + 'itruedivtest(one, two, 0.5)', 'isubtest(one, one, 0)', 'assigntest(f, 2 * one, 2)', 'assigntest(f, one - one, 0)'] From f355185cb9987fa1896a68e17444ffc80f077dc7 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 15:49:28 +0100 Subject: [PATCH 08/62] don't pass parameters to Object.__new__ --- firedrake/functionspaceimpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firedrake/functionspaceimpl.py b/firedrake/functionspaceimpl.py index ce30a7bcda..9f53caa529 100644 --- a/firedrake/functionspaceimpl.py +++ b/firedrake/functionspaceimpl.py @@ -755,7 +755,7 @@ class ProxyFunctionSpace(FunctionSpace): """ def __new__(cls, mesh, element, name=None): topology = mesh.topology - self = super(ProxyFunctionSpace, cls).__new__(cls, topology, element, name=name) + self = super(ProxyFunctionSpace, cls).__new__(cls) if mesh is not topology: return WithGeometry(self, mesh) else: From 4674019568b42120a280e73c18c86c6fb0fed20e Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 20 Jul 2017 16:02:56 +0100 Subject: [PATCH 09/62] fecking unicode. --- firedrake/interpolation.py | 4 ++-- firedrake/tsfc_interface.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/firedrake/interpolation.py b/firedrake/interpolation.py index 65971abe0a..b88deb9785 100644 --- a/firedrake/interpolation.py +++ b/firedrake/interpolation.py @@ -220,7 +220,7 @@ def compile_python_kernel(expression, to_pts, to_element, fs, coords): coords_space = coords.function_space() coords_element = create_element(coords_space.ufl_element(), vector_is_mixed=False) - X_remap = coords_element.tabulate(0, to_pts).values()[0] + X_remap = list(coords_element.tabulate(0, to_pts).values())[0] # The par_loop will just pass us arguments, since it doesn't # know about keyword args at all so unpack into a dict that we @@ -252,7 +252,7 @@ def compile_c_kernel(expression, to_pts, to_element, fs, coords): names = {v[0] for v in expression._user_args} - X = coords_element.tabulate(0, to_pts).values()[0] + X = list(coords_element.tabulate(0, to_pts).values())[0] # Produce C array notation of X. X_str = "{{"+"},\n{".join([",".join(map(str, x)) for x in X.T])+"}}" diff --git a/firedrake/tsfc_interface.py b/firedrake/tsfc_interface.py index 9b2086791b..3637461cd9 100644 --- a/firedrake/tsfc_interface.py +++ b/firedrake/tsfc_interface.py @@ -95,10 +95,10 @@ def _cache_key(cls, form, name, parameters, number_map): # FIXME Making the COFFEE parameters part of the cache key causes # unnecessary repeated calls to TSFC when actually only the kernel code # needs to be regenerated - return md5(form.signature() + name + return md5((form.signature() + name + str(default_parameters["coffee"]) + str(parameters) - + str(number_map)).hexdigest(), form.ufl_domains()[0].comm + + str(number_map)).encode()).hexdigest(), form.ufl_domains()[0].comm def __init__(self, form, name, parameters, number_map): """A wrapper object for one or more TSFC kernels compiled from a given :class:`~ufl.classes.Form`. From 3c9d48e7c308bb1b57327160cf49b2f34763dbfd Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 13:41:06 +0100 Subject: [PATCH 10/62] fix flake8 --- scripts/firedrake-install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 561f29c5fe..83ecdec879 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -32,6 +32,7 @@ class InstallError(Exception): # Exception for generic install problems. pass + class FiredrakeConfiguration(dict): """A dictionary extended to facilitate the storage of Firedrake configuration information.""" @@ -236,6 +237,7 @@ log.info("Running %s" % " ".join(sys.argv)) if sys.version_info.major != 3: quit("Firedrake requires Python 3. firedrake-%s was run with Python %s" % (mode, sys.version)) + @atexit.register def print_log_location(): log.info("\n\n%s log saved in firedrake-%s.log" % (mode.capitalize(), mode)) @@ -390,7 +392,6 @@ def git_url(plain_url, protocol): raise ValueError("Unknown git protocol: %s" % protocol) - def git_clone(url): name, plain_url, branch = split_requirements_url(url) if name == "petsc" and args.honour_petsc_dir: From f344c1e9da3a7d3c3df883191697ee14a68d8384 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 15:46:18 +0100 Subject: [PATCH 11/62] map has become lazy --- firedrake/assemble.py | 8 +++++--- firedrake/tsfc_interface.py | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/firedrake/assemble.py b/firedrake/assemble.py index 88f3a80909..9cc3943594 100644 --- a/firedrake/assemble.py +++ b/firedrake/assemble.py @@ -1,7 +1,5 @@ from __future__ import absolute_import, print_function, division import numpy -import operator -import functools import ufl from collections import defaultdict @@ -141,7 +139,11 @@ def create_assembly_callable(f, tensor=None, bcs=None, form_compiler_parameters= inverse=inverse, mat_type=mat_type, sub_mat_type=sub_mat_type, collect_loops=True) - return functools.partial(map, operator.methodcaller("__call__"), loops) + + def thunk(): + for kernel in loops: + kernel() + return thunk @utils.known_pyop2_safe diff --git a/firedrake/tsfc_interface.py b/firedrake/tsfc_interface.py index 3637461cd9..20db26a259 100644 --- a/firedrake/tsfc_interface.py +++ b/firedrake/tsfc_interface.py @@ -206,7 +206,7 @@ def _real_mangle(form): """If the form contains arguments in the Real function space, replace these with literal 1 before passing to tsfc.""" a = form.arguments() - reals = map(lambda x: x.ufl_element().family() == "Real", a) + reals = [x.ufl_element().family() == "Real" for x in a] if not any(reals): return form replacements = {} From 50cb035a5777958e8f83839dab4e50d7e57608fd Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 16:21:08 +0100 Subject: [PATCH 12/62] fix firedrake-status --- scripts/firedrake-status | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/firedrake-status b/scripts/firedrake-status index 9e07604569..53cdfacdbb 100755 --- a/scripts/firedrake-status +++ b/scripts/firedrake-status @@ -97,8 +97,8 @@ for dir in sorted(os.listdir(firedrake_env + "/src")): else: raise try: - revision = check_output(["git", "rev-parse", "--short", "HEAD"]).strip() - branch = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).strip() + revision = check_output(["git", "rev-parse", "--short", "HEAD"]).decode('ascii').strip() + branch = check_output(["git", "rev-parse", "--abbrev-ref", "HEAD"]).decode('ascii').strip() except: log.error("Unable to retrieve git information from %s." % dir) else: From 7be3726f344437c5352c82cbe26788cdbe935941 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 16:21:20 +0100 Subject: [PATCH 13/62] numpy.prod returns np.int64, not int --- firedrake/functionspaceimpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firedrake/functionspaceimpl.py b/firedrake/functionspaceimpl.py index 9f53caa529..e2a19c253c 100644 --- a/firedrake/functionspaceimpl.py +++ b/firedrake/functionspaceimpl.py @@ -274,7 +274,7 @@ def __init__(self, mesh, element, name=None): the number of components of their :meth:`~ufl.classes.FiniteElementBase.value_shape`.""" - self.value_size = numpy.prod(self.shape, dtype=int) + self.value_size = int(numpy.prod(self.shape, dtype=int)) """The total number of degrees of freedom at each function space node.""" self.name = name From 22ecb7ea0555663066bf00bcb696f67111cb3c81 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 17:02:08 +0100 Subject: [PATCH 14/62] removed dict methods --- firedrake/parloops.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/firedrake/parloops.py b/firedrake/parloops.py index da149165c4..c6d4798e17 100644 --- a/firedrake/parloops.py +++ b/firedrake/parloops.py @@ -68,7 +68,7 @@ def _form_kernel(kernel, measure, args, **kwargs): kargs = [] lkernel = kernel - for var, (func, intent) in args.iteritems(): + for var, (func, intent) in args.items(): if isinstance(func, constant.Constant): if intent is not READ: raise RuntimeError("Only READ access is allowed to Constant") @@ -218,13 +218,13 @@ def par_loop(kernel, measure, args, **kwargs): # Ensure that the dict args passed in are consistently ordered # (sorted by the string key). sorted_args = collections.OrderedDict() - for k in sorted(args.iterkeys()): + for k in sorted(args.keys()): sorted_args[k] = args[k] args = sorted_args if measure is direct: mesh = None - for (func, intent) in args.itervalues(): + for (func, intent) in args.values(): if isinstance(func, Indexed): c, i = func.ufl_operands idx = i._indices[0]._value @@ -243,7 +243,7 @@ def par_loop(kernel, measure, args, **kwargs): raise TypeError("No Functions passed to direct par_loop") else: domains = [] - for func, _ in args.itervalues(): + for func, _ in args.values(): domains.extend(func.ufl_domains()) domains = join_domains(domains) # Assume only one domain @@ -261,6 +261,6 @@ def mkarg(f, intent): m = _map['nodes'](c) return c.dat[idx](intent, m.split[idx] if m else None) return f.dat(intent, _map['nodes'](f)) - op2args += [mkarg(func, intent) for (func, intent) in args.itervalues()] + op2args += [mkarg(func, intent) for (func, intent) in args.values()] return pyop2.par_loop(*op2args) From cc18065ec4360718c7a37a8daa766da7e027b4b2 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 17:52:02 +0100 Subject: [PATCH 15/62] probably accidental closure --- firedrake/parloops.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firedrake/parloops.py b/firedrake/parloops.py index c6d4798e17..d31078ed50 100644 --- a/firedrake/parloops.py +++ b/firedrake/parloops.py @@ -255,8 +255,8 @@ def par_loop(kernel, measure, args, **kwargs): op2args.append(_map['itspace'](mesh, measure)) def mkarg(f, intent): - if isinstance(func, Indexed): - c, i = func.ufl_operands + if isinstance(f, Indexed): + c, i = f.ufl_operands idx = i._indices[0]._value m = _map['nodes'](c) return c.dat[idx](intent, m.split[idx] if m else None) From 032b94d4231990183b0c4b52d5ff2f41b9218eab Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 17:52:14 +0100 Subject: [PATCH 16/62] fix test cases --- tests/regression/test_function.py | 8 ++++---- tests/regression/test_function_spaces.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/regression/test_function.py b/tests/regression/test_function.py index 50b8416f98..e6b9a37740 100644 --- a/tests/regression/test_function.py +++ b/tests/regression/test_function.py @@ -43,7 +43,7 @@ def test_firedrake_scalar_function(V): def test_firedrake_tensor_function(W): f = Function(W) vals = np.array([1.0, 2.0, 10.0, 20.0]).reshape(2, 2) - f.interpolate(Expression(vals.astype("string"))) + f.interpolate(Expression(vals.astype(str))) assert np.allclose(f.dat.data_ro, vals) g = Function(f) @@ -51,7 +51,7 @@ def test_firedrake_tensor_function(W): # Check that g is indeed a deep copy fvals = np.array([5.0, 6.0, 7.0, 8.0]).reshape(2, 2) - f.interpolate(Expression(fvals.astype("string"))) + f.interpolate(Expression(fvals.astype(str))) assert np.allclose(f.dat.data_ro, fvals) assert np.allclose(g.dat.data_ro, vals) @@ -60,7 +60,7 @@ def test_firedrake_tensor_function(W): def test_firedrake_tensor_function_nonstandard_shape(W_nonstandard_shape): f = Function(W_nonstandard_shape) vals = np.arange(1, W_nonstandard_shape.value_size+1).reshape(f.ufl_shape) - f.interpolate(Expression(vals.astype("string"))) + f.interpolate(Expression(vals.astype(str))) assert np.allclose(f.dat.data_ro, vals) g = Function(f) @@ -68,7 +68,7 @@ def test_firedrake_tensor_function_nonstandard_shape(W_nonstandard_shape): # Check that g is indeed a deep copy fvals = vals + 10 - f.interpolate(Expression(fvals.astype("string"))) + f.interpolate(Expression(fvals.astype(str))) assert np.allclose(f.dat.data_ro, fvals) assert np.allclose(g.dat.data_ro, vals) diff --git a/tests/regression/test_function_spaces.py b/tests/regression/test_function_spaces.py index c62d496a66..6a1d9f7bf9 100644 --- a/tests/regression/test_function_spaces.py +++ b/tests/regression/test_function_spaces.py @@ -79,10 +79,10 @@ def test_function_space_vector_function_space_differ(mesh): def test_indexed_function_space_index(fs): - assert [s.index for s in fs] == range(2) + assert [s.index for s in fs] == list(range(2)) # Create another mixed space in reverse order fs0, fs1 = fs.split() - assert [s.index for s in (fs1 * fs0)] == range(2) + assert [s.index for s in (fs1 * fs0)] == list(range(2)) # Verify the indices of the original IndexedFunctionSpaces haven't changed assert fs0.index == 0 and fs1.index == 1 From 5f8976a0832821b7013c34ea12630953517ff3e5 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 18:25:58 +0100 Subject: [PATCH 17/62] fix multigrid --- firedrake/mg/impl.pyx | 2 +- firedrake/mg/utils.py | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/firedrake/mg/impl.pyx b/firedrake/mg/impl.pyx index a5b1d48eb8..0619c97161 100644 --- a/firedrake/mg/impl.pyx +++ b/firedrake/mg/impl.pyx @@ -468,7 +468,7 @@ def create_cell_node_map(coarse, fine, np.ndarray[PetscInt, ndim=2, mode="c"] c2 fiat_element = create_element(coarse.ufl_element(), vector_is_mixed=False) perms = utils.get_node_permutations(fiat_element) - permutations = np.empty((len(perms), len(perms.values()[0])), dtype=np.int32) + permutations = np.empty((len(perms), len(next(iter(perms.values())))), dtype=np.int32) for k, v in perms.iteritems(): if tdim == 1: permutations[k[0], :] = v[:] diff --git a/firedrake/mg/utils.py b/firedrake/mg/utils.py index 90a1adaa80..5244d99622 100644 --- a/firedrake/mg/utils.py +++ b/firedrake/mg/utils.py @@ -195,7 +195,7 @@ def apply_transform(T, v): for node in functionals: pt = node.get_point_dict() assert len(pt.keys()) == 1 - nodes.append(np.asarray(pt.keys()[0], dtype=float)) + nodes.append(np.asarray(next(iter(pt.keys())), dtype=float)) for perm, transform in iteritems(transforms): p = -np.ones(len(functionals), dtype=PETSc.IntType) new_nodes = [apply_transform(transform, node) for node in nodes] @@ -281,7 +281,7 @@ def restriction_weights(fiat_element): Returns a 2D array of weights where weights[i, j] is the weighting of the ith fine cell basis function to the jth coarse cell basis function""" # Node points on coarse cell - points = np.asarray([node.get_point_dict().keys()[0] for node in fiat_element.dual_basis()]) + points = np.asarray([next(iter(node.get_point_dict().keys())) for node in fiat_element.dual_basis()]) # Create node points on fine cells @@ -291,7 +291,7 @@ def restriction_weights(fiat_element): for T in transforms: pts = np.concatenate([np.dot(T[0], pt) + np.asarray(T[1]) for pt in points]).reshape(-1, points.shape[1]) tabulation = fiat_element.tabulate(0, pts) - keys = tabulation.keys() + keys = list(tabulation.keys()) if len(keys) != 1: raise RuntimeError("Expected 1 key, found %d", len(keys)) vals = tabulation[keys[0]] @@ -313,7 +313,7 @@ def injection_weights(fiat_element): components on the coarse grid. unique_indices is an array of the unique values in the concatenated array""" - points = np.asarray([node.get_point_dict().keys()[0] for node in fiat_element.dual_basis()]) + points = np.asarray([next(iter(node.get_point_dict().keys())) for node in fiat_element.dual_basis()]) # Create node points on fine cells @@ -323,7 +323,7 @@ def injection_weights(fiat_element): for T in transforms: pts = np.concatenate([np.dot(T[0], pt) + np.asarray(T[1]) for pt in points]).reshape(-1, points.shape[1]) tabulation = fiat_element.tabulate(0, pts) - keys = tabulation.keys() + keys = list(tabulation.keys()) if len(keys) != 1: raise RuntimeError("Expected 1 key, found %d", len(keys)) vals = np.where(np.isclose(tabulation[keys[0]], 1.0), 1.0, 0.0) From 91c8fc1dba3fceb16543f9d8ba2d2a9fcc2a2abd Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 18:26:11 +0100 Subject: [PATCH 18/62] fix test cases --- tests/regression/test_solvers_options_prefix.py | 2 +- tests/regression/test_subdomain_integrals.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/regression/test_solvers_options_prefix.py b/tests/regression/test_solvers_options_prefix.py index 862f8d0edd..70c664926e 100644 --- a/tests/regression/test_solvers_options_prefix.py +++ b/tests/regression/test_solvers_options_prefix.py @@ -22,7 +22,7 @@ def opts(request, prefix, global_parameters): if prefix is None: prefix = "" - for k, v in global_parameters.iteritems(): + for k, v in global_parameters.items(): opts[prefix + k] = v # Pretend these came from the commandline diff --git a/tests/regression/test_subdomain_integrals.py b/tests/regression/test_subdomain_integrals.py index 0e503adfaf..6a1f052d9d 100644 --- a/tests/regression/test_subdomain_integrals.py +++ b/tests/regression/test_subdomain_integrals.py @@ -72,7 +72,7 @@ def test_cell_facet_subdomains(square, forms): V = FunctionSpace(square, "CG", 1) v = TestFunction(V) # noqa u = TrialFunction(V) # noqa - forms = map(eval, forms) + forms = list(map(eval, forms)) full = reduce(add, forms) full_mat = assemble(full).M.values part_mat = reduce(add, map(lambda x: assemble(x).M.values, forms)) From da609d6c75bc4729e0ea15965087e1c910b2d744 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 18:28:37 +0100 Subject: [PATCH 19/62] changing dict during iteration --- firedrake/functionspaceimpl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firedrake/functionspaceimpl.py b/firedrake/functionspaceimpl.py index e2a19c253c..150ca930a9 100644 --- a/firedrake/functionspaceimpl.py +++ b/firedrake/functionspaceimpl.py @@ -102,7 +102,7 @@ def max_work_functions(self, val): from firedrake.functionspacedata import get_work_function_cache, set_max_work_functions cache = get_work_function_cache(self.mesh(), self.ufl_element()) if val < len(cache): - for k in cache.keys(): + for k in list(cache.keys()): if not cache[k]: del cache[k] if val < len(cache): From 825c0e3011595550059b7a99dbda496ccad2fcba Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 18:42:32 +0100 Subject: [PATCH 20/62] fix pvd output --- firedrake/output.py | 94 ++++++++++++++++++++++----------------------- 1 file changed, 47 insertions(+), 47 deletions(-) diff --git a/firedrake/output.py b/firedrake/output.py index c437c6742c..35bee8fd3b 100644 --- a/firedrake/output.py +++ b/firedrake/output.py @@ -176,15 +176,15 @@ def write_array_descriptor(f, ofunction, offset=None, parallel=False): numpy.dtype("int64"): "Int64", numpy.dtype("uint8"): "UInt8"}[array.dtype] if parallel: - f.write('' % (name, typ, ncmp)) + f.write(('' % (name, typ, ncmp)).encode('ascii')) else: if offset is None: raise ValueError("Must provide offset") - f.write('\n' % (name, typ, ncmp, offset)) + f.write(('\n' % (name, typ, ncmp, offset)).encode('ascii')) return 4 + array.nbytes # 4 is for the array size (uint32) @@ -225,12 +225,12 @@ def get_array(function): class File(object): - _header = ('\n' - '\n' - '\n') - _footer = ('\n' - '\n') + _header = (b'\n' + b'\n' + b'\n') + _footer = (b'\n' + b'\n') def __init__(self, filename, project_output=False, comm=None, restart=0): """Create an object for outputting data for visualisation. @@ -414,46 +414,46 @@ def _write_single_vtu(self, basename, with open(fname, "wb") as f: # Running offset for appended data offset = 0 - f.write('\n') - f.write('\n') - f.write('\n') - - f.write('\n' % (num_points, num_cells)) - f.write('\n') + f.write(b'\n') + f.write(b'\n') + f.write(b'\n') + + f.write(('\n' % (num_points, num_cells)).encode('ascii')) + f.write(b'\n') # Vertex coordinates offset += write_array_descriptor(f, coordinates, offset=offset) - f.write('\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') offset += write_array_descriptor(f, connectivity, offset=offset) offset += write_array_descriptor(f, offsets, offset=offset) offset += write_array_descriptor(f, types, offset=offset) - f.write('\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') for function in functions: offset += write_array_descriptor(f, function, offset=offset) - f.write('\n') + f.write(b'\n') - f.write('\n') - f.write('\n') + f.write(b'\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') # Appended data must start with "_", separating whitespace # from data - f.write('_') + f.write(b'_') write_array(f, coordinates) write_array(f, connectivity) write_array(f, offsets) write_array(f, types) for function in functions: write_array(f, function) - f.write('\n\n') + f.write(b'\n\n') - f.write('\n') + f.write(b'\n') return fname def _write_single_pvtu(self, basename, @@ -462,36 +462,36 @@ def _write_single_pvtu(self, basename, connectivity, offsets, types = self._topology fname = get_pvtu_name(basename) with open(fname, "wb") as f: - f.write('\n') - f.write('\n') - f.write('\n') + f.write(b'\n') + f.write(b'\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') # Vertex coordinates write_array_descriptor(f, coordinates, parallel=True) - f.write('\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') write_array_descriptor(f, connectivity, parallel=True) write_array_descriptor(f, offsets, parallel=True) write_array_descriptor(f, types, parallel=True) - f.write('\n') + f.write(b'\n') - f.write('\n') + f.write(b'\n') for function in functions: write_array_descriptor(f, function, parallel=True) - f.write('\n') + f.write(b'\n') size = self.comm.size for rank in range(size): # need a relative path so files can be moved around: vtu_name = os.path.relpath(get_vtu_name(basename, rank, size), os.path.dirname(self.basename)) - f.write('\n' % vtu_name) + f.write(('\n' % vtu_name).encode('ascii')) - f.write('\n') - f.write('\n') + f.write(b'\n') + f.write(b'\n') return fname def write(self, *functions, **kwargs): @@ -517,8 +517,8 @@ def write(self, *functions, **kwargs): # Seek backwards from end to beginning of footer f.seek(-len(self._footer), 2) # Write new dataset name - f.write('\n' % (time, vtu)) + f.write(('\n' % (time, vtu)).encode('ascii')) # And add footer again, so that the file is valid f.write(self._footer) From 70ab6a7f19a4195610f71969bcbe4f1151568dc9 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 18:46:57 +0100 Subject: [PATCH 21/62] fix int >= None in slate --- firedrake/slate/slac/compiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firedrake/slate/slac/compiler.py b/firedrake/slate/slac/compiler.py index ff541ad410..62fb83aedd 100644 --- a/firedrake/slate/slac/compiler.py +++ b/firedrake/slate/slac/compiler.py @@ -590,7 +590,7 @@ def auxiliary_temporaries(builder, declared_temps): def parenthesize(arg, prec=None, parent=None): """Parenthesizes an expression.""" - if prec is None or prec >= parent: + if prec is None or parent is None or prec >= parent: return arg return "(%s)" % arg From 67bdd1f1737a6da6af9c0047a156173f10457f1a Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 19:09:58 +0100 Subject: [PATCH 22/62] fix pylit --- pylit/pylit.py | 54 +++++++++++++++++++++++++------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/pylit/pylit.py b/pylit/pylit.py index 615fd32eca..203c09ce05 100755 --- a/pylit/pylit.py +++ b/pylit/pylit.py @@ -134,7 +134,7 @@ # # :: -import __builtin__, os, sys +import builtins, os, sys import re, optparse @@ -841,8 +841,8 @@ def code_block_handler(self, block): for line in block: if line.lstrip() and self.get_indent(line) < self._codeindent: - raise ValueError, "code block contains line less indented " \ - "than %d spaces \n%r"%(self._codeindent, block) + raise ValueError("code block contains line less indented " \ + "than %d spaces \n%r"%(self._codeindent, block)) yield line.replace(" "*self._codeindent, "", 1) @@ -906,7 +906,7 @@ def header_handler(self, lines): # get iterator over the lines that formats them as code-block lines = iter(self.code_block_handler(lines)) # prepend header string to first line - yield self.header_string + lines.next() + yield self.header_string + next(lines) # yield remaining lines for line in lines: yield line @@ -1249,7 +1249,7 @@ def complete(self, **keyw): have a corresponding attribute in `self`, """ for key in keyw: - if not self.__dict__.has_key(key): + if key not in self.__dict__: setattr(self, key, keyw[key]) # .. _OptionValues.__getattr__: @@ -1298,7 +1298,7 @@ def __init__(self): p.add_option("-t", "--txt2code", action="store_true", help="convert text source to code source") p.add_option("--language", - choices = defaults.languages.values(), + choices = list(defaults.languages.values()), help="use LANGUAGE native comment style") p.add_option("--comment-string", dest="comment_string", help="documentation block marker in code source " @@ -1390,7 +1390,7 @@ def complete_values(self, values): in_extension = os.path.splitext(values.infile)[1] if in_extension in values.text_extensions: values.txt2code = True - elif in_extension in values.languages.keys(): + elif in_extension in list(values.languages.keys()): values.txt2code = False # Auto-determine the output file name:: @@ -1439,7 +1439,7 @@ def _get_outfile_name(self, values): (base, ext) = os.path.splitext(values.infile) if ext in values.text_extensions: return base # strip - if ext in values.languages.keys() or values.txt2code == False: + if ext in list(values.languages.keys()) or values.txt2code == False: return values.infile + values.text_extensions[0] # add # give up return values.infile + ".out" @@ -1478,8 +1478,8 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw): open_streams(infile, outfile) -> (in_stream, out_stream) - in_stream -- file(infile) or sys.stdin - out_stream -- file(outfile) or sys.stdout + in_stream -- open(infile) or sys.stdin + out_stream -- open(outfile) or sys.stdout overwrite -- 'yes': overwrite eventually existing `outfile`, 'update': fail if the `outfile` is newer than `infile`, 'no': fail if `outfile` exists. @@ -1488,19 +1488,19 @@ def open_streams(infile = '-', outfile = '-', overwrite='update', **keyw): """ if not infile: strerror = "Missing input file name ('-' for stdin; -h for help)" - raise IOError, (2, strerror, infile) + raise IOError(2, strerror, infile) if infile == '-': in_stream = sys.stdin else: - in_stream = file(infile, 'r') + in_stream = open(infile, 'r') if outfile == '-': out_stream = sys.stdout elif overwrite == 'no' and os.path.exists(outfile): - raise IOError, (1, "Output file exists!", outfile) + raise IOError(1, "Output file exists!", outfile) elif overwrite == 'update' and is_newer(outfile, infile): - raise IOError, (1, "Output file is newer than input file!", outfile) + raise IOError(1, "Output file is newer than input file!", outfile) else: - out_stream = file(outfile, 'w') + out_stream = open(outfile, 'w') return (in_stream, out_stream) # is_newer @@ -1598,7 +1598,7 @@ def run_doctest(infile="-", txt2code=True, runner.summarize # give feedback also if no failures occurred if not runner.failures: - print "%d failures in %d tests"%(runner.failures, runner.tries) + print("%d failures in %d tests"%(runner.failures, runner.tries)) return runner.failures, runner.tries @@ -1616,7 +1616,7 @@ def diff(infile='-', outfile='-', txt2code=True, **keyw): import difflib - instream = file(infile) + instream = open(infile) # for diffing, we need a copy of the data as list:: data = instream.readlines() # convert @@ -1624,7 +1624,7 @@ def diff(infile='-', outfile='-', txt2code=True, **keyw): new = converter() if outfile != '-' and os.path.exists(outfile): - outstream = file(outfile) + outstream = open(outfile) old = outstream.readlines() oldname = outfile newname = ""%infile @@ -1645,11 +1645,11 @@ def diff(infile='-', outfile='-', txt2code=True, **keyw): fromfile=oldname, tofile=newname) for line in delta: is_different = True - print line, + print(line, end=' ') if not is_different: - print oldname - print newname - print "no differences found" + print(oldname) + print(newname) + print("no differences found") return is_different @@ -1664,11 +1664,11 @@ def execute(infile="-", txt2code=True, **keyw): """Execute the input file. Convert first, if it is a text source. """ - data = file(infile) + data = open(infile) if txt2code: data = str(Text2Code(data, **keyw)) # print "executing " + options.infile - exec data + exec(data) # main @@ -1716,8 +1716,8 @@ def main(args=sys.argv[1:], **defaults): try: (data, out_stream) = open_streams(**options.as_dict()) - except IOError, ex: - print "IOError: %s %s" % (ex.filename, ex.strerror) + except IOError as ex: + print("IOError: %s %s" % (ex.filename, ex.strerror)) sys.exit(ex.errno) # Get a converter instance:: @@ -1729,7 +1729,7 @@ def main(args=sys.argv[1:], **defaults): out_stream.write(str(converter)) if out_stream is not sys.stdout: - print "extract written to", out_stream.name + print("extract written to", out_stream.name) out_stream.close() # If input and output are from files, set the modification time (`mtime`) of From d83fb2f8d0f0673aa5604c5de65af2208d882313 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 19:19:25 +0100 Subject: [PATCH 23/62] update print statement in demos --- demos/DG_advection/DG_advection.py.rst | 4 ++-- demos/benney_luke/benney_luke.py.rst | 2 +- demos/camassa-holm/camassaholm.py.rst | 2 +- .../qgbasinmodes.py.rst | 2 +- .../test_extrusion_lsw.py | 6 ++--- demos/helmholtz/helmholtz.py.rst | 2 +- demos/multigrid/geometric_multigrid.py.rst | 6 ++--- .../qg_1layer_wave.py.rst | 2 +- .../saddle_point_systems.py.rst | 24 +++++++++---------- 9 files changed, 25 insertions(+), 25 deletions(-) diff --git a/demos/DG_advection/DG_advection.py.rst b/demos/DG_advection/DG_advection.py.rst index 70b6ca471c..daf981fcf1 100644 --- a/demos/DG_advection/DG_advection.py.rst +++ b/demos/DG_advection/DG_advection.py.rst @@ -264,14 +264,14 @@ terminal. :: if step % 20 == 0: outfile.write(q) - print "t=", t + print("t=", t) Finally, we display the normalised :math:`L^2` error, by comparing to the initial condition. :: L2_err = sqrt(assemble((q - q_init)*(q - q_init)*dx)) L2_init = sqrt(assemble(q_init*q_init*dx)) - print L2_err/L2_init + print(L2_err/L2_init) This demo can be found as a script in `DG_advection.py `__. diff --git a/demos/benney_luke/benney_luke.py.rst b/demos/benney_luke/benney_luke.py.rst index fd90afd2da..609cd43682 100644 --- a/demos/benney_luke/benney_luke.py.rst +++ b/demos/benney_luke/benney_luke.py.rst @@ -189,7 +189,7 @@ from piecewise quadratic functions to piecewise linears:: We are now ready to enter the main time iteration loop:: while t < T: - print t, abs((E-E0)/E0) + print(t, abs((E-E0)/E0)) t += dt t_.assign(t) diff --git a/demos/camassa-holm/camassaholm.py.rst b/demos/camassa-holm/camassaholm.py.rst index d860447aa8..43ea94a0a7 100644 --- a/demos/camassa-holm/camassaholm.py.rst +++ b/demos/camassa-holm/camassaholm.py.rst @@ -191,7 +191,7 @@ The energy can be computed and checked. :: # E = assemble((u0*u0 + alphasq*u0.dx(0)*u0.dx(0))*dx) - print "t = ", t, "E = ", E + print("t = ", t, "E = ", E) To implement the timestepping algorithm, we just call the solver, and assign ``w1`` to ``w0``. :: diff --git a/demos/eigenvalues_QG_basinmodes/qgbasinmodes.py.rst b/demos/eigenvalues_QG_basinmodes/qgbasinmodes.py.rst index c7c2ead57f..c7a50954ea 100644 --- a/demos/eigenvalues_QG_basinmodes/qgbasinmodes.py.rst +++ b/demos/eigenvalues_QG_basinmodes/qgbasinmodes.py.rst @@ -219,7 +219,7 @@ and we gather the final eigenfunctions :: We can now list and show plots for the eigenvalues and eigenfunctions that were found. :: - print "Leading eigenvalue is:", lam + print("Leading eigenvalue is:", lam) try: from matplotlib import pyplot diff --git a/demos/extruded_shallow_water/test_extrusion_lsw.py b/demos/extruded_shallow_water/test_extrusion_lsw.py index 41b928de28..25389651fd 100644 --- a/demos/extruded_shallow_water/test_extrusion_lsw.py +++ b/demos/extruded_shallow_water/test_extrusion_lsw.py @@ -73,8 +73,8 @@ p_test = TestFunction(Xplot) solve(p_trial * p_test * dx == p_0 * p_test * dx, p_plot) file << p_plot, t - print t + print(t) E_1 = assemble(0.5 * p_0 * p_0 * dx + 0.5 * dot(u_0, u_0) * dx) -print 'Initial energy', E_0 -print 'Final energy', E_1 +print('Initial energy', E_0) +print('Final energy', E_1) diff --git a/demos/helmholtz/helmholtz.py.rst b/demos/helmholtz/helmholtz.py.rst index 29bfecb50e..f89cd4435f 100644 --- a/demos/helmholtz/helmholtz.py.rst +++ b/demos/helmholtz/helmholtz.py.rst @@ -129,6 +129,6 @@ Alternatively, since we have an analytic solution, we can check the :math:`L_2` norm of the error in the solution:: f.interpolate(cos(x*pi*2)*cos(y*pi*2)) - print sqrt(assemble(dot(u - f, u - f) * dx)) + print(sqrt(assemble(dot(u - f, u - f) * dx))) A python script version of this demo can be found `here `__. diff --git a/demos/multigrid/geometric_multigrid.py.rst b/demos/multigrid/geometric_multigrid.py.rst index 3a26b0988a..38f40c0edb 100644 --- a/demos/multigrid/geometric_multigrid.py.rst +++ b/demos/multigrid/geometric_multigrid.py.rst @@ -91,7 +91,7 @@ Let's start with our first test. We'll confirm a working solve by using a direct method. :: u = run_solve({"ksp_type": "preonly", "pc_type": "lu"}) - print 'LU solve error', error(u) + print('LU solve error', error(u)) Next we'll use the conjugate gradient method preconditioned by a geometric multigrid V-cycle. Firedrake automatically takes care of @@ -99,7 +99,7 @@ rediscretising the operator on coarse grids, and providing the number of levels to PETSc. :: u = run_solve({"ksp_type": "cg", "pc_type": "mg"}) - print 'MG V-cycle + CG error', error(u) + print('MG V-cycle + CG error', error(u)) For such a simple problem, an appropriately configured multigrid solve can achieve algebraic error equal to discretisation error in one @@ -119,7 +119,7 @@ appropriate settings using solver parameters. :: } u = run_solve(parameters) - print 'MG F-cycle error', error(u) + print('MG F-cycle error', error(u)) A saddle-point system: The Stokes equations ------------------------------------------- diff --git a/demos/quasigeostrophy_1layer/qg_1layer_wave.py.rst b/demos/quasigeostrophy_1layer/qg_1layer_wave.py.rst index 25138f82ff..2646f3d439 100644 --- a/demos/quasigeostrophy_1layer/qg_1layer_wave.py.rst +++ b/demos/quasigeostrophy_1layer/qg_1layer_wave.py.rst @@ -246,7 +246,7 @@ execute the time loop. :: # Store solutions to xml and pvd t += Dt - print t + print(t) tdump += 1 if tdump == dumpfreq: diff --git a/demos/saddle_point_pc/saddle_point_systems.py.rst b/demos/saddle_point_pc/saddle_point_systems.py.rst index bcec2d82c6..5eb5f76c0f 100644 --- a/demos/saddle_point_pc/saddle_point_systems.py.rst +++ b/demos/saddle_point_pc/saddle_point_systems.py.rst @@ -189,7 +189,7 @@ and precondition with ILU(0). :: We now loop over a range of mesh sizes, assembling the system and solving it :: - print "Naive preconditioning" + print("Naive preconditioning") for n in range(8): solver, w, b = build_problem(n, parameters, block_matrix=False) solver.solve(w, b) @@ -198,7 +198,7 @@ Finally, at each mesh size, we print out the number of cells in the mesh and the number of iterations the solver took to converge :: # - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) The resulting convergence is unimpressive: @@ -296,11 +296,11 @@ inverting :math:`A` and :math:`S` to check the convergence. :: Let's go ahead and run this. Note that for this problem, we're applying the action of blocks, so we can use a block matrix format. :: - print "Exact full Schur complement" + print("Exact full Schur complement") for n in range(8): solver, w, b = build_problem(n, parameters, block_matrix=True) solver.solve(w, b) - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) The resulting convergence is algorithmically good, however, the larger problems still take a long time. @@ -381,11 +381,11 @@ algebraic multigrid from the hypre suite. :: Let's see what happens. :: - print "Schur complement with S_p" + print("Schur complement with S_p") for n in range(8): solver, w, b = build_problem(n, parameters, block_matrix=True) solver.solve(w, b) - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) This is much better, the problem takes much less time to solve and when observing the iteration counts for inverting :math:`S` we can see @@ -436,11 +436,11 @@ this, we use the following set of parameters. :: Note how we can switch back to GMRES here, our inner solves are linear and so we no longer need a flexible Krylov method. :: - print "Schur complement with S_p and inexact inner inverses" + print("Schur complement with S_p and inexact inner inverses") for n in range(8): solver, w, b = build_problem(n, parameters, block_matrix=True) solver.solve(w, b) - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) This results in the following GMRES iteration counts @@ -512,11 +512,11 @@ function to pass as the ``aP`` argument. :: Now we just need to pass this extra argument to the ``build_problem`` function :: - print "DG approximation for S_p" + print("DG approximation for S_p") for n in range(8): solver, w, b = build_problem(n, parameters, aP=dg_laplacian, block_matrix=True) solver.solve(w, b) - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) This actually results in slightly worse convergence than the diagonal approximation we used above. @@ -597,11 +597,11 @@ option up to a few tens of thousands of degrees of freedom. :: Let's see what the iteration count looks like now. :: - print "Riesz-map preconditioner" + print("Riesz-map preconditioner") for n in range(8): solver, w, b = build_problem(n, parameters, aP=riesz, block_matrix=True) solver.solve(w, b) - print w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber() + print(w.function_space().mesh().num_cells(), solver.ksp.getIterationNumber()) ============== ================== Mesh elements GMRES iterations From 41b02872c87033234f175bca5c93be834523b152 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Mon, 24 Jul 2017 19:23:03 +0100 Subject: [PATCH 24/62] tiny plot fix --- firedrake/plot.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/firedrake/plot.py b/firedrake/plot.py index d07064cdea..1c5b805424 100644 --- a/firedrake/plot.py +++ b/firedrake/plot.py @@ -539,7 +539,7 @@ def _bezier_calculate_points(function): basis = fiat_element.dual_basis() for i in range(deg + 1): for j in range(deg + 1): - M[i, j] = _bernstein(basis[j].get_point_dict().keys()[0][0], + M[i, j] = _bernstein(list(basis[j].get_point_dict().keys())[0][0], i, deg) M_inv = np.linalg.inv(M) cell_node_list = function.function_space().cell_node_list From e56fea5b424bb3befa5affef648ad2e427b391e0 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Tue, 25 Jul 2017 12:19:19 +0100 Subject: [PATCH 25/62] No longer need glpk --- scripts/firedrake-install | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 83ecdec879..8be8f1681f 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -642,23 +642,6 @@ def build_and_install_h5py(): log.info("No need to rebuild h5py") -def build_and_install_glpsol(): - log.info("Installing GLPK") - if os.path.exists("glpk"): - glpk_changed = git_update("glpk") - else: - git_clone("git+https://github.com/firedrakeproject/glpk.git") - glpk_changed = True - - if glpk_changed: - with directory("glpk"): - check_call(["./configure", "--disable-shared", "--disable-static"]) - check_call(["make"]) - check_call(["cp", "examples/glpsol", os.environ["VIRTUAL_ENV"] + "/bin/"]) - else: - log.info("No need to rebuild glpk") - - def build_and_install_libspatialindex(): log.info("Installing libspatialindex") if os.path.exists("libspatialindex"): @@ -981,7 +964,6 @@ if mode == "install": pip_requirements(p) build_and_install_h5py() - build_and_install_glpsol() build_and_install_libspatialindex() pipinstall.append("--no-deps") for p in packages: @@ -1068,7 +1050,6 @@ else: # Always rebuild h5py. build_and_install_h5py() - build_and_install_glpsol() build_and_install_libspatialindex() try: From 800d97f02e3577c0914535cfe3f334793b22a2c1 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Tue, 25 Jul 2017 16:40:22 +0100 Subject: [PATCH 26/62] Reinstate rebuild-script and fix firedrake-update --- scripts/firedrake-install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 8be8f1681f..f3c3e39917 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -166,6 +166,8 @@ else: help="Do not update script before updating Firedrake.") parser.add_argument("--rebuild", action="store_true", help="Rebuild all packages even if no new version is available. Usually petsc and petsc4py are only rebuilt if they change. All other packages are always rebuilt.") + parser.add_argument("--rebuild-script", "--rebuild_script", action="store_true", + help="Only rebuild the firedrake-install script. Use this option if your firedrake-install script is broken and a fix has been released in upstream Firedrake. You will need to specify any other options which you wish to be honoured by your new update script.") parser.add_argument("--adjoint", action='store_true', dest="adjoint", default=config["options"]["adjoint"], help="Also install firedrake-adjoint.") parser.add_argument("--slope", action='store_true', dest="slope", default=config["options"]["slope"], @@ -274,7 +276,7 @@ if mode == "install": else: # venv is the directory above the update script. Strictly, it # doesn't need to be active. - firedrake_env = os.path.realpath(__file__) + "/../" + firedrake_env = os.path.dirname(os.path.realpath(__file__)) + "/../" # venv install python = ["%s/bin/python" % firedrake_env] From 339fe8d32ecbcf0fc00bb7eb98d729789cbe80ec Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Tue, 25 Jul 2017 16:52:33 +0100 Subject: [PATCH 27/62] remove underscore options --- scripts/firedrake-install | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index f3c3e39917..f789205160 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -112,24 +112,24 @@ honoured.""", help="Also install SLOPE. This enables loop tiling in PyOP2.") parser.add_argument("--slepc", action="store_true", help="Install SLEPc along with PETSc.") - parser.add_argument("--disable-ssh", "--disable_ssh", action="store_true", + parser.add_argument("--disable-ssh", action="store_true", help="Do not attempt to use ssh to clone git repositories: fall immediately back to https.") - parser.add_argument("--no-package-manager", "--no_package_manager", action='store_false', dest="package_manager", + parser.add_argument("--no-package-manager", action='store_false', dest="package_manager", help="Do not attempt to use apt or homebrew to install operating system packages on which we depend.") - parser.add_argument("--minimal-petsc", "--minimal_petsc", action="store_true", + parser.add_argument("--minimal-petsc", action="store_true", help="Minimise the set of petsc dependencies installed. This creates faster build times (useful for build testing).") group = parser.add_mutually_exclusive_group() - group.add_argument("--honour-petsc-dir", "--honour_petsc_dir", action="store_true", + group.add_argument("--honour-petsc-dir", action="store_true", help="Usually it is best to let Firedrake build its own PETSc. If you wish to use another PETSc, set PETSC_DIR and pass this option.") group.add_argument("--petsc-int-type", choices=["int32", "int64"], default="int32", type=str, help="The integer type used by PETSc. Use int64 if you need to solve problems with more than 2 billion degrees of freedom. Only takes effect if firedrake-install builds PETSc.") - parser.add_argument("--honour-pythonpath", "--honour_pythonpath", action="store_true", + parser.add_argument("--honour-pythonpath", action="store_true", help="Pointing to external Python packages is usually a user error. Set this option if you know that you want PYTHONPATH set.") - parser.add_argument("--rebuild-script", "--rebuild_script", action="store_true", + parser.add_argument("--rebuild-script", action="store_true", help="Only rebuild the firedrake-install script. Use this option if your firedrake-install script is broken and a fix has been released in upstream Firedrake. You will need to specify any other options which you wish to be honoured by your new update script.") - parser.add_argument("--package-branch", "--package_branch", type=str, nargs=2, action="append", metavar=("PACKAGE", "BRANCH"), + parser.add_argument("--package-branch", type=str, nargs=2, action="append", metavar=("PACKAGE", "BRANCH"), help="Specify which branch of a package to use. This takes two arguments, the package name and the branch.") parser.add_argument("--verbose", "-v", action="store_true", help="Produce more verbose debugging output.") parser.add_argument("--mpicc", type=str, @@ -166,7 +166,7 @@ else: help="Do not update script before updating Firedrake.") parser.add_argument("--rebuild", action="store_true", help="Rebuild all packages even if no new version is available. Usually petsc and petsc4py are only rebuilt if they change. All other packages are always rebuilt.") - parser.add_argument("--rebuild-script", "--rebuild_script", action="store_true", + parser.add_argument("--rebuild-script", action="store_true", help="Only rebuild the firedrake-install script. Use this option if your firedrake-install script is broken and a fix has been released in upstream Firedrake. You will need to specify any other options which you wish to be honoured by your new update script.") parser.add_argument("--adjoint", action='store_true', dest="adjoint", default=config["options"]["adjoint"], help="Also install firedrake-adjoint.") @@ -175,13 +175,13 @@ else: parser.add_argument("--slepc", action="store_true", dest="slepc", default=config["options"]["slepc"], help="Install SLEPc along with PETSc") group = parser.add_mutually_exclusive_group() - group.add_argument("--honour-petsc-dir", "--honour_petsc_dir", action="store_true", + group.add_argument("--honour-petsc-dir", action="store_true", help="Usually it is best to let Firedrake build its own PETSc. If you wish to use another PETSc, set PETSC_DIR and pass this option.") group.add_argument("--petsc-int-type", choices=["int32", "int64"], default="int32", type=str, help="The integer type used by PETSc. Use int64 if you need to solve problems with more than 2 billion degrees of freedom. Only takes effect if firedrake-install builds PETSc.") - parser.add_argument("--honour-pythonpath", "--honour_pythonpath", action="store_true", default=config["options"].get("honour-pythonpath", False), + parser.add_argument("--honour-pythonpath", action="store_true", default=config["options"].get("honour-pythonpath", False), help="Pointing to external Python packages is usually a user error. Set this option if you know that you want PYTHONPATH set.") parser.add_argument("--clean", action='store_true', help="Delete any remnants of obsolete Firedrake components.") From ed761f82baf03f817df886ac75e84561617b2c73 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Tue, 25 Jul 2017 16:52:44 +0100 Subject: [PATCH 28/62] fix JSON option name --- scripts/firedrake-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index f789205160..8ca1f06897 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -181,7 +181,7 @@ else: default="int32", type=str, help="The integer type used by PETSc. Use int64 if you need to solve problems with more than 2 billion degrees of freedom. Only takes effect if firedrake-install builds PETSc.") - parser.add_argument("--honour-pythonpath", action="store_true", default=config["options"].get("honour-pythonpath", False), + parser.add_argument("--honour-pythonpath", action="store_true", default=config["options"].get("honour_pythonpath", False), help="Pointing to external Python packages is usually a user error. Set this option if you know that you want PYTHONPATH set.") parser.add_argument("--clean", action='store_true', help="Delete any remnants of obsolete Firedrake components.") From c8f595a927c96b84b88ea3af37dda2987cb2d7c2 Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Tue, 25 Jul 2017 16:57:24 +0100 Subject: [PATCH 29/62] attempt to update required Python packages --- scripts/firedrake-install | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 8ca1f06897..ce29426e39 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -858,7 +858,7 @@ if osname == "Darwin": # Ensure a fortran compiler is available brew_install("gcc") brew_install("openmpi") - brew_install("python") + brew_install("python3") brew_install("autoconf") brew_install("automake") brew_install("cmake") @@ -887,9 +887,10 @@ elif osname == "Linux": "libtool", "mercurial", "openmpi-bin", - "python-dev", - "python-pip", - "python-tk", + "python3-dev", + "python3-pip", + "python3-tk", + "python3-venv", "zlib1g-dev"] missing_packages = [p for p in apt_packages if not apt_check(p)] From b8ba241488136e4dd4b0e2631a7b2fbfebfb8f0d Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 12:08:57 +0100 Subject: [PATCH 30/62] Remove old CI control files --- .drone.yml | 91 ----------------------------------------------------- .travis.yml | 77 --------------------------------------------- 2 files changed, 168 deletions(-) delete mode 100644 .drone.yml delete mode 100644 .travis.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index 140e478fed..0000000000 --- a/.drone.yml +++ /dev/null @@ -1,91 +0,0 @@ -workspace: - base: /drone - path: src - -matrix: - PETSC_INT_TYPE: - - int32 - - int64 - -pipeline: - build: - image: ubuntu:xenial - pull: true - environment: - # Change the following to reflect your local preferences - - PACKAGE=firedrake - - FIREDRAKE_HOME=/drone/install - - FIREDRAKE_GID=1000 - - FIREDRAKE_UID=1000 - # Tell firedrake-install we're testing firedrake - - FIREDRAKE_CI_TESTS=1 - # Make the cloned source location available via environment - - GIT_SOURCE_DIR=/drone/src - commands: - # Bring the image up to date - - apt-get -y update - - apt-get -y dist-upgrade - - # Install dependencies for a single run of firedrake-install - - apt-get -y install sudo python-minimal python-pip - - # Fail fast on lint errors - - pip install -U flake8 flake8-future-import - - cd $GIT_SOURCE_DIR - - make lint - - pip install virtualenv - - # Make a firedrake user to run the tests - - mkdir $FIREDRAKE_HOME - - groupadd -g $FIREDRAKE_GID firedrake - - useradd -d $FIREDRAKE_HOME -u $FIREDRAKE_UID -g $FIREDRAKE_GID firedrake - - # Passwordless sudo: \072 is octal for : - # Colon breaks the drone yaml parser - - /bin/echo -e "firedrake ALL=NOPASSWD\072 ALL\n" >> /etc/sudoers - - # Install firedrake - - cd $FIREDRAKE_HOME - - PETSC_CONFIGURE_OPTIONS="--with-make-np=1" $GIT_SOURCE_DIR/scripts/firedrake-install --disable-ssh --minimal-petsc --slepc --adjoint --slope --install thetis --install gusto --petsc-int-type ${PETSC_INT_TYPE} - - # Activate the virtualenv - - . firedrake/bin/activate - # pylint --py3k - - pylint --py3k --disable=round-builtin firedrake - # scipy for the adjoint tests - - pip install scipy - - pip install pytest-cov - # We're going to run the tests as the firedrake user, so get permissions right. - - chown -R firedrake.firedrake $FIREDRAKE_HOME - - # Run tests as the firedrake user, pushing in the current path. - - cd firedrake/src/firedrake - - sudo -EHu firedrake env PATH="$PATH" py.test --cov firedrake -n 4 -v tests/ - # Create XML coverage report - - coverage xml -o /drone/src/coverage.xml - # Run the dolfin-adjoint tests - - cd ../dolfin-adjoint - - sudo -EHu firedrake env PATH="$PATH" py.test -v tests_firedrake/ - # Now run the notebook tests - - pip install jupyter - - pip install nbval>=0.5 - - cd ../firedrake/docs/notebooks - - sudo -EHu firedrake env PATH="$PATH" py.test -v --nbval --current-env . - # Codecov - codecov: - image: alpine:3.5 - pull: true - environment: - - CI_BUILD_URL=${DRONE_BUILD_LINK} - commands: - - apk add --no-cache curl bash git - - curl -s https://codecov.io/bash > codecov - - chmod 755 ./codecov - - ./codecov -X gcov -r "$DRONE_REPO" -B "$DRONE_BRANCH" -C "$DRONE_COMMIT" -b "$DRONE_BUILD_NUMBER" -P "$DRONE_PULL_REQUEST" -T "$DRONE_TAG" - # Slack notification - slack: - image: plugins/slack - channel: drone - user: drone - when: - status: [ success, failure ] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d64c4e90c4..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,77 +0,0 @@ -sudo: false -notifications: - slack: - secure: OvkwWFNZXlD9CkUZBMdhiMGERlHeImEcWpCUp0vk/Z8pS7iM3PjrWYF7iZtt1La6z9LrQXh15OhI1jn6VN8IzMeZmrJYv3cgAJiCUnRkOu2iQjW6MKsZNl9gccdxfUr7r5wrV3th+48d353T7W2WEd6ADJSeI5jKu37STwIjztM= - -# language: python -language: c -# We're not Python 2.6 compatible at the moment -# python: "2.7" -addons: - apt: - packages: - - build-essential - - python-dev - - git - - mercurial - - python-pip - - libopenmpi-dev - - openmpi-bin - - libblas-dev - - liblapack-dev - - gfortran - - gmsh - - python-tk -# Separate cache directories for OSX and Linux -cache: - directories: - - $HOME/cached_dependencies_$TRAVIS_OS_NAME -env: - global: - - CC=mpicc - # The install script expects to see this environment variable - - CACHE_DIRECTORY=$HOME/cached_dependencies_$TRAVIS_OS_NAME - - FIREDRAKE_CI_TESTS=1 - - PACKAGE_MANAGER="--no-package-manager" - - SLEPC="--slepc" -matrix: - include: - - os: osx - # Only test a few things on OSX until we can cache some of the - # build dependencies, otherwise we often get timeouts. - env: - TEST_FILES="tests/extrusion/test_facet_integrals_2D.py tests/extrusion/test_mixed_bcs.py tests/extrusion/test_steady_advection_2D_extr.py tests/multigrid/test_two_poisson_gmg.py tests/output tests/regression/test_facet_orientation.py tests/regression/test_matrix_free.py tests/regression/test_nested_fieldsplit_solves.py tests/regression/test_nullspace.py tests/regression/test_point_eval_api.py tests/regression/test_point_eval_cells.py tests/regression/test_point_eval_fs.py tests/regression/test_solving_interface.py tests/regression/test_steady_advection_2D.py" - TEST_ADJOINT="TRUE" - PACKAGE_MANAGER="" - SLEPC="" -before_install: - - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then brew update; brew install python; brew link --overwrite python ; fi - - pip install -U --user pip - - pip install -U --user virtualenv - # Fail fast on lint errors - - pip install -U --user flake8 flake8-future-import - - if [[ $TRAVIS_OS_NAME == 'osx' ]]; then export PATH=$PATH:$HOME/Library/Python/2.7/bin; fi - - make lint -install: - - export CC=mpicc - - mkdir tmp - - cd tmp - - ../scripts/firedrake-install --disable-ssh --minimal-petsc ${SLEPC} --adjoint --slope --install thetis --install gusto ${PACKAGE_MANAGER} - - . ./firedrake/bin/activate - # Test that running firedrake-update works - - firedrake-update - # Having activated the virtualenv, attempt to save cached dependencies - # This saves PETSc and petsc4py to speed up building - - (cd firedrake; ../../scripts/firedrake-install --write-cache) - - if [ "x$TEST_ADJOINT" != "x" ]; then pip install scipy; fi - # For code coverage - - pip install pytest-cov -# command to run tests -script: - - cd firedrake/src - - (cd firedrake; make lint) - - pylint --py3k --disable=round-builtin firedrake - - (cd firedrake; py.test --cov firedrake --short -v ${TEST_FILES}) - - if [ "x$TEST_ADJOINT" != "x" ]; then (cd dolfin-adjoint; py.test -v tests_firedrake); fi -after_success: - - (cd firedrake; bash <(curl -s https://codecov.io/bash)) From be241c9f8522ad696526fb1cf9723de02d09ee8c Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 12:22:16 +0100 Subject: [PATCH 31/62] install: Workaround debian ensurepip issue --- scripts/firedrake-install | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index ce29426e39..8909d841e4 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -921,8 +921,24 @@ if mode == "install": quit("Can't install into existing venv '%s'" % firedrake_env) log.info("Creating firedrake venv in '%s'." % firedrake_env) + # Debian's Python3 is screwed, they don't ship ensurepip as part + # of the base python package, so the default python -m venv + # doesn't work. Moreover, they have spiked the file such that it + # calls sys.exit, which will kill any attempts to create a venv + # with pip. + try: + import ensurepip # noqa: F401 + with_pip = True + except ImportError: + with_pip = False import venv - venv.EnvBuilder(with_pip=True).create(firedrake_env) + venv.EnvBuilder(with_pip=with_pip).create(firedrake_env) + if not with_pip: + import urllib.request + log.debug("ensurepip unavailable, bootstrapping pip using get-pip.py") + urllib.request.urlretrieve("https://bootstrap.pypa.io/get-pip.py", filename="get-pip.py") + check_call(python + ["get-pip.py"]) + log.debug("bootstrapping pip succeeded") # Ensure pip and setuptools are at the latest version. run_pip(["install", "-U", "setuptools"]) run_pip(["install", "-U", "pip"]) From d2d2986f2140fb95e3bfd7ddc1c3b5cb2e0a1dda Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 14:05:18 +0100 Subject: [PATCH 32/62] jenkins: Remove unnecessary env var --- Jenkinsfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 14a3ee42c3..0671a71401 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -3,7 +3,6 @@ pipeline { label 'linux' } environment { - TEST_FILES = "tests/extrusion/test_facet_integrals_2D.py tests/extrusion/test_mixed_bcs.py tests/extrusion/test_steady_advection_2D_extr.py tests/multigrid/test_two_poisson_gmg.py tests/output tests/regression/test_facet_orientation.py tests/regression/test_matrix_free.py tests/regression/test_nested_fieldsplit_solves.py tests/regression/test_nullspace.py tests/regression/test_point_eval_api.py tests/regression/test_point_eval_cells.py tests/regression/test_point_eval_fs.py tests/regression/test_solving_interface.py tests/regression/test_steady_advection_2D.py" PATH = "/usr/local/bin:/usr/bin:/bin" CC = "mpicc" FIREDRAKE_CI_TESTS = "1" From 0aa80bcdabf478e85fece4ae03a7e708c8d7a7d8 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 14:06:12 +0100 Subject: [PATCH 33/62] jenkins: Temporary workaround for pytest-dev/pytest#920 Fixture collection is not deterministic in the presence of hash randomisation, so seed the hash so that we can run tests in parallel. --- Jenkinsfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Jenkinsfile b/Jenkinsfile index 0671a71401..3cbcd0483e 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -6,6 +6,7 @@ pipeline { PATH = "/usr/local/bin:/usr/bin:/bin" CC = "mpicc" FIREDRAKE_CI_TESTS = "1" + PYTHONHASHSEED = "12453221" } stages { stage('Clean') { From d3c2476b6ea82a387ad23a84ec107fc30295bd3d Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 14:27:46 +0100 Subject: [PATCH 34/62] jenkins: dump install log on failure --- Jenkinsfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Jenkinsfile b/Jenkinsfile index 3cbcd0483e..0600cf9d99 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -21,7 +21,7 @@ pipeline { sh 'mkdir tmp' dir('tmp') { timestamps { - sh '../scripts/firedrake-install --disable-ssh --minimal-petsc ${SLEPC} --adjoint --slope --install thetis --install gusto ${PACKAGE_MANAGER}' + sh '../scripts/firedrake-install --disable-ssh --minimal-petsc ${SLEPC} --adjoint --slope --install thetis --install gusto ${PACKAGE_MANAGER} || (cat firedrake-install.log && /bin/false)' } } } From 9d17ffa22d44949d9ddfa522e449a32503d3993e Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 14:30:59 +0100 Subject: [PATCH 35/62] demos: Minor rst formatting --- .../linear_fluid_structure_interaction.py.rst | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst b/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst index 00eeb02fda..6e08a8c3aa 100644 --- a/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst +++ b/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst @@ -4,10 +4,13 @@ Linear mixed fluid-structure interaction system .. rst-class:: emphasis -This tutorial is aimed to demonstrate the use of subdomain functionality and show how to describe a system consisting of multiple materials in Firedrake. + This tutorial demonstrates the use of subdomain + functionality and show how to describe a system consisting of + multiple materials in Firedrake. -The tutorial was contributed by `Tomasz Salwa `__ -and `Onno Bokhove `__. + The tutorial was contributed by `Tomasz Salwa + `__ and `Onno Bokhove + `__. The model considered consists of fluid with a free surface and an elastic solid. We will be using interchangeably notions of fluid/water and structure/solid/beam. For simplicity (and speed of computation) we consider a model in 2D, however it can be easily generalised to 3D. The starting point is the linearised version (domain is fixed) of the fully nonlinear variational principle. In non-dimensional units: @@ -304,7 +307,14 @@ A python script version of this demo can be found `here `__. It can be generated with `gmsh `__ from `this file `__ with a command: gmsh -2 L_domain.geo. -The work is based on the article "Variational modelling of wave-structure interactions with an offshore wind-turbine mast" by Tomasz Salwa, Onno Bokhove and Mark Kelmanson :cite:`Salwa:2017`. The authors gratefully acknowledge funding from European Commission, Marie Curie Actions - Initial Training Networks (ITN), project number 607596. +.. rst-class:: emphasis + + The work is based on the article "Variational modelling of + wave-structure interactions with an offshore wind-turbine mast" by + Tomasz Salwa, Onno Bokhove and Mark Kelmanson + :cite:`Salwa:2017`. The authors gratefully acknowledge funding from + European Commission, Marie Curie Actions - Initial Training + Networks (ITN), project number 607596. .. rubric:: References From 1aed75ea7db8f40429843be44f53e28295072aad Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 15:41:48 +0100 Subject: [PATCH 36/62] install: Handle SLEPC_DIR like PETSC_DIR If the user built PETSc, they must also build SLEPc (and set SLEPC_DIR). Conversely, if we build PETSc, we must also build SLEPc. Fixes #1100. --- scripts/firedrake-install | 108 ++++++++++++++++++++++---------------- 1 file changed, 64 insertions(+), 44 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 8909d841e4..e722cd6683 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -551,6 +551,40 @@ def pip_uninstall(package): raise InstallError("pip claims it uninstalled %s more than 10 times. Something is probably broken.", package) +def get_petsc_dir(): + if args.honour_petsc_dir: + try: + petsc_dir = os.environ["PETSC_DIR"] + except KeyError: + raise InstallError("Unable to find installed PETSc (did you forget to set PETSC_DIR?)") + petsc_arch = os.environ.get("PETSC_ARCH", "") + else: + try: + petsc_dir = check_output(python + + ["-c", "import petsc; print(petsc.get_petsc_dir())"]).strip() + + petsc_arch = "" + except subprocess.CalledProcessError: + raise InstallError("Unable to find installed PETSc") + return petsc_dir, petsc_arch + + +def get_slepc_dir(): + petsc_dir, petsc_arch = get_petsc_dir() + if args.honour_petsc_dir: + try: + slepc_dir = os.environ["SLEPC_DIR"] + except KeyError: + raise InstallError("Need to set SLEPC_DIR for --slepc with --honour-petsc-dir") + else: + try: + slepc_dir = check_output(python + + ["-c", "import slepc; print(slepc.get_slepc_dir())"]).strip() + except subprocess.CalledProcessError: + raise InstallError("Unable to find installed SLEPc") + return slepc_dir, petsc_arch + + def build_and_install_petsc(): import hashlib import urllib.request @@ -611,18 +645,7 @@ def build_and_install_h5py(): git_clone(url) changed = True - if args.honour_petsc_dir: - petsc_dir = os.environ["PETSC_DIR"] - petsc_arch = os.environ.get("PETSC_ARCH", "") - else: - try: - petsc_dir = check_output(python + - ["-c", "import petsc; print(petsc.get_petsc_dir())"]).strip() - - petsc_arch = "" - except subprocess.CalledProcessError: - raise InstallError("Unable to find installed PETSc when building h5py") - + petsc_dir, petsc_arch = get_petsc_dir() hdf5_dir = "%s/%s" % (petsc_dir, petsc_arch) if changed or args.rebuild: log.info("Linking h5py against PETSc found in %s\n" % hdf5_dir) @@ -678,26 +701,22 @@ def build_and_install_libspatialindex(): def build_and_install_slepc(): - try: - petsc_dir = check_output(python + ["-c", "import petsc; print(petsc.get_petsc_dir())"]).strip() - petsc_arch = "" - except subprocess.CalledProcessError: - raise InstallError("Unable to find installed PETSc when building SLEPc") - - env = dict(os.environ) - env["PETSC_ARCH"] = petsc_arch - env["PETSC_DIR"] = petsc_dir + petsc_dir, petsc_arch = get_petsc_dir() - log.info("Installing SLEPc.") - if os.path.exists("slepc"): - slepc_changed = git_update("slepc") - else: - git_clone("git+https://bitbucket.org/slepc/slepc.git") - slepc_changed = True - if slepc_changed: - install("slepc/") + if args.honour_petsc_dir: + slepc_dir, slepc_arch = get_slepc_dir() + log.info("Using installed SLEPc from %s/%s", slepc_dir, slepc_arch) else: - log.info("No need to rebuild slepc") + log.info("Installing SLEPc.") + if os.path.exists("slepc"): + slepc_changed = git_update("slepc") + else: + git_clone("git+https://bitbucket.org/slepc/slepc.git") + slepc_changed = True + if slepc_changed: + install("slepc/") + else: + log.info("No need to rebuild SLEPc") log.info("Installing slepc4py.") if os.path.exists("slepc4py"): @@ -723,21 +742,13 @@ def build_and_install_adjoint(): else: raise - if args.honour_petsc_dir: - petsc_dir = os.environ["PETSC_DIR"] - petsc_arch = os.environ.get("PETSC_ARCH", "") - else: - try: - petsc_dir = check_output(python + - ["-c", "import petsc; print(petsc.get_petsc_dir())"]).strip() - - petsc_arch = "" - except subprocess.CalledProcessError: - raise InstallError("Unable to find installed PETSc when building h5py") - env = dict(os.environ) + petsc_dir, petsc_arch = get_petsc_dir() env["PETSC_ARCH"] = petsc_arch env["PETSC_DIR"] = petsc_dir + if options["slepc"]: + slepc_dir, _ = get_slepc_dir() + env["SLEPC_DIR"] = slepc_dir with directory("libadjoint"): dir_util.mkpath("build") @@ -832,6 +843,15 @@ not defined. If you have compiled PETSc manually, set PETSC_DIR (and optionally PETSC_ARCH) variables to point to the build directory. """) +if "SLEPC_DIR" not in os.environ and args.honour_petsc_dir and options["slepc"]: + quit("""If you use --honour-petsc-dir, you must also build SLEPc manually +and set the SLEPC_DIR environment variable appropriately""") + +if "SLEPC_DIR" in os.environ and not args.honour_petsc_dir and options["slepc"]: + quit("""The SLEPC_DIR environment variable is set. If you want to use +your own SLEPc version, you must also build your own PETSc and run +with --honour-petsc-dir.""") + log.debug("*** Current environment (output of 'env') ***") log.debug(check_output(["env"])) log.debug("\n\n") @@ -1081,10 +1101,10 @@ else: clean(p) install(p+"/") -if options["adjoint"]: - build_and_install_adjoint() if options["slepc"]: build_and_install_slepc() +if options["adjoint"]: + build_and_install_adjoint() if options["slope"]: build_and_install_slope() From e6494823fe66da271e841c946ad54d4b065ebe0b Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 15:53:30 +0100 Subject: [PATCH 37/62] install: Require that we are run with python >= 3.5 --- scripts/firedrake-install | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index e722cd6683..c923ca2fd7 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -33,6 +33,10 @@ class InstallError(Exception): pass +if sys.version_info < (3, 5): + raise InstallError("Firedrake requires Python 3, at least version 3.5") + + class FiredrakeConfiguration(dict): """A dictionary extended to facilitate the storage of Firedrake configuration information.""" From 7584697e6df0144ffb33eb08d012fc84e25b65b6 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 16:13:31 +0100 Subject: [PATCH 38/62] jenkins: Work around shebang line length limits execve(2) says: A maximum line length of 127 characters is allowed for the first line in an interpreter scripts. Jenkins runs the test suite in a very deep directory hierarchy. The installation of pip and pytest puts binaries in PATH with a shebang line that is therefore longer than this limit. As a result, the interpreter fails to execute them. To fix this, just run as "python -m xxx ...", rather than "xxx ...". --- Jenkinsfile | 12 ++++++------ Makefile | 16 ++++++++-------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 0600cf9d99..a1edc328be 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -32,7 +32,7 @@ pipeline { timestamps { sh ''' . ./firedrake/bin/activate -pip install flake8 +python -m pip install flake8 cd firedrake/src/firedrake make lint ''' @@ -48,11 +48,11 @@ make lint . ./firedrake/bin/activate export PYOP2_CACHE_DIR=${VIRTUAL_ENV}/pyop2_cache export FIREDRAKE_TSFC_KERNEL_CACHE_DIR=${VIRTUAL_ENV}/tsfc_cache -firedrake-clean -pip install pytest-cov pytest-xdist -pip list +python $(which firedrake-clean) +python -m pip install pytest-cov pytest-xdist +python -m pip list cd firedrake/src/firedrake -py.test -n 4 --cov firedrake -v tests +python -m pytest -n 4 --cov firedrake -v tests ''' } } @@ -66,7 +66,7 @@ py.test -n 4 --cov firedrake -v tests . ./firedrake/bin/activate export PYOP2_CACHE_DIR=${VIRTUAL_ENV}/pyop2_cache export FIREDRAKE_TSFC_KERNEL_CACHE_DIR=${VIRTUAL_ENV}/tsfc_cache -cd firedrake/src/dolfin-adjoint; py.test -n 4 -v tests_firedrake +cd firedrake/src/dolfin-adjoint; python -m pytest -n 4 -v tests_firedrake ''' } } diff --git a/Makefile b/Makefile index 8d644a9afe..52da45165e 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ modules: lint: @echo " Linting firedrake codebase" - @flake8 firedrake + @python -m flake8 firedrake @echo " Linting firedrake test suite" - @flake8 tests + @python -m flake8 tests @echo " Linting firedrake scripts" - @flake8 scripts --filename=* + @python -m flake8 scripts --filename=* clean: @echo " Cleaning extension modules" @@ -42,22 +42,22 @@ endif test_regression: modules @echo " Running non-extruded regression tests" - @py.test tests/regression $(PYTEST_ARGS) + @python -m pytest tests/regression $(PYTEST_ARGS) test_extrusion: modules @echo " Running extruded regression tests" - @py.test tests/extrusion $(PYTEST_ARGS) + @python -m pytest tests/extrusion $(PYTEST_ARGS) test_demos: modules @echo " Running test of demos" - @py.test tests/demos $(PYTEST_ARGS) + @python -m pytest tests/demos $(PYTEST_ARGS) test: modules @echo " Running all regression tests" - @py.test tests $(PYTEST_ARGS) + @python -m pytest tests $(PYTEST_ARGS) alltest: modules lint test shorttest: modules lint @echo " Running short regression tests" - @py.test --short tests $(PYTEST_ARGS) + @python -m pytest --short tests $(PYTEST_ARGS) From 9b3ea22e80fbf34095c391ded02524132d9136ce Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 26 Jul 2017 16:33:09 +0100 Subject: [PATCH 39/62] Missing realpath in update mode --- scripts/firedrake-install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index c923ca2fd7..e776ea0ef3 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -76,7 +76,7 @@ if os.path.basename(__file__) == "firedrake-install": mode = "install" elif os.path.basename(__file__) == "firedrake-update": mode = "update" - os.chdir(os.path.dirname(__file__) + "/../..") + os.chdir(os.path.dirname(os.path.realpath(__file__)) + "/../..") else: sys.exit("Script must be invoked either as firedrake-install or firedrake-update") From 2f52f66a4ab80e01e505481b69404a56757c0669 Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 26 Jul 2017 16:47:50 +0100 Subject: [PATCH 40/62] only run package installation the second time --- scripts/firedrake-install | 144 +++++++++++++++++++------------------- 1 file changed, 72 insertions(+), 72 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index e776ea0ef3..308e1ec981 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -860,83 +860,83 @@ log.debug("*** Current environment (output of 'env') ***") log.debug(check_output(["env"])) log.debug("\n\n") +if mode == "install" or not args.update_script: + # Check operating system. + osname = platform.uname()[0] + if osname == "Darwin": + if options["package_manager"]: + + log.info("Installing command line tools...") + try: + check_call(["xcode-select", "--install"]) + except subprocess.CalledProcessError: + # expected failure if already installed + pass + + try: + check_call(["brew", "--version"]) + except: + quit("Homebrew not found. Please install it using the instructions at http://brew.sh and then try again.") + + log.info("Installing required packages via homebrew. You can safely ignore warnings that packages are already installed") + # Ensure a fortran compiler is available + brew_install("gcc") + brew_install("openmpi") + brew_install("python3") + brew_install("autoconf") + brew_install("automake") + brew_install("cmake") + brew_install("libtool") + brew_install("mercurial") -# Check operating system. -osname = platform.uname()[0] -if osname == "Darwin": - if options["package_manager"]: - - log.info("Installing command line tools...") - try: - check_call(["xcode-select", "--install"]) - except subprocess.CalledProcessError: - # expected failure if already installed - pass + else: + log.info("Xcode and homebrew installation disabled. Proceeding on the rash assumption that packaged dependencies are in place.") + elif osname == "Linux": + # Check for apt. try: - check_call(["brew", "--version"]) - except: - quit("Homebrew not found. Please install it using the instructions at http://brew.sh and then try again.") - - log.info("Installing required packages via homebrew. You can safely ignore warnings that packages are already installed") - # Ensure a fortran compiler is available - brew_install("gcc") - brew_install("openmpi") - brew_install("python3") - brew_install("autoconf") - brew_install("automake") - brew_install("cmake") - brew_install("libtool") - brew_install("mercurial") + if not options["package_manager"]: + raise InstallError + check_call(["apt-get", "--version"]) + + apt_packages = ["build-essential", + "autoconf", + "automake", + "cmake", + "gfortran", + "git-core", + "libblas-dev", + "liblapack-dev", + "libopenmpi-dev", + "libtool", + "mercurial", + "openmpi-bin", + "python3-dev", + "python3-pip", + "python3-tk", + "python3-venv", + "zlib1g-dev"] + + missing_packages = [p for p in apt_packages if not apt_check(p)] + if missing_packages: + apt_install(missing_packages) + + except (subprocess.CalledProcessError, InstallError): + log.info("apt-get not found or disabled. Proceeding on the rash assumption that your compiled dependencies are in place.") + log.info("If this is not the case, please install the following and try again:") + log.info("* A C and C++ compiler (for example gcc/g++ or clang), GNU make") + log.info("* A Fortran compiler (for PETSc)") + log.info("* MPI") + log.info("* Blas and Lapack") + log.info("* Git, Mercurial") + log.info("* Python version >=3.5") + log.info("* The Python headers") + log.info("* autoconf, automake, libtool") + log.info("* CMake") + log.info("* zlib") else: - log.info("Xcode and homebrew installation disabled. Proceeding on the rash assumption that packaged dependencies are in place.") - -elif osname == "Linux": - # Check for apt. - try: - if not options["package_manager"]: - raise InstallError - check_call(["apt-get", "--version"]) - - apt_packages = ["build-essential", - "autoconf", - "automake", - "cmake", - "gfortran", - "git-core", - "libblas-dev", - "liblapack-dev", - "libopenmpi-dev", - "libtool", - "mercurial", - "openmpi-bin", - "python3-dev", - "python3-pip", - "python3-tk", - "python3-venv", - "zlib1g-dev"] - - missing_packages = [p for p in apt_packages if not apt_check(p)] - if missing_packages: - apt_install(missing_packages) - - except (subprocess.CalledProcessError, InstallError): - log.info("apt-get not found or disabled. Proceeding on the rash assumption that your compiled dependencies are in place.") - log.info("If this is not the case, please install the following and try again:") - log.info("* A C and C++ compiler (for example gcc/g++ or clang), GNU make") - log.info("* A Fortran compiler (for PETSc)") - log.info("* MPI") - log.info("* Blas and Lapack") - log.info("* Git, Mercurial") - log.info("* Python version >=3.5") - log.info("* The Python headers") - log.info("* autoconf, automake, libtool") - log.info("* CMake") - log.info("* zlib") - -else: - log.warn("You do not appear to be running Linux or MacOS. Please do not be surprised if this install fails.") + log.warn("You do not appear to be running Linux or MacOS. Please do not be surprised if this install fails.") if mode == "install": From 5f8e89ea76f960f34d9cc7c692ff08fa67915f83 Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 26 Jul 2017 17:23:11 +0100 Subject: [PATCH 41/62] Turns out the old way was safer --- scripts/firedrake-install | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 308e1ec981..28cb882494 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -278,9 +278,10 @@ old_git_packages = [] if mode == "install": firedrake_env = os.path.abspath(args.venv_name) else: - # venv is the directory above the update script. Strictly, it - # doesn't need to be active. - firedrake_env = os.path.dirname(os.path.realpath(__file__)) + "/../" + try: + firedrake_env = os.environ["VIRTUAL_ENV"] + except KeyError: + quit("Unable to retrieve venv name from the environment.\n Please ensure the venv is active before running firedrake-update.") # venv install python = ["%s/bin/python" % firedrake_env] From ef7023a1464e31a0bfedd548378a5765fe6d38fe Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 17:24:01 +0100 Subject: [PATCH 42/62] Defuturize all modules --- firedrake/__init__.py | 1 - firedrake/_version.py | 1 - firedrake/assemble.py | 1 - firedrake/assemble_expressions.py | 1 - firedrake/bcs.py | 1 - firedrake/checkpointing.py | 1 - firedrake/citations.py | 1 - firedrake/constant.py | 1 - firedrake/dmhooks.py | 1 - firedrake/dmplex.pyx | 2 -- firedrake/exceptions.py | 1 - firedrake/expression.py | 1 - firedrake/extrusion_utils.py | 1 - firedrake/formmanipulation.py | 1 - firedrake/function.py | 1 - firedrake/functionspace.py | 1 - firedrake/functionspacedata.py | 1 - firedrake/functionspaceimpl.py | 1 - firedrake/halo.py | 1 - firedrake/hdf5interface.pyx | 2 -- firedrake/interpolation.py | 1 - firedrake/linear_solver.py | 1 - firedrake/logging.py | 1 - firedrake/matrix.py | 1 - firedrake/matrix_free/__init__.py | 1 - firedrake/matrix_free/operators.py | 1 - firedrake/matrix_free/preconditioners.py | 1 - firedrake/mesh.py | 1 - firedrake/mg/__init__.py | 1 - firedrake/mg/impl.pyx | 2 -- firedrake/mg/interface.py | 1 - firedrake/mg/mesh.py | 1 - firedrake/mg/ufl_utils.py | 1 - firedrake/mg/utils.py | 1 - firedrake/norms.py | 1 - firedrake/nullspace.py | 1 - firedrake/optimizer.py | 1 - firedrake/output.py | 1 - firedrake/parameters.py | 1 - firedrake/parloops.py | 1 - firedrake/petsc.py | 1 - firedrake/plot.py | 1 - firedrake/pointeval_utils.py | 1 - firedrake/pointquery_utils.py | 1 - firedrake/projection.py | 1 - firedrake/slate/__init__.py | 1 - firedrake/slate/preconditioners.py | 1 - firedrake/slate/slac/__init__.py | 1 - firedrake/slate/slac/compiler.py | 1 - firedrake/slate/slac/kernel_builder.py | 1 - firedrake/slate/slac/tsfc_driver.py | 1 - firedrake/slate/slac/utils.py | 1 - firedrake/slate/slate.py | 1 - firedrake/slope_limiter/__init__.py | 1 - firedrake/slope_limiter/limiter.py | 1 - firedrake/slope_limiter/vertex_based_limiter.py | 1 - firedrake/solving.py | 1 - firedrake/solving_utils.py | 1 - firedrake/spatialindex.pyx | 2 -- firedrake/tsfc_interface.py | 1 - firedrake/ufl_expr.py | 1 - firedrake/utility_meshes.py | 1 - firedrake/utils.py | 1 - firedrake/variational_solver.py | 1 - firedrake/vector.py | 1 - firedrake/version.py | 1 - firedrake_configuration/__init__.py | 1 - setup.py | 1 - tests/benchmarks/conftest.py | 1 - tests/benchmarks/test_assembly_overheads.py | 1 - tests/benchmarks/test_solver_overheads.py | 1 - tests/conftest.py | 1 - tests/demos/test_demos_run.py | 1 - tests/extrusion/conftest.py | 1 - tests/extrusion/test_2d_cohomology.py | 1 - tests/extrusion/test_annulus.py | 1 - tests/extrusion/test_assembly.py | 1 - tests/extrusion/test_bcs_interior_facet.py | 1 - tests/extrusion/test_cellvolume_extrusion.py | 1 - tests/extrusion/test_cylinder.py | 1 - tests/extrusion/test_dg_coords.py | 1 - tests/extrusion/test_embedded_sphere_extrusion.py | 1 - tests/extrusion/test_enrichment_1_feec.py | 1 - tests/extrusion/test_extruded_cell_subdomains.py | 1 - tests/extrusion/test_facet_integrals_2D.py | 1 - tests/extrusion/test_facet_integrals_3D.py | 1 - tests/extrusion/test_facet_support_dofs.py | 1 - tests/extrusion/test_fs_abbreviations.py | 1 - tests/extrusion/test_galerkinproj.py | 1 - tests/extrusion/test_geometric_strong_bcs_extrusion.py | 1 - tests/extrusion/test_helmholtz_scalar.py | 1 - tests/extrusion/test_helmholtz_vector.py | 1 - tests/extrusion/test_identity_extrusion.py | 1 - tests/extrusion/test_interior_facets_extr.py | 1 - tests/extrusion/test_interval.py | 1 - tests/extrusion/test_kernel_int_cube.py | 1 - tests/extrusion/test_kernel_int_p0.py | 1 - tests/extrusion/test_kernel_intas_p0.py | 1 - tests/extrusion/test_kernel_intrhs.py | 1 - tests/extrusion/test_kernel_intvar_p0.py | 1 - tests/extrusion/test_laplace_neumann.py | 1 - tests/extrusion/test_meshes.py | 1 - tests/extrusion/test_mixed_bcs.py | 1 - tests/extrusion/test_mixed_mats_extrusion.py | 1 - tests/extrusion/test_offset_computation.py | 1 - tests/extrusion/test_point_eval_cells_extrusion.py | 1 - tests/extrusion/test_point_eval_fs_extrusion.py | 1 - tests/extrusion/test_poisson_neumann.py | 1 - tests/extrusion/test_poisson_strong_bcs_extrusion.py | 1 - tests/extrusion/test_rhs_bcs.py | 1 - tests/extrusion/test_rhs_side_bcs.py | 1 - tests/extrusion/test_side_strong_bcs.py | 1 - tests/extrusion/test_steady_advection_2D_extr.py | 1 - tests/extrusion/test_steady_advection_3D_extr.py | 1 - tests/extrusion/test_strong_bcs_caching.py | 1 - tests/extrusion/test_subdomain_extruded.py | 1 - tests/extrusion/test_trace_extr.py | 1 - tests/extrusion/test_two_step.py | 1 - tests/extrusion/test_unit_square.py | 1 - tests/extrusion/test_vfs_components.py | 1 - tests/extrusion/test_wedge_analytic.py | 1 - tests/extrusion/test_zero_forms_extrusion.py | 1 - tests/extrusion/test_zero_integrand_extrusion.py | 1 - tests/multigrid/test_basics.py | 1 - tests/multigrid/test_injection.py | 1 - tests/multigrid/test_invalid_transfers.py | 1 - tests/multigrid/test_multi_space_transfer.py | 1 - tests/multigrid/test_nested_split.py | 1 - tests/multigrid/test_poisson_gmg.py | 1 - tests/multigrid/test_prolongation.py | 1 - tests/multigrid/test_refine_then_solve.py | 1 - tests/multigrid/test_restriction.py | 1 - tests/multigrid/test_skipping_hierarchies.py | 1 - tests/multigrid/test_two_poisson_gmg.py | 1 - tests/output/test_config_exist.py | 1 - tests/output/test_dumb_checkpoint.py | 1 - tests/output/test_hdf5file_checkpoint.py | 1 - tests/output/test_one_dim_output.py | 1 - tests/output/test_pvd_output.py | 1 - tests/output/test_two_dim_output.py | 1 - tests/regression/test_2dcohomology.py | 1 - tests/regression/test_adv_diff.py | 1 - tests/regression/test_adv_diff_nonsplit.py | 1 - tests/regression/test_assemble.py | 1 - tests/regression/test_assemble_inverse.py | 1 - tests/regression/test_bcs.py | 1 - tests/regression/test_bubble.py | 1 - tests/regression/test_cell_subdomains.py | 1 - tests/regression/test_cellcoordinate.py | 1 - tests/regression/test_cellvolume.py | 1 - tests/regression/test_change_coordinates.py | 1 - tests/regression/test_circle_manifold.py | 1 - tests/regression/test_coefficient_derivatives.py | 1 - tests/regression/test_conditional.py | 1 - tests/regression/test_constant.py | 1 - tests/regression/test_custom_callbacks.py | 1 - tests/regression/test_dg_advection.py | 1 - tests/regression/test_embedded_sphere.py | 1 - tests/regression/test_exodus_mesh.py | 1 - tests/regression/test_expressions.py | 1 - tests/regression/test_facet_elements.py | 1 - tests/regression/test_facet_normal.py | 1 - tests/regression/test_facet_orientation.py | 1 - tests/regression/test_facets.py | 1 - tests/regression/test_fs_caching.py | 1 - tests/regression/test_function.py | 1 - tests/regression/test_function_spaces.py | 1 - tests/regression/test_geometric_strong_bcs.py | 1 - tests/regression/test_helmholtz.py | 1 - tests/regression/test_helmholtz_mixed.py | 1 - tests/regression/test_helmholtz_nonlinear_diffusion.py | 1 - tests/regression/test_helmholtz_sphere.py | 1 - tests/regression/test_hyperelasticity.py | 1 - tests/regression/test_identity.py | 1 - tests/regression/test_import_applications.py | 1 - tests/regression/test_info.py | 1 - tests/regression/test_interior_elements.py | 1 - tests/regression/test_interior_facets.py | 1 - tests/regression/test_interpolate.py | 1 - tests/regression/test_ip_viscosity.py | 1 - tests/regression/test_jacobian_invalidation.py | 1 - tests/regression/test_locate_cell.py | 1 - tests/regression/test_manifolds.py | 1 - tests/regression/test_manual_quadrature.py | 1 - tests/regression/test_matrix.py | 1 - tests/regression/test_matrix_free.py | 1 - tests/regression/test_mesh_generation.py | 1 - tests/regression/test_mixed_interior_facets.py | 1 - tests/regression/test_mixed_mats.py | 1 - tests/regression/test_mixed_tensor.py | 1 - tests/regression/test_multiple_domains.py | 1 - tests/regression/test_nested_fieldsplit_solves.py | 1 - tests/regression/test_nonlinear_helmholtz.py | 1 - tests/regression/test_nonlinear_stokes_hdiv.py | 1 - tests/regression/test_nullspace.py | 1 - tests/regression/test_par_loops.py | 1 - tests/regression/test_parallel_kernel.py | 1 - tests/regression/test_parameters.py | 1 - tests/regression/test_partially_mixed_mat.py | 1 - tests/regression/test_periodic_2d.py | 1 - tests/regression/test_periodic_interval_advection.py | 1 - tests/regression/test_periodic_rectangle_advection.py | 1 - tests/regression/test_piola_mixed_fn.py | 1 - tests/regression/test_point_eval_api.py | 1 - tests/regression/test_point_eval_cells.py | 1 - tests/regression/test_point_eval_fs.py | 1 - tests/regression/test_poisson_mixed_no_bcs.py | 1 - tests/regression/test_poisson_mixed_strong_bcs.py | 1 - tests/regression/test_poisson_sphere.py | 1 - tests/regression/test_poisson_strong_bcs.py | 1 - tests/regression/test_poisson_strong_bcs_nitsche.py | 1 - tests/regression/test_projection.py | 1 - tests/regression/test_python_parloop.py | 1 - tests/regression/test_quadrature.py | 1 - tests/regression/test_real_space.py | 1 - tests/regression/test_scaled_mass.py | 1 - tests/regression/test_slepc.py | 1 - tests/regression/test_solver_error_checking.py | 1 - tests/regression/test_solvers_options_prefix.py | 1 - tests/regression/test_solving_interface.py | 1 - tests/regression/test_split.py | 1 - tests/regression/test_split_communicators.py | 1 - tests/regression/test_steady_advection_2D.py | 1 - tests/regression/test_steady_advection_3D.py | 1 - tests/regression/test_stokes_mini.py | 1 - tests/regression/test_subdomain.py | 1 - tests/regression/test_subdomain_integrals.py | 1 - tests/regression/test_taylor.py | 1 - tests/regression/test_tensor_algebra.py | 1 - tests/regression/test_to_expression.py | 1 - tests/regression/test_trace_galerkin_projection.py | 1 - tests/regression/test_ufl.py | 1 - tests/regression/test_upwind_flux.py | 1 - tests/regression/test_vector.py | 1 - tests/regression/test_vector_laplace_on_quadrilaterals.py | 1 - tests/regression/test_vertex_based_limiter.py | 1 - tests/regression/test_vfs_component_bcs.py | 1 - tests/regression/test_work_functions.py | 1 - tests/regression/test_zero_forms.py | 1 - tests/regression/test_zero_integrand.py | 1 - tests/slate/test_assemble_tensors.py | 1 - tests/slate/test_facet_tensors.py | 1 - tests/slate/test_facet_tensors_extr.py | 1 - tests/slate/test_hybrid_nullspace.py | 1 - tests/slate/test_hybrid_poisson_sphere.py | 1 - tests/slate/test_linear_algebra.py | 1 - tests/slate/test_mimetic.py | 1 - tests/slate/test_orientations.py | 1 - tests/slate/test_scalar_tensors.py | 1 - tests/slate/test_scalar_tensors_extr.py | 1 - tests/slate/test_slac.py | 1 - tests/slate/test_slac_parallel.py | 1 - tests/slate/test_slate_hybridization.py | 1 - tests/slate/test_slate_hybridization_extr.py | 1 - tests/slate/test_slate_infrastructure.py | 1 - tests/test_0init.py | 1 - tests/test_tsfc_interface.py | 1 - versioneer.py | 1 - 258 files changed, 262 deletions(-) diff --git a/firedrake/__init__.py b/firedrake/__init__.py index ba3bbd2a6e..7fdcf73da5 100644 --- a/firedrake/__init__.py +++ b/firedrake/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division # Ensure petsc is initialised by us before anything else gets in there. import firedrake.petsc as petsc del petsc diff --git a/firedrake/_version.py b/firedrake/_version.py index 44ebd9d87a..c585c2405c 100644 --- a/firedrake/_version.py +++ b/firedrake/_version.py @@ -10,7 +10,6 @@ """Git implementation of _version.py.""" -from __future__ import absolute_import, print_function, division import errno import os import re diff --git a/firedrake/assemble.py b/firedrake/assemble.py index 9cc3943594..1dee88bac8 100644 --- a/firedrake/assemble.py +++ b/firedrake/assemble.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy import ufl from collections import defaultdict diff --git a/firedrake/assemble_expressions.py b/firedrake/assemble_expressions.py index c3d21bad4c..1835a579ff 100644 --- a/firedrake/assemble_expressions.py +++ b/firedrake/assemble_expressions.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems from six.moves import map, zip import weakref diff --git a/firedrake/bcs.py b/firedrake/bcs.py index 5b5b27db41..b1439a1967 100644 --- a/firedrake/bcs.py +++ b/firedrake/bcs.py @@ -1,5 +1,4 @@ # A module implementing strong (Dirichlet) boundary conditions. -from __future__ import absolute_import, print_function, division from six.moves import map, range import numpy as np from ufl import as_ufl, SpatialCoordinate, UFLException diff --git a/firedrake/checkpointing.py b/firedrake/checkpointing.py index 0b5c103537..ab40cfb957 100644 --- a/firedrake/checkpointing.py +++ b/firedrake/checkpointing.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake.petsc import PETSc from pyop2.mpi import COMM_WORLD, dup_comm, free_comm from firedrake import hdf5interface as h5i diff --git a/firedrake/citations.py b/firedrake/citations.py index 76dcb8d40c..794eaac9c9 100644 --- a/firedrake/citations.py +++ b/firedrake/citations.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake.petsc import PETSc diff --git a/firedrake/constant.py b/firedrake/constant.py index 6bff614655..f51c701664 100644 --- a/firedrake/constant.py +++ b/firedrake/constant.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import ufl diff --git a/firedrake/dmhooks.py b/firedrake/dmhooks.py index 18697b9991..42decf463f 100644 --- a/firedrake/dmhooks.py +++ b/firedrake/dmhooks.py @@ -36,7 +36,6 @@ fieldsplit preconditioning, without having to set everything up in advance. """ -from __future__ import absolute_import, print_function, division import weakref import numpy diff --git a/firedrake/dmplex.pyx b/firedrake/dmplex.pyx index 75df15f990..175a4b6fea 100644 --- a/firedrake/dmplex.pyx +++ b/firedrake/dmplex.pyx @@ -1,6 +1,4 @@ # Utility functions to derive global and local numbering from DMPlex -from __future__ import absolute_import, print_function, division - from firedrake.petsc import PETSc import numpy as np cimport numpy as np diff --git a/firedrake/exceptions.py b/firedrake/exceptions.py index 481819be91..c80853ef23 100644 --- a/firedrake/exceptions.py +++ b/firedrake/exceptions.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division class ConvergenceError(Exception): diff --git a/firedrake/expression.py b/firedrake/expression.py index 85369db550..77ec01f4b0 100644 --- a/firedrake/expression.py +++ b/firedrake/expression.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems import numpy as np diff --git a/firedrake/extrusion_utils.py b/firedrake/extrusion_utils.py index 30ebfeccbf..8b618923a0 100644 --- a/firedrake/extrusion_utils.py +++ b/firedrake/extrusion_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np from pyop2 import op2 diff --git a/firedrake/formmanipulation.py b/firedrake/formmanipulation.py index c9ed805db5..b5d2abc9e8 100644 --- a/firedrake/formmanipulation.py +++ b/firedrake/formmanipulation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy import collections diff --git a/firedrake/function.py b/firedrake/function.py index 529058771d..02782959da 100644 --- a/firedrake/function.py +++ b/firedrake/function.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six.moves import range, zip import numpy as np import sys diff --git a/firedrake/functionspace.py b/firedrake/functionspace.py index ae780d58e6..7932c04a30 100644 --- a/firedrake/functionspace.py +++ b/firedrake/functionspace.py @@ -4,7 +4,6 @@ API is functional, rather than object-based, to allow for simple backwards-compatibility, argument checking, and dispatch. """ -from __future__ import absolute_import, print_function, division from six.moves import range import ufl diff --git a/firedrake/functionspacedata.py b/firedrake/functionspacedata.py index 38d93a33bd..b44c4d13f3 100644 --- a/firedrake/functionspacedata.py +++ b/firedrake/functionspacedata.py @@ -14,7 +14,6 @@ vs VectorElement) can share the PyOP2 Set and Map data. """ -from __future__ import absolute_import, print_function, division from six.moves import map, range from six import iteritems diff --git a/firedrake/functionspaceimpl.py b/firedrake/functionspaceimpl.py index 150ca930a9..9a9799ded3 100644 --- a/firedrake/functionspaceimpl.py +++ b/firedrake/functionspaceimpl.py @@ -4,7 +4,6 @@ classes for attaching extra information to instances of these. """ -from __future__ import absolute_import, print_function, division import numpy diff --git a/firedrake/halo.py b/firedrake/halo.py index 13feb0ff24..f0a554bd51 100644 --- a/firedrake/halo.py +++ b/firedrake/halo.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from pyop2.utils import maybe_setflags from mpi4py import MPI diff --git a/firedrake/hdf5interface.pyx b/firedrake/hdf5interface.pyx index eb4659e7a9..119c410be2 100644 --- a/firedrake/hdf5interface.pyx +++ b/firedrake/hdf5interface.pyx @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - import h5py cimport petsc4py.PETSc as PETSc diff --git a/firedrake/interpolation.py b/firedrake/interpolation.py index b88deb9785..831f6e6286 100644 --- a/firedrake/interpolation.py +++ b/firedrake/interpolation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iterkeys import numpy diff --git a/firedrake/linear_solver.py b/firedrake/linear_solver.py index 61e0baee1c..c5fcb04785 100644 --- a/firedrake/linear_solver.py +++ b/firedrake/linear_solver.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl from firedrake.exceptions import ConvergenceError diff --git a/firedrake/logging.py b/firedrake/logging.py index 47a461665f..a8f69d28b7 100644 --- a/firedrake/logging.py +++ b/firedrake/logging.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import logging from logging import DEBUG, INFO, WARNING, ERROR, CRITICAL diff --git a/firedrake/matrix.py b/firedrake/matrix.py index 6a51995e96..ffb999d9b0 100644 --- a/firedrake/matrix.py +++ b/firedrake/matrix.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import with_metaclass import copy import abc diff --git a/firedrake/matrix_free/__init__.py b/firedrake/matrix_free/__init__.py index f298a6112c..e69de29bb2 100644 --- a/firedrake/matrix_free/__init__.py +++ b/firedrake/matrix_free/__init__.py @@ -1 +0,0 @@ -from __future__ import absolute_import, print_function, division diff --git a/firedrake/matrix_free/operators.py b/firedrake/matrix_free/operators.py index 768710ed8f..5d47846b7f 100644 --- a/firedrake/matrix_free/operators.py +++ b/firedrake/matrix_free/operators.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from ufl import action diff --git a/firedrake/matrix_free/preconditioners.py b/firedrake/matrix_free/preconditioners.py index d0dd036db5..0210ed97e6 100644 --- a/firedrake/matrix_free/preconditioners.py +++ b/firedrake/matrix_free/preconditioners.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import with_metaclass import abc diff --git a/firedrake/mesh.py b/firedrake/mesh.py index d58708d1e9..5959627e72 100644 --- a/firedrake/mesh.py +++ b/firedrake/mesh.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems, itervalues from six.moves import map, range diff --git a/firedrake/mg/__init__.py b/firedrake/mg/__init__.py index d8dff5a20d..ebded767c8 100644 --- a/firedrake/mg/__init__.py +++ b/firedrake/mg/__init__.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from .mesh import * # noqa: F401 from .interface import * # noqa: F401 diff --git a/firedrake/mg/impl.pyx b/firedrake/mg/impl.pyx index 0619c97161..c7c523973e 100644 --- a/firedrake/mg/impl.pyx +++ b/firedrake/mg/impl.pyx @@ -1,6 +1,4 @@ # Low-level numbering for multigrid support -from __future__ import absolute_import, print_function, division - import FIAT from tsfc.fiatinterface import create_element diff --git a/firedrake/mg/interface.py b/firedrake/mg/interface.py index 671e764a2b..7628af99b8 100644 --- a/firedrake/mg/interface.py +++ b/firedrake/mg/interface.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from functools import partial diff --git a/firedrake/mg/mesh.py b/firedrake/mg/mesh.py index 4e1160abfa..7d69d358c3 100644 --- a/firedrake/mg/mesh.py +++ b/firedrake/mg/mesh.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np from fractions import Fraction diff --git a/firedrake/mg/ufl_utils.py b/firedrake/mg/ufl_utils.py index 995e42d701..a2d5407910 100644 --- a/firedrake/mg/ufl_utils.py +++ b/firedrake/mg/ufl_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl from ufl.corealg.map_dag import map_expr_dag diff --git a/firedrake/mg/utils.py b/firedrake/mg/utils.py index 5244d99622..01f954ba68 100644 --- a/firedrake/mg/utils.py +++ b/firedrake/mg/utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems from six.moves import range, map, zip diff --git a/firedrake/norms.py b/firedrake/norms.py index 4bd429363b..8af43dbc0e 100644 --- a/firedrake/norms.py +++ b/firedrake/norms.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from ufl import inner, div, grad, curl, sqrt, dx from firedrake.assemble import assemble diff --git a/firedrake/nullspace.py b/firedrake/nullspace.py index 705288581d..d5c2e98132 100644 --- a/firedrake/nullspace.py +++ b/firedrake/nullspace.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy from pyop2.mpi import COMM_WORLD diff --git a/firedrake/optimizer.py b/firedrake/optimizer.py index 857f7488fd..16fa9597f8 100644 --- a/firedrake/optimizer.py +++ b/firedrake/optimizer.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division def slope(mesh, debug=False): diff --git a/firedrake/output.py b/firedrake/output.py index 35bee8fd3b..321620d296 100644 --- a/firedrake/output.py +++ b/firedrake/output.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import collections import itertools diff --git a/firedrake/parameters.py b/firedrake/parameters.py index 8029c869c0..9cf066b487 100644 --- a/firedrake/parameters.py +++ b/firedrake/parameters.py @@ -1,5 +1,4 @@ """The parameters dictionary contains global parameter settings.""" -from __future__ import absolute_import, print_function, division from six import iteritems from coffee import coffee_reconfigure diff --git a/firedrake/parloops.py b/firedrake/parloops.py index d31078ed50..76d0cee143 100644 --- a/firedrake/parloops.py +++ b/firedrake/parloops.py @@ -1,7 +1,6 @@ """This module implements parallel loops reading and writing :class:`.Function`\s. This provides a mechanism for implementing non-finite element operations such as slope limiters.""" -from __future__ import absolute_import, print_function, division import collections from ufl.indexed import Indexed diff --git a/firedrake/petsc.py b/firedrake/petsc.py index 8457f9b861..a52fbc4d98 100644 --- a/firedrake/petsc.py +++ b/firedrake/petsc.py @@ -1,5 +1,4 @@ # Utility module that imports and initialises petsc4py -from __future__ import absolute_import, print_function, division import petsc4py import sys petsc4py.init(sys.argv) diff --git a/firedrake/plot.py b/firedrake/plot.py index 1c5b805424..786fc18e76 100644 --- a/firedrake/plot.py +++ b/firedrake/plot.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six.moves import range, zip import numpy as np from ufl import Cell diff --git a/firedrake/pointeval_utils.py b/firedrake/pointeval_utils.py index e3514201c9..90bc587f4d 100644 --- a/firedrake/pointeval_utils.py +++ b/firedrake/pointeval_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from pyop2.datatypes import IntType, as_cstr diff --git a/firedrake/pointquery_utils.py b/firedrake/pointquery_utils.py index 3726d79bab..d30adc8cbc 100644 --- a/firedrake/pointquery_utils.py +++ b/firedrake/pointquery_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six.moves import range from os import path diff --git a/firedrake/projection.py b/firedrake/projection.py index 4880450bdb..6e4d14d446 100644 --- a/firedrake/projection.py +++ b/firedrake/projection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl from firedrake import expression diff --git a/firedrake/slate/__init__.py b/firedrake/slate/__init__.py index 7526693c0a..8e5addccd4 100644 --- a/firedrake/slate/__init__.py +++ b/firedrake/slate/__init__.py @@ -1,3 +1,2 @@ -from __future__ import absolute_import, print_function, division from firedrake.slate.slate import * # noqa: F401 from firedrake.slate.preconditioners import * # noqa: F401 diff --git a/firedrake/slate/preconditioners.py b/firedrake/slate/preconditioners.py index ad1ff1e99d..89c78cebb6 100644 --- a/firedrake/slate/preconditioners.py +++ b/firedrake/slate/preconditioners.py @@ -2,7 +2,6 @@ the Slate language. """ -from __future__ import absolute_import, print_function, division import ufl diff --git a/firedrake/slate/slac/__init__.py b/firedrake/slate/slac/__init__.py index 406ac5fae5..33016cea08 100644 --- a/firedrake/slate/slac/__init__.py +++ b/firedrake/slate/slac/__init__.py @@ -1,2 +1 @@ -from __future__ import absolute_import, print_function, division from firedrake.slate.slac.compiler import * # noqa: F401 diff --git a/firedrake/slate/slac/compiler.py b/firedrake/slate/slac/compiler.py index 62fb83aedd..7c0fafea97 100644 --- a/firedrake/slate/slac/compiler.py +++ b/firedrake/slate/slac/compiler.py @@ -14,7 +14,6 @@ all low-level numerical linear algebra operations are performed using this templated function library. """ -from __future__ import absolute_import, print_function, division from six.moves import range from coffee import base as ast diff --git a/firedrake/slate/slac/kernel_builder.py b/firedrake/slate/slac/kernel_builder.py index 14c3fccd1c..488e2e5dfe 100644 --- a/firedrake/slate/slac/kernel_builder.py +++ b/firedrake/slate/slac/kernel_builder.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from collections import OrderedDict diff --git a/firedrake/slate/slac/tsfc_driver.py b/firedrake/slate/slac/tsfc_driver.py index 9d7543c8d3..9a45086dd1 100644 --- a/firedrake/slate/slac/tsfc_driver.py +++ b/firedrake/slate/slac/tsfc_driver.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems import collections diff --git a/firedrake/slate/slac/utils.py b/firedrake/slate/slac/utils.py index fac4f0f957..0f83d629f6 100644 --- a/firedrake/slate/slac/utils.py +++ b/firedrake/slate/slac/utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import collections diff --git a/firedrake/slate/slate.py b/firedrake/slate/slate.py index 85e3c1e664..e3b84f247c 100644 --- a/firedrake/slate/slate.py +++ b/firedrake/slate/slate.py @@ -14,7 +14,6 @@ compiler, which interprets expressions and produces C++ kernel functions to be executed within the Firedrake architecture. """ -from __future__ import absolute_import, print_function, division from six import with_metaclass, iteritems from abc import ABCMeta, abstractproperty, abstractmethod diff --git a/firedrake/slope_limiter/__init__.py b/firedrake/slope_limiter/__init__.py index 611078254e..e72ee1d4d1 100644 --- a/firedrake/slope_limiter/__init__.py +++ b/firedrake/slope_limiter/__init__.py @@ -1,3 +1,2 @@ -from __future__ import absolute_import, print_function, division from firedrake.slope_limiter.limiter import * # noqa: F401 from firedrake.slope_limiter.vertex_based_limiter import * # noqa: F401 diff --git a/firedrake/slope_limiter/limiter.py b/firedrake/slope_limiter/limiter.py index 3e1d7ca987..03d5abedec 100644 --- a/firedrake/slope_limiter/limiter.py +++ b/firedrake/slope_limiter/limiter.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import with_metaclass from abc import ABCMeta, abstractmethod diff --git a/firedrake/slope_limiter/vertex_based_limiter.py b/firedrake/slope_limiter/vertex_based_limiter.py index fe2706b81f..9f276d1448 100644 --- a/firedrake/slope_limiter/vertex_based_limiter.py +++ b/firedrake/slope_limiter/vertex_based_limiter.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import dx, assemble, LinearSolver from firedrake.function import Function from firedrake.functionspace import FunctionSpace diff --git a/firedrake/solving.py b/firedrake/solving.py index b5aaa0f200..88f5436a93 100644 --- a/firedrake/solving.py +++ b/firedrake/solving.py @@ -17,7 +17,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with DOLFIN. If not, see . -from __future__ import absolute_import, print_function, division from six import iterkeys __all__ = ["solve"] diff --git a/firedrake/solving_utils.py b/firedrake/solving_utils.py index 9489799da9..45803fe037 100644 --- a/firedrake/solving_utils.py +++ b/firedrake/solving_utils.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from six import iteritems import numpy import itertools diff --git a/firedrake/spatialindex.pyx b/firedrake/spatialindex.pyx index 5788837f5c..bc4c5e0670 100644 --- a/firedrake/spatialindex.pyx +++ b/firedrake/spatialindex.pyx @@ -1,5 +1,3 @@ -from __future__ import absolute_import, print_function, division - cimport numpy as np import ctypes import cython diff --git a/firedrake/tsfc_interface.py b/firedrake/tsfc_interface.py index 20db26a259..9519ba03b5 100644 --- a/firedrake/tsfc_interface.py +++ b/firedrake/tsfc_interface.py @@ -1,6 +1,5 @@ """Provides the interface to TSFC for compiling a form, and transforms the TSFC- generated code in order to make it suitable for passing to the backends.""" -from __future__ import absolute_import, print_function, division from six.moves import cPickle from hashlib import md5 diff --git a/firedrake/ufl_expr.py b/firedrake/ufl_expr.py index ef68b01036..265ce8312a 100644 --- a/firedrake/ufl_expr.py +++ b/firedrake/ufl_expr.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl import ufl.argument from ufl.assertions import ufl_assert diff --git a/firedrake/utility_meshes.py b/firedrake/utility_meshes.py index aaa47fb5b5..4101794cd5 100644 --- a/firedrake/utility_meshes.py +++ b/firedrake/utility_meshes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import ufl diff --git a/firedrake/utils.py b/firedrake/utils.py index f60512fb1b..2237c61975 100644 --- a/firedrake/utils.py +++ b/firedrake/utils.py @@ -1,5 +1,4 @@ # Some generic python utilities not really specific to our work. -from __future__ import absolute_import, print_function, division from decorator import decorator from pyop2.utils import cached_property # noqa: F401 diff --git a/firedrake/variational_solver.py b/firedrake/variational_solver.py index e7abef1b43..90e6c7c5bc 100644 --- a/firedrake/variational_solver.py +++ b/firedrake/variational_solver.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import ufl diff --git a/firedrake/vector.py b/firedrake/vector.py index 0a72a65fe5..c462b8270e 100644 --- a/firedrake/vector.py +++ b/firedrake/vector.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import firedrake diff --git a/firedrake/version.py b/firedrake/version.py index c2cd4830e9..2fe4e1b583 100644 --- a/firedrake/version.py +++ b/firedrake/version.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division __version_info__ = (0, 12, 0) __version__ = '.'.join(map(str, __version_info__)) diff --git a/firedrake_configuration/__init__.py b/firedrake_configuration/__init__.py index 590dfc9678..00d0bf2a33 100644 --- a/firedrake_configuration/__init__.py +++ b/firedrake_configuration/__init__.py @@ -3,7 +3,6 @@ package from Firedrake in order to ensure that `firedrake-update` can always access the configuration, even if the :mod:`.firedrake` module itself is broken.""" -from __future__ import absolute_import, print_function, division import json import os diff --git a/setup.py b/setup.py index 4769c7c56f..bbd5c978e6 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from distutils.core import setup from distutils.extension import Extension from glob import glob diff --git a/tests/benchmarks/conftest.py b/tests/benchmarks/conftest.py index 34b2ffcd58..2139db3231 100644 --- a/tests/benchmarks/conftest.py +++ b/tests/benchmarks/conftest.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/benchmarks/test_assembly_overheads.py b/tests/benchmarks/test_assembly_overheads.py index 37047fdfd3..c947812e16 100644 --- a/tests/benchmarks/test_assembly_overheads.py +++ b/tests/benchmarks/test_assembly_overheads.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/benchmarks/test_solver_overheads.py b/tests/benchmarks/test_solver_overheads.py index 756b78cb9d..e6e22abb58 100644 --- a/tests/benchmarks/test_solver_overheads.py +++ b/tests/benchmarks/test_solver_overheads.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/conftest.py b/tests/conftest.py index d3720d555b..c2dc3badad 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,5 +1,4 @@ """Global test configuration.""" -from __future__ import absolute_import, print_function, division import pytest from subprocess import check_call diff --git a/tests/demos/test_demos_run.py b/tests/demos/test_demos_run.py index c4e0439ba1..f41f272e34 100644 --- a/tests/demos/test_demos_run.py +++ b/tests/demos/test_demos_run.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from os.path import abspath, basename, dirname, join, splitext import os diff --git a/tests/extrusion/conftest.py b/tests/extrusion/conftest.py index 9eb7d67797..040825fce2 100644 --- a/tests/extrusion/conftest.py +++ b/tests/extrusion/conftest.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import ExtrudedMesh, UnitSquareMesh, UnitIntervalMesh diff --git a/tests/extrusion/test_2d_cohomology.py b/tests/extrusion/test_2d_cohomology.py index 823afd75f7..7620659cd0 100644 --- a/tests/extrusion/test_2d_cohomology.py +++ b/tests/extrusion/test_2d_cohomology.py @@ -9,7 +9,6 @@ conditions is equal to the dimension of the (n-k)th cohomology group without boundary conditions. """ -from __future__ import absolute_import, print_function, division import numpy.linalg as linalg import numpy from firedrake import * diff --git a/tests/extrusion/test_annulus.py b/tests/extrusion/test_annulus.py index 3f510a01a2..44ebf3e14d 100644 --- a/tests/extrusion/test_annulus.py +++ b/tests/extrusion/test_annulus.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/extrusion/test_assembly.py b/tests/extrusion/test_assembly.py index ad1733193b..05ae4aa823 100644 --- a/tests/extrusion/test_assembly.py +++ b/tests/extrusion/test_assembly.py @@ -1,5 +1,4 @@ """Tests for successful assembly of forms on extruded meshes""" -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_bcs_interior_facet.py b/tests/extrusion/test_bcs_interior_facet.py index 44e1e9b173..299a731354 100644 --- a/tests/extrusion/test_bcs_interior_facet.py +++ b/tests/extrusion/test_bcs_interior_facet.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np from firedrake import * diff --git a/tests/extrusion/test_cellvolume_extrusion.py b/tests/extrusion/test_cellvolume_extrusion.py index c1693b7a42..14a2222056 100644 --- a/tests/extrusion/test_cellvolume_extrusion.py +++ b/tests/extrusion/test_cellvolume_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_cylinder.py b/tests/extrusion/test_cylinder.py index 472868c02e..970f92888f 100644 --- a/tests/extrusion/test_cylinder.py +++ b/tests/extrusion/test_cylinder.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/extrusion/test_dg_coords.py b/tests/extrusion/test_dg_coords.py index 6c344ddb5a..0032cb1719 100644 --- a/tests/extrusion/test_dg_coords.py +++ b/tests/extrusion/test_dg_coords.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/extrusion/test_embedded_sphere_extrusion.py b/tests/extrusion/test_embedded_sphere_extrusion.py index 3be6f0f27e..f61be31755 100644 --- a/tests/extrusion/test_embedded_sphere_extrusion.py +++ b/tests/extrusion/test_embedded_sphere_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_enrichment_1_feec.py b/tests/extrusion/test_enrichment_1_feec.py index f280717f2b..0e62096606 100644 --- a/tests/extrusion/test_enrichment_1_feec.py +++ b/tests/extrusion/test_enrichment_1_feec.py @@ -1,5 +1,4 @@ """Test curl-grad = 0 and div-curl = 0, using enriched function spaces""" -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/extrusion/test_extruded_cell_subdomains.py b/tests/extrusion/test_extruded_cell_subdomains.py index d325a184dc..b6080c958e 100644 --- a/tests/extrusion/test_extruded_cell_subdomains.py +++ b/tests/extrusion/test_extruded_cell_subdomains.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import pytest import numpy as np diff --git a/tests/extrusion/test_facet_integrals_2D.py b/tests/extrusion/test_facet_integrals_2D.py index 97c532febc..f8be8bdc69 100644 --- a/tests/extrusion/test_facet_integrals_2D.py +++ b/tests/extrusion/test_facet_integrals_2D.py @@ -1,5 +1,4 @@ """Testing assembly of scalars on facets of extruded meshes in 2D""" -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_facet_integrals_3D.py b/tests/extrusion/test_facet_integrals_3D.py index 438a7dceb4..335f913c1d 100644 --- a/tests/extrusion/test_facet_integrals_3D.py +++ b/tests/extrusion/test_facet_integrals_3D.py @@ -1,5 +1,4 @@ """Testing assembly of scalars on facets of extruded meshes in 3D""" -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_facet_support_dofs.py b/tests/extrusion/test_facet_support_dofs.py index d63f4749bb..3c675b065f 100644 --- a/tests/extrusion/test_facet_support_dofs.py +++ b/tests/extrusion/test_facet_support_dofs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from finat.finiteelementbase import entity_support_dofs import pytest diff --git a/tests/extrusion/test_fs_abbreviations.py b/tests/extrusion/test_fs_abbreviations.py index 2037cdc948..d895fc3566 100644 --- a/tests/extrusion/test_fs_abbreviations.py +++ b/tests/extrusion/test_fs_abbreviations.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_galerkinproj.py b/tests/extrusion/test_galerkinproj.py index aeddfd61f2..863bfd7ec4 100644 --- a/tests/extrusion/test_galerkinproj.py +++ b/tests/extrusion/test_galerkinproj.py @@ -1,5 +1,4 @@ """Tests for Galerkin projection convergence on extruded meshes""" -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_geometric_strong_bcs_extrusion.py b/tests/extrusion/test_geometric_strong_bcs_extrusion.py index 80d8c55e3e..90c12e2267 100644 --- a/tests/extrusion/test_geometric_strong_bcs_extrusion.py +++ b/tests/extrusion/test_geometric_strong_bcs_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_helmholtz_scalar.py b/tests/extrusion/test_helmholtz_scalar.py index 205bb7f680..b194a32807 100644 --- a/tests/extrusion/test_helmholtz_scalar.py +++ b/tests/extrusion/test_helmholtz_scalar.py @@ -1,5 +1,4 @@ """Tests for scalar Helmholtz convergence on extruded meshes""" -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_helmholtz_vector.py b/tests/extrusion/test_helmholtz_vector.py index 5d91de5422..528ae098c5 100644 --- a/tests/extrusion/test_helmholtz_vector.py +++ b/tests/extrusion/test_helmholtz_vector.py @@ -1,5 +1,4 @@ """Tests for mixed Helmholtz convergence on extruded meshes""" -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_identity_extrusion.py b/tests/extrusion/test_identity_extrusion.py index df49088ab2..30c58a540a 100644 --- a/tests/extrusion/test_identity_extrusion.py +++ b/tests/extrusion/test_identity_extrusion.py @@ -1,5 +1,4 @@ """Tests for successful identity solve on extruded meshes""" -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_interior_facets_extr.py b/tests/extrusion/test_interior_facets_extr.py index 3ca266fb67..484ede4c8a 100644 --- a/tests/extrusion/test_interior_facets_extr.py +++ b/tests/extrusion/test_interior_facets_extr.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_interval.py b/tests/extrusion/test_interval.py index 7e3b019854..5c4c5d6193 100644 --- a/tests/extrusion/test_interval.py +++ b/tests/extrusion/test_interval.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_kernel_int_cube.py b/tests/extrusion/test_kernel_int_cube.py index a70fe1a189..e103e36dfd 100644 --- a/tests/extrusion/test_kernel_int_cube.py +++ b/tests/extrusion/test_kernel_int_cube.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_kernel_int_p0.py b/tests/extrusion/test_kernel_int_p0.py index ac8a93668a..93cc4fb10d 100644 --- a/tests/extrusion/test_kernel_int_p0.py +++ b/tests/extrusion/test_kernel_int_p0.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_kernel_intas_p0.py b/tests/extrusion/test_kernel_intas_p0.py index 714c545f0b..4b66ac6ee7 100644 --- a/tests/extrusion/test_kernel_intas_p0.py +++ b/tests/extrusion/test_kernel_intas_p0.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_kernel_intrhs.py b/tests/extrusion/test_kernel_intrhs.py index 02de349a69..f5041d0667 100644 --- a/tests/extrusion/test_kernel_intrhs.py +++ b/tests/extrusion/test_kernel_intrhs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_kernel_intvar_p0.py b/tests/extrusion/test_kernel_intvar_p0.py index 5e516bb3f4..3cb2ae17e9 100644 --- a/tests/extrusion/test_kernel_intvar_p0.py +++ b/tests/extrusion/test_kernel_intvar_p0.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_laplace_neumann.py b/tests/extrusion/test_laplace_neumann.py index f0512c7654..f1e9fbae02 100644 --- a/tests/extrusion/test_laplace_neumann.py +++ b/tests/extrusion/test_laplace_neumann.py @@ -6,7 +6,6 @@ conditions on 2/4 sides and Neumann boundary conditions on the other 2, opposite, sides. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_meshes.py b/tests/extrusion/test_meshes.py index 885a1914f5..4a02ba18d5 100644 --- a/tests/extrusion/test_meshes.py +++ b/tests/extrusion/test_meshes.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/extrusion/test_mixed_bcs.py b/tests/extrusion/test_mixed_bcs.py index bc3b136033..3cbeac3ebe 100644 --- a/tests/extrusion/test_mixed_bcs.py +++ b/tests/extrusion/test_mixed_bcs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/extrusion/test_mixed_mats_extrusion.py b/tests/extrusion/test_mixed_mats_extrusion.py index 9063cf0fe9..c89a0cdb37 100644 --- a/tests/extrusion/test_mixed_mats_extrusion.py +++ b/tests/extrusion/test_mixed_mats_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_offset_computation.py b/tests/extrusion/test_offset_computation.py index 51050e8b83..4f9f4ec507 100644 --- a/tests/extrusion/test_offset_computation.py +++ b/tests/extrusion/test_offset_computation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_point_eval_cells_extrusion.py b/tests/extrusion/test_point_eval_cells_extrusion.py index 3ec9f1189f..dc42dc16a2 100644 --- a/tests/extrusion/test_point_eval_cells_extrusion.py +++ b/tests/extrusion/test_point_eval_cells_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import numpy as np import pytest diff --git a/tests/extrusion/test_point_eval_fs_extrusion.py b/tests/extrusion/test_point_eval_fs_extrusion.py index 483c656f92..b3d992f94e 100644 --- a/tests/extrusion/test_point_eval_fs_extrusion.py +++ b/tests/extrusion/test_point_eval_fs_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname import numpy as np import pytest diff --git a/tests/extrusion/test_poisson_neumann.py b/tests/extrusion/test_poisson_neumann.py index 72c44f114a..4a04c5520f 100644 --- a/tests/extrusion/test_poisson_neumann.py +++ b/tests/extrusion/test_poisson_neumann.py @@ -6,7 +6,6 @@ and Neumann boundary conditions (one explicit, one implicit) on the other 2, opposite, sides. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_poisson_strong_bcs_extrusion.py b/tests/extrusion/test_poisson_strong_bcs_extrusion.py index 408fd2a128..6ea5f7936b 100644 --- a/tests/extrusion/test_poisson_strong_bcs_extrusion.py +++ b/tests/extrusion/test_poisson_strong_bcs_extrusion.py @@ -15,7 +15,6 @@ u(x, y, z) = 42*z """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_rhs_bcs.py b/tests/extrusion/test_rhs_bcs.py index c688bc3d7d..3c22b99f1f 100644 --- a/tests/extrusion/test_rhs_bcs.py +++ b/tests/extrusion/test_rhs_bcs.py @@ -1,7 +1,6 @@ """This demo program sets the top and bottom boundaries of an extruded unit square to 42. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_rhs_side_bcs.py b/tests/extrusion/test_rhs_side_bcs.py index f439855ebd..d046262ce5 100644 --- a/tests/extrusion/test_rhs_side_bcs.py +++ b/tests/extrusion/test_rhs_side_bcs.py @@ -1,7 +1,6 @@ """This demo program sets opposite boundary sides to 10 and 42 and then checks that the exact result has bee achieved. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_side_strong_bcs.py b/tests/extrusion/test_side_strong_bcs.py index 5ec123625d..b298a90724 100644 --- a/tests/extrusion/test_side_strong_bcs.py +++ b/tests/extrusion/test_side_strong_bcs.py @@ -2,7 +2,6 @@ of an extruded unit square. We then check against the actual solution of the equation. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_steady_advection_2D_extr.py b/tests/extrusion/test_steady_advection_2D_extr.py index a67020685f..4b1272617a 100644 --- a/tests/extrusion/test_steady_advection_2D_extr.py +++ b/tests/extrusion/test_steady_advection_2D_extr.py @@ -3,7 +3,6 @@ method is used, which stress-tests both interior and exterior facet integrals. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_steady_advection_3D_extr.py b/tests/extrusion/test_steady_advection_3D_extr.py index 3b1fd25cd6..5f07e6b844 100644 --- a/tests/extrusion/test_steady_advection_3D_extr.py +++ b/tests/extrusion/test_steady_advection_3D_extr.py @@ -3,7 +3,6 @@ method is used, which stress-tests both interior and exterior facet integrals. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_strong_bcs_caching.py b/tests/extrusion/test_strong_bcs_caching.py index 0d5a404b06..c8cad8551c 100644 --- a/tests/extrusion/test_strong_bcs_caching.py +++ b/tests/extrusion/test_strong_bcs_caching.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest from firedrake import * diff --git a/tests/extrusion/test_subdomain_extruded.py b/tests/extrusion/test_subdomain_extruded.py index ddccc43889..a2a22a190c 100644 --- a/tests/extrusion/test_subdomain_extruded.py +++ b/tests/extrusion/test_subdomain_extruded.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/extrusion/test_trace_extr.py b/tests/extrusion/test_trace_extr.py index 3911cf6817..74257733fa 100644 --- a/tests/extrusion/test_trace_extr.py +++ b/tests/extrusion/test_trace_extr.py @@ -1,5 +1,4 @@ """Tests projections onto the HDiv Trace space on extruded meshes""" -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_two_step.py b/tests/extrusion/test_two_step.py index 61702aef7b..b825e3c734 100644 --- a/tests/extrusion/test_two_step.py +++ b/tests/extrusion/test_two_step.py @@ -1,5 +1,4 @@ """Testing extruded RT elements.""" -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/extrusion/test_unit_square.py b/tests/extrusion/test_unit_square.py index 49afa588a9..c5a9da0530 100644 --- a/tests/extrusion/test_unit_square.py +++ b/tests/extrusion/test_unit_square.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/extrusion/test_vfs_components.py b/tests/extrusion/test_vfs_components.py index 4cb635fbfb..ab16fddf42 100644 --- a/tests/extrusion/test_vfs_components.py +++ b/tests/extrusion/test_vfs_components.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/extrusion/test_wedge_analytic.py b/tests/extrusion/test_wedge_analytic.py index 2002e584fb..2d2c9838b6 100644 --- a/tests/extrusion/test_wedge_analytic.py +++ b/tests/extrusion/test_wedge_analytic.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/extrusion/test_zero_forms_extrusion.py b/tests/extrusion/test_zero_forms_extrusion.py index c27b594fa7..41c0c64e63 100644 --- a/tests/extrusion/test_zero_forms_extrusion.py +++ b/tests/extrusion/test_zero_forms_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/extrusion/test_zero_integrand_extrusion.py b/tests/extrusion/test_zero_integrand_extrusion.py index dc69737035..dbcca06e98 100644 --- a/tests/extrusion/test_zero_integrand_extrusion.py +++ b/tests/extrusion/test_zero_integrand_extrusion.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/multigrid/test_basics.py b/tests/multigrid/test_basics.py index 7f92446e08..6898015cbc 100644 --- a/tests/multigrid/test_basics.py +++ b/tests/multigrid/test_basics.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/multigrid/test_injection.py b/tests/multigrid/test_injection.py index 0221dda719..9b64af29a3 100644 --- a/tests/multigrid/test_injection.py +++ b/tests/multigrid/test_injection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/multigrid/test_invalid_transfers.py b/tests/multigrid/test_invalid_transfers.py index 7630d735e9..d84e24ee93 100644 --- a/tests/multigrid/test_invalid_transfers.py +++ b/tests/multigrid/test_invalid_transfers.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/multigrid/test_multi_space_transfer.py b/tests/multigrid/test_multi_space_transfer.py index 99471e0244..8b10a80cd9 100644 --- a/tests/multigrid/test_multi_space_transfer.py +++ b/tests/multigrid/test_multi_space_transfer.py @@ -1,4 +1,3 @@ -from __future__ import division, absolute_import, print_function from firedrake import * import numpy import pytest diff --git a/tests/multigrid/test_nested_split.py b/tests/multigrid/test_nested_split.py index fa30305d98..57dbafa14a 100644 --- a/tests/multigrid/test_nested_split.py +++ b/tests/multigrid/test_nested_split.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/multigrid/test_poisson_gmg.py b/tests/multigrid/test_poisson_gmg.py index f7a5d5a094..9178da78ce 100644 --- a/tests/multigrid/test_poisson_gmg.py +++ b/tests/multigrid/test_poisson_gmg.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/multigrid/test_prolongation.py b/tests/multigrid/test_prolongation.py index e1e07e93f4..ff8ea5a957 100644 --- a/tests/multigrid/test_prolongation.py +++ b/tests/multigrid/test_prolongation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/multigrid/test_refine_then_solve.py b/tests/multigrid/test_refine_then_solve.py index 7593114872..f641849762 100644 --- a/tests/multigrid/test_refine_then_solve.py +++ b/tests/multigrid/test_refine_then_solve.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/multigrid/test_restriction.py b/tests/multigrid/test_restriction.py index 6b300c3d38..c208a309c1 100644 --- a/tests/multigrid/test_restriction.py +++ b/tests/multigrid/test_restriction.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/multigrid/test_skipping_hierarchies.py b/tests/multigrid/test_skipping_hierarchies.py index 76d0bab548..5f058dcd80 100644 --- a/tests/multigrid/test_skipping_hierarchies.py +++ b/tests/multigrid/test_skipping_hierarchies.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake.mg.utils import get_level from fractions import Fraction diff --git a/tests/multigrid/test_two_poisson_gmg.py b/tests/multigrid/test_two_poisson_gmg.py index fd08b09b2d..995fff4795 100644 --- a/tests/multigrid/test_two_poisson_gmg.py +++ b/tests/multigrid/test_two_poisson_gmg.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/output/test_config_exist.py b/tests/output/test_config_exist.py index bbf52c6c25..b78ec56f57 100644 --- a/tests/output/test_config_exist.py +++ b/tests/output/test_config_exist.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division def test_config_exist(): diff --git a/tests/output/test_dumb_checkpoint.py b/tests/output/test_dumb_checkpoint.py index ddf2d081bd..3d3bd3bb7c 100644 --- a/tests/output/test_dumb_checkpoint.py +++ b/tests/output/test_dumb_checkpoint.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/output/test_hdf5file_checkpoint.py b/tests/output/test_hdf5file_checkpoint.py index f89573f397..2193aa5b93 100644 --- a/tests/output/test_hdf5file_checkpoint.py +++ b/tests/output/test_hdf5file_checkpoint.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/output/test_one_dim_output.py b/tests/output/test_one_dim_output.py index 17803b2d1b..edd90906b2 100644 --- a/tests/output/test_one_dim_output.py +++ b/tests/output/test_one_dim_output.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake.plot import calculate_one_dim_points import numpy as np diff --git a/tests/output/test_pvd_output.py b/tests/output/test_pvd_output.py index 02761c5769..821a6f6f47 100644 --- a/tests/output/test_pvd_output.py +++ b/tests/output/test_pvd_output.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os import listdir from os.path import isfile, join from collections import Counter diff --git a/tests/output/test_two_dim_output.py b/tests/output/test_two_dim_output.py index e34292c5ac..8e4dc4fe5e 100644 --- a/tests/output/test_two_dim_output.py +++ b/tests/output/test_two_dim_output.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake.plot import _calculate_points import numpy as np diff --git a/tests/regression/test_2dcohomology.py b/tests/regression/test_2dcohomology.py index 4a33a90c4c..09ae4a10cc 100644 --- a/tests/regression/test_2dcohomology.py +++ b/tests/regression/test_2dcohomology.py @@ -9,7 +9,6 @@ the dimension of the (n-k)th cohomology group without boundary conditions. """ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import numpy.linalg as linalg import numpy diff --git a/tests/regression/test_adv_diff.py b/tests/regression/test_adv_diff.py index 8b9f94ea75..ba45df4ef5 100644 --- a/tests/regression/test_adv_diff.py +++ b/tests/regression/test_adv_diff.py @@ -5,7 +5,6 @@ method and the diffusion term is advanced in time using a theta scheme with theta = 0.5. """ -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_adv_diff_nonsplit.py b/tests/regression/test_adv_diff_nonsplit.py index 9e06137ad8..3a625c4b41 100644 --- a/tests/regression/test_adv_diff_nonsplit.py +++ b/tests/regression/test_adv_diff_nonsplit.py @@ -3,7 +3,6 @@ This demo solves the advection-diffusion equation and is advanced in time using a theta scheme with theta = 0.5. """ -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_assemble.py b/tests/regression/test_assemble.py index 74a3200f50..899b5124aa 100644 --- a/tests/regression/test_assemble.py +++ b/tests/regression/test_assemble.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_assemble_inverse.py b/tests/regression/test_assemble_inverse.py index 7073140fa8..66fa8664d6 100644 --- a/tests/regression/test_assemble_inverse.py +++ b/tests/regression/test_assemble_inverse.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_bcs.py b/tests/regression/test_bcs.py index 45fe654437..8baccace73 100644 --- a/tests/regression/test_bcs.py +++ b/tests/regression/test_bcs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_bubble.py b/tests/regression/test_bubble.py index aa1b510d76..7ccdfca91d 100644 --- a/tests/regression/test_bubble.py +++ b/tests/regression/test_bubble.py @@ -1,5 +1,4 @@ """Test bubble function space""" -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_cell_subdomains.py b/tests/regression/test_cell_subdomains.py index bedddeffac..55683fef46 100644 --- a/tests/regression/test_cell_subdomains.py +++ b/tests/regression/test_cell_subdomains.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import pytest import numpy as np diff --git a/tests/regression/test_cellcoordinate.py b/tests/regression/test_cellcoordinate.py index bde57ddc71..e173477873 100644 --- a/tests/regression/test_cellcoordinate.py +++ b/tests/regression/test_cellcoordinate.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_cellvolume.py b/tests/regression/test_cellvolume.py index b473472f5a..b297d5bde0 100644 --- a/tests/regression/test_cellvolume.py +++ b/tests/regression/test_cellvolume.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_change_coordinates.py b/tests/regression/test_change_coordinates.py index 70c3bef887..bd47a25fe4 100644 --- a/tests/regression/test_change_coordinates.py +++ b/tests/regression/test_change_coordinates.py @@ -1,5 +1,4 @@ """This tests that exchanging the coordinate field for one of a different dimension does the right thing.""" -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_circle_manifold.py b/tests/regression/test_circle_manifold.py index f5b842048e..0a624784e6 100644 --- a/tests/regression/test_circle_manifold.py +++ b/tests/regression/test_circle_manifold.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/regression/test_coefficient_derivatives.py b/tests/regression/test_coefficient_derivatives.py index af3c692d96..cf1e4edfa4 100644 --- a/tests/regression/test_coefficient_derivatives.py +++ b/tests/regression/test_coefficient_derivatives.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_conditional.py b/tests/regression/test_conditional.py index 86969bfa05..6e2fc340aa 100644 --- a/tests/regression/test_conditional.py +++ b/tests/regression/test_conditional.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_constant.py b/tests/regression/test_constant.py index 52d779a8fa..f3f8a25272 100644 --- a/tests/regression/test_constant.py +++ b/tests/regression/test_constant.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/regression/test_custom_callbacks.py b/tests/regression/test_custom_callbacks.py index b32e732a1b..e040c4275c 100644 --- a/tests/regression/test_custom_callbacks.py +++ b/tests/regression/test_custom_callbacks.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/regression/test_dg_advection.py b/tests/regression/test_dg_advection.py index 420d250a4a..48facf676f 100644 --- a/tests/regression/test_dg_advection.py +++ b/tests/regression/test_dg_advection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import numpy as np import pytest diff --git a/tests/regression/test_embedded_sphere.py b/tests/regression/test_embedded_sphere.py index edd70b4e9e..ae05435810 100644 --- a/tests/regression/test_embedded_sphere.py +++ b/tests/regression/test_embedded_sphere.py @@ -1,5 +1,4 @@ # Test that integrals over the surface of a sphere do the right thing -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_exodus_mesh.py b/tests/regression/test_exodus_mesh.py index 3e0f21d5f2..1d1d58cbe6 100644 --- a/tests/regression/test_exodus_mesh.py +++ b/tests/regression/test_exodus_mesh.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import pytest from firedrake import * diff --git a/tests/regression/test_expressions.py b/tests/regression/test_expressions.py index ecfb51ae2e..811d8a4604 100644 --- a/tests/regression/test_expressions.py +++ b/tests/regression/test_expressions.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from operator import iadd, isub, imul, itruediv from functools import partial from itertools import permutations diff --git a/tests/regression/test_facet_elements.py b/tests/regression/test_facet_elements.py index 43d0d212c0..60ff8b7206 100644 --- a/tests/regression/test_facet_elements.py +++ b/tests/regression/test_facet_elements.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_facet_normal.py b/tests/regression/test_facet_normal.py index 737bab77e0..7cba5a50d8 100644 --- a/tests/regression/test_facet_normal.py +++ b/tests/regression/test_facet_normal.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_facet_orientation.py b/tests/regression/test_facet_orientation.py index ce2e1f0ffa..9c04d44a5f 100644 --- a/tests/regression/test_facet_orientation.py +++ b/tests/regression/test_facet_orientation.py @@ -1,7 +1,6 @@ """Tests if nodes shared between cells (e.g. nodes on vertices, facets etc.) are interpreted consistently on CG spaces by the cells that share them. """ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import pytest diff --git a/tests/regression/test_facets.py b/tests/regression/test_facets.py index d0450586ff..d81a3bb1bf 100644 --- a/tests/regression/test_facets.py +++ b/tests/regression/test_facets.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_fs_caching.py b/tests/regression/test_fs_caching.py index b2bd294a36..89cd4e7d28 100644 --- a/tests/regression/test_fs_caching.py +++ b/tests/regression/test_fs_caching.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * from firedrake.mesh import MeshTopology, MeshGeometry diff --git a/tests/regression/test_function.py b/tests/regression/test_function.py index e6b9a37740..10ab247504 100644 --- a/tests/regression/test_function.py +++ b/tests/regression/test_function.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_function_spaces.py b/tests/regression/test_function_spaces.py index 6a1d9f7bf9..56e07fb690 100644 --- a/tests/regression/test_function_spaces.py +++ b/tests/regression/test_function_spaces.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_geometric_strong_bcs.py b/tests/regression/test_geometric_strong_bcs.py index b85261d20f..77d5410db7 100644 --- a/tests/regression/test_geometric_strong_bcs.py +++ b/tests/regression/test_geometric_strong_bcs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_helmholtz.py b/tests/regression/test_helmholtz.py index 7e10782cac..5de9cc7795 100644 --- a/tests/regression/test_helmholtz.py +++ b/tests/regression/test_helmholtz.py @@ -10,7 +10,6 @@ u(x, y) = cos(x[0]*2*pi)*cos(x[1]*2*pi) """ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import numpy as np diff --git a/tests/regression/test_helmholtz_mixed.py b/tests/regression/test_helmholtz_mixed.py index d14ea18966..b90b2fc66d 100644 --- a/tests/regression/test_helmholtz_mixed.py +++ b/tests/regression/test_helmholtz_mixed.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_helmholtz_nonlinear_diffusion.py b/tests/regression/test_helmholtz_nonlinear_diffusion.py index 681d0d2454..90ea94957e 100644 --- a/tests/regression/test_helmholtz_nonlinear_diffusion.py +++ b/tests/regression/test_helmholtz_nonlinear_diffusion.py @@ -21,7 +21,6 @@ u(x, y) = cos(x*2*pi)*cos(y*2*pi) """ -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_helmholtz_sphere.py b/tests/regression/test_helmholtz_sphere.py index 533afcb277..e6d1e83994 100644 --- a/tests/regression/test_helmholtz_sphere.py +++ b/tests/regression/test_helmholtz_sphere.py @@ -1,6 +1,5 @@ # Solve -laplace u + u = f on the surface of the sphere # with forcing function xyz, this has exact solution xyz/13 -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_hyperelasticity.py b/tests/regression/test_hyperelasticity.py index 7b9d23ca91..979d4d234b 100644 --- a/tests/regression/test_hyperelasticity.py +++ b/tests/regression/test_hyperelasticity.py @@ -1,5 +1,4 @@ # coding=utf-8 -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/regression/test_identity.py b/tests/regression/test_identity.py index 273d7bb2a6..75ac846c6c 100644 --- a/tests/regression/test_identity.py +++ b/tests/regression/test_identity.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_import_applications.py b/tests/regression/test_import_applications.py index f11a086999..bbb06cd262 100644 --- a/tests/regression/test_import_applications.py +++ b/tests/regression/test_import_applications.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import os import subprocess diff --git a/tests/regression/test_info.py b/tests/regression/test_info.py index 88f50f4140..bf69682ac8 100644 --- a/tests/regression/test_info.py +++ b/tests/regression/test_info.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * diff --git a/tests/regression/test_interior_elements.py b/tests/regression/test_interior_elements.py index 2abe87e936..3fd14d92e1 100644 --- a/tests/regression/test_interior_elements.py +++ b/tests/regression/test_interior_elements.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_interior_facets.py b/tests/regression/test_interior_facets.py index 5ac6ee832c..ea762d75d1 100644 --- a/tests/regression/test_interior_facets.py +++ b/tests/regression/test_interior_facets.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_interpolate.py b/tests/regression/test_interpolate.py index b82dcb1501..3637740d79 100644 --- a/tests/regression/test_interpolate.py +++ b/tests/regression/test_interpolate.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_ip_viscosity.py b/tests/regression/test_ip_viscosity.py index 851d7b48f3..648f3f4891 100644 --- a/tests/regression/test_ip_viscosity.py +++ b/tests/regression/test_ip_viscosity.py @@ -6,7 +6,6 @@ with variable viscosity. Convergence is tested for RT2, DG1, BDM1 and BDM2 vector fields. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy diff --git a/tests/regression/test_jacobian_invalidation.py b/tests/regression/test_jacobian_invalidation.py index 530b3c43a8..150ba5b567 100644 --- a/tests/regression/test_jacobian_invalidation.py +++ b/tests/regression/test_jacobian_invalidation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_locate_cell.py b/tests/regression/test_locate_cell.py index ab38a284d7..ced02c8fdd 100644 --- a/tests/regression/test_locate_cell.py +++ b/tests/regression/test_locate_cell.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_manifolds.py b/tests/regression/test_manifolds.py index aa66fb7b7b..cbf5abe32a 100644 --- a/tests/regression/test_manifolds.py +++ b/tests/regression/test_manifolds.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_manual_quadrature.py b/tests/regression/test_manual_quadrature.py index f6a9cf8ea9..de45c9d9da 100644 --- a/tests/regression/test_manual_quadrature.py +++ b/tests/regression/test_manual_quadrature.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_matrix.py b/tests/regression/test_matrix.py index 358a0499cc..d643ca4327 100644 --- a/tests/regression/test_matrix.py +++ b/tests/regression/test_matrix.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake import matrix import pytest diff --git a/tests/regression/test_matrix_free.py b/tests/regression/test_matrix_free.py index 6815b1e91b..3dd514d334 100644 --- a/tests/regression/test_matrix_free.py +++ b/tests/regression/test_matrix_free.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_mesh_generation.py b/tests/regression/test_mesh_generation.py index 6a055cf4a6..edfd77b644 100644 --- a/tests/regression/test_mesh_generation.py +++ b/tests/regression/test_mesh_generation.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/regression/test_mixed_interior_facets.py b/tests/regression/test_mixed_interior_facets.py index 500edea8d5..334e42236e 100644 --- a/tests/regression/test_mixed_interior_facets.py +++ b/tests/regression/test_mixed_interior_facets.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_mixed_mats.py b/tests/regression/test_mixed_mats.py index 312c2fd0ca..084aa85fff 100644 --- a/tests/regression/test_mixed_mats.py +++ b/tests/regression/test_mixed_mats.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_mixed_tensor.py b/tests/regression/test_mixed_tensor.py index 1f73d6441c..39efd9a95e 100644 --- a/tests/regression/test_mixed_tensor.py +++ b/tests/regression/test_mixed_tensor.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_multiple_domains.py b/tests/regression/test_multiple_domains.py index f7c7978db5..0c902f5270 100644 --- a/tests/regression/test_multiple_domains.py +++ b/tests/regression/test_multiple_domains.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_nested_fieldsplit_solves.py b/tests/regression/test_nested_fieldsplit_solves.py index 0b6fa0c43c..f9ab74427a 100644 --- a/tests/regression/test_nested_fieldsplit_solves.py +++ b/tests/regression/test_nested_fieldsplit_solves.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/regression/test_nonlinear_helmholtz.py b/tests/regression/test_nonlinear_helmholtz.py index c274d466cf..d4407d39b5 100644 --- a/tests/regression/test_nonlinear_helmholtz.py +++ b/tests/regression/test_nonlinear_helmholtz.py @@ -10,7 +10,6 @@ u(x, y) = cos(x[0]*2*pi)*cos(x[1]*2*pi) """ -from __future__ import absolute_import, print_function, division import pytest diff --git a/tests/regression/test_nonlinear_stokes_hdiv.py b/tests/regression/test_nonlinear_stokes_hdiv.py index 86a5e7eace..253ac7efae 100644 --- a/tests/regression/test_nonlinear_stokes_hdiv.py +++ b/tests/regression/test_nonlinear_stokes_hdiv.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * diff --git a/tests/regression/test_nullspace.py b/tests/regression/test_nullspace.py index 32a2ad6b7c..de1e76799e 100644 --- a/tests/regression/test_nullspace.py +++ b/tests/regression/test_nullspace.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_par_loops.py b/tests/regression/test_par_loops.py index 2db7466995..6c5b0975ac 100644 --- a/tests/regression/test_par_loops.py +++ b/tests/regression/test_par_loops.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_parallel_kernel.py b/tests/regression/test_parallel_kernel.py index 4cbb5175b3..c426fe46d8 100644 --- a/tests/regression/test_parallel_kernel.py +++ b/tests/regression/test_parallel_kernel.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/regression/test_parameters.py b/tests/regression/test_parameters.py index ed64362b89..78a687a5a0 100644 --- a/tests/regression/test_parameters.py +++ b/tests/regression/test_parameters.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * # These Parameter tests are a cut down version of the unit Parameter tests in DOLFIN diff --git a/tests/regression/test_partially_mixed_mat.py b/tests/regression/test_partially_mixed_mat.py index 91c67812f7..ccc2c1410d 100644 --- a/tests/regression/test_partially_mixed_mat.py +++ b/tests/regression/test_partially_mixed_mat.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_periodic_2d.py b/tests/regression/test_periodic_2d.py index 81309eee15..53209eecdc 100644 --- a/tests/regression/test_periodic_2d.py +++ b/tests/regression/test_periodic_2d.py @@ -13,7 +13,6 @@ partially periodic mesh, we impose zero Dirichlet BCs on the non-periodic boundaries. """ -from __future__ import absolute_import, print_function, division import pytest from math import pi diff --git a/tests/regression/test_periodic_interval_advection.py b/tests/regression/test_periodic_interval_advection.py index e6bd78f9d7..ffc0ec8e8e 100644 --- a/tests/regression/test_periodic_interval_advection.py +++ b/tests/regression/test_periodic_interval_advection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_periodic_rectangle_advection.py b/tests/regression/test_periodic_rectangle_advection.py index a2b813c3c3..d8efa0d4b4 100644 --- a/tests/regression/test_periodic_rectangle_advection.py +++ b/tests/regression/test_periodic_rectangle_advection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_piola_mixed_fn.py b/tests/regression/test_piola_mixed_fn.py index ee238dd6e6..77f9126432 100644 --- a/tests/regression/test_piola_mixed_fn.py +++ b/tests/regression/test_piola_mixed_fn.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest from firedrake import * diff --git a/tests/regression/test_point_eval_api.py b/tests/regression/test_point_eval_api.py index 736b3a5617..7ded5bfcab 100644 --- a/tests/regression/test_point_eval_api.py +++ b/tests/regression/test_point_eval_api.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname import numpy as np import pytest diff --git a/tests/regression/test_point_eval_cells.py b/tests/regression/test_point_eval_cells.py index 25452c4550..9925c1c832 100644 --- a/tests/regression/test_point_eval_cells.py +++ b/tests/regression/test_point_eval_cells.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname, join import numpy as np import pytest diff --git a/tests/regression/test_point_eval_fs.py b/tests/regression/test_point_eval_fs.py index 6555dc03c6..30b2b56a38 100644 --- a/tests/regression/test_point_eval_fs.py +++ b/tests/regression/test_point_eval_fs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from os.path import abspath, dirname import numpy as np import pytest diff --git a/tests/regression/test_poisson_mixed_no_bcs.py b/tests/regression/test_poisson_mixed_no_bcs.py index defd60c696..f7d6011f4d 100644 --- a/tests/regression/test_poisson_mixed_no_bcs.py +++ b/tests/regression/test_poisson_mixed_no_bcs.py @@ -22,7 +22,6 @@ x[0]*(1-x[0])*x[1]*(1-x[1]) """ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/regression/test_poisson_mixed_strong_bcs.py b/tests/regression/test_poisson_mixed_strong_bcs.py index 95d317da5a..ab2637280a 100644 --- a/tests/regression/test_poisson_mixed_strong_bcs.py +++ b/tests/regression/test_poisson_mixed_strong_bcs.py @@ -23,7 +23,6 @@ 42*dot(tau, n)*ds """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_poisson_sphere.py b/tests/regression/test_poisson_sphere.py index 7d5966ab66..7d365ccb95 100644 --- a/tests/regression/test_poisson_sphere.py +++ b/tests/regression/test_poisson_sphere.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_poisson_strong_bcs.py b/tests/regression/test_poisson_strong_bcs.py index 713d7a002a..d3024947f9 100644 --- a/tests/regression/test_poisson_strong_bcs.py +++ b/tests/regression/test_poisson_strong_bcs.py @@ -14,7 +14,6 @@ u(x, y) = 42*x[1] """ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_poisson_strong_bcs_nitsche.py b/tests/regression/test_poisson_strong_bcs_nitsche.py index 2a7a5171b8..9b6d45cee0 100644 --- a/tests/regression/test_poisson_strong_bcs_nitsche.py +++ b/tests/regression/test_poisson_strong_bcs_nitsche.py @@ -30,7 +30,6 @@ and take \lim_{\epsilon \rightarrow 0} """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_projection.py b/tests/regression/test_projection.py index df471cf9a2..96f5b7a9c3 100644 --- a/tests/regression/test_projection.py +++ b/tests/regression/test_projection.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_python_parloop.py b/tests/regression/test_python_parloop.py index f6dc339264..ddc706c207 100644 --- a/tests/regression/test_python_parloop.py +++ b/tests/regression/test_python_parloop.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_quadrature.py b/tests/regression/test_quadrature.py index 713e4ad08a..b68ee6dede 100644 --- a/tests/regression/test_quadrature.py +++ b/tests/regression/test_quadrature.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_real_space.py b/tests/regression/test_real_space.py index fae222bb50..80abad6473 100644 --- a/tests/regression/test_real_space.py +++ b/tests/regression/test_real_space.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/regression/test_scaled_mass.py b/tests/regression/test_scaled_mass.py index 7ba83b614c..04bc69db2e 100644 --- a/tests/regression/test_scaled_mass.py +++ b/tests/regression/test_scaled_mass.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_slepc.py b/tests/regression/test_slepc.py index 0c3a5e38ab..7776ce6d4b 100644 --- a/tests/regression/test_slepc.py +++ b/tests/regression/test_slepc.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_solver_error_checking.py b/tests/regression/test_solver_error_checking.py index aef7d09686..33b3fb4ddd 100644 --- a/tests/regression/test_solver_error_checking.py +++ b/tests/regression/test_solver_error_checking.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_solvers_options_prefix.py b/tests/regression/test_solvers_options_prefix.py index 70c664926e..a22882b03e 100644 --- a/tests/regression/test_solvers_options_prefix.py +++ b/tests/regression/test_solvers_options_prefix.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake.solving_utils import ParametersMixin from firedrake.petsc import PETSc diff --git a/tests/regression/test_solving_interface.py b/tests/regression/test_solving_interface.py index 7c2b42652b..fd6a3772cd 100644 --- a/tests/regression/test_solving_interface.py +++ b/tests/regression/test_solving_interface.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * from firedrake.petsc import PETSc diff --git a/tests/regression/test_split.py b/tests/regression/test_split.py index a15bd9917a..e3377689f0 100644 --- a/tests/regression/test_split.py +++ b/tests/regression/test_split.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_split_communicators.py b/tests/regression/test_split_communicators.py index deaf6ff6a2..83fe3325bf 100644 --- a/tests/regression/test_split_communicators.py +++ b/tests/regression/test_split_communicators.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/regression/test_steady_advection_2D.py b/tests/regression/test_steady_advection_2D.py index b0a1ad0497..9a26144d77 100644 --- a/tests/regression/test_steady_advection_2D.py +++ b/tests/regression/test_steady_advection_2D.py @@ -3,7 +3,6 @@ method is used, which stress-tests both interior and exterior facet integrals. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_steady_advection_3D.py b/tests/regression/test_steady_advection_3D.py index 44b9afd22a..0a3b08aa4e 100644 --- a/tests/regression/test_steady_advection_3D.py +++ b/tests/regression/test_steady_advection_3D.py @@ -3,7 +3,6 @@ method is used, which stress-tests both interior and exterior facet integrals. """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_stokes_mini.py b/tests/regression/test_stokes_mini.py index b18f46baf6..ee2e0c20fd 100644 --- a/tests/regression/test_stokes_mini.py +++ b/tests/regression/test_stokes_mini.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_subdomain.py b/tests/regression/test_subdomain.py index 76f965bc08..bacce3ef85 100644 --- a/tests/regression/test_subdomain.py +++ b/tests/regression/test_subdomain.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_subdomain_integrals.py b/tests/regression/test_subdomain_integrals.py index 6a1f052d9d..fd18387543 100644 --- a/tests/regression/test_subdomain_integrals.py +++ b/tests/regression/test_subdomain_integrals.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_taylor.py b/tests/regression/test_taylor.py index 380f26de4d..542ef5c055 100644 --- a/tests/regression/test_taylor.py +++ b/tests/regression/test_taylor.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy diff --git a/tests/regression/test_tensor_algebra.py b/tests/regression/test_tensor_algebra.py index c5a68c40b6..6cef9b7376 100644 --- a/tests/regression/test_tensor_algebra.py +++ b/tests/regression/test_tensor_algebra.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_to_expression.py b/tests/regression/test_to_expression.py index 9aaad11046..842b6fd377 100644 --- a/tests/regression/test_to_expression.py +++ b/tests/regression/test_to_expression.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import firedrake.expression as expression import pytest diff --git a/tests/regression/test_trace_galerkin_projection.py b/tests/regression/test_trace_galerkin_projection.py index fe42cc5309..9085b05fc6 100644 --- a/tests/regression/test_trace_galerkin_projection.py +++ b/tests/regression/test_trace_galerkin_projection.py @@ -16,7 +16,6 @@ The right hand side function used in this test is: f = cos(x[0]*pi*2)*cos(x[1]*pi*2) """ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/regression/test_ufl.py b/tests/regression/test_ufl.py index 7962228467..f9585f63bf 100644 --- a/tests/regression/test_ufl.py +++ b/tests/regression/test_ufl.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_upwind_flux.py b/tests/regression/test_upwind_flux.py index d883b4efee..bc8404598a 100644 --- a/tests/regression/test_upwind_flux.py +++ b/tests/regression/test_upwind_flux.py @@ -22,7 +22,6 @@ \int_e phi div(F) ds = \int_{\partial e} phi u.n \tilde{D} ds as required. """ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/regression/test_vector.py b/tests/regression/test_vector.py index 4b4290b764..a46b254e13 100644 --- a/tests/regression/test_vector.py +++ b/tests/regression/test_vector.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/regression/test_vector_laplace_on_quadrilaterals.py b/tests/regression/test_vector_laplace_on_quadrilaterals.py index ef8b03815e..9346f08b9b 100644 --- a/tests/regression/test_vector_laplace_on_quadrilaterals.py +++ b/tests/regression/test_vector_laplace_on_quadrilaterals.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import numpy as np import pytest diff --git a/tests/regression/test_vertex_based_limiter.py b/tests/regression/test_vertex_based_limiter.py index a98182fb3c..0f91cdd6cc 100644 --- a/tests/regression/test_vertex_based_limiter.py +++ b/tests/regression/test_vertex_based_limiter.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_vfs_component_bcs.py b/tests/regression/test_vfs_component_bcs.py index 466bf792fc..e5a898a9d8 100644 --- a/tests/regression/test_vfs_component_bcs.py +++ b/tests/regression/test_vfs_component_bcs.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/regression/test_work_functions.py b/tests/regression/test_work_functions.py index 7ad2317944..bc3890a766 100644 --- a/tests/regression/test_work_functions.py +++ b/tests/regression/test_work_functions.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/regression/test_zero_forms.py b/tests/regression/test_zero_forms.py index 56c23fcf64..5486f98ea0 100644 --- a/tests/regression/test_zero_forms.py +++ b/tests/regression/test_zero_forms.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np import itertools diff --git a/tests/regression/test_zero_integrand.py b/tests/regression/test_zero_integrand.py index 43b48d8eac..a211435be2 100644 --- a/tests/regression/test_zero_integrand.py +++ b/tests/regression/test_zero_integrand.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest import numpy as np diff --git a/tests/slate/test_assemble_tensors.py b/tests/slate/test_assemble_tensors.py index 917a755feb..636f3173e8 100644 --- a/tests/slate/test_assemble_tensors.py +++ b/tests/slate/test_assemble_tensors.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/slate/test_facet_tensors.py b/tests/slate/test_facet_tensors.py index 8a8c40a516..6a819014fe 100644 --- a/tests/slate/test_facet_tensors.py +++ b/tests/slate/test_facet_tensors.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/slate/test_facet_tensors_extr.py b/tests/slate/test_facet_tensors_extr.py index 85953a5b43..5a2ca3d9b3 100644 --- a/tests/slate/test_facet_tensors_extr.py +++ b/tests/slate/test_facet_tensors_extr.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/slate/test_hybrid_nullspace.py b/tests/slate/test_hybrid_nullspace.py index 47298eec82..ea3cc5b566 100644 --- a/tests/slate/test_hybrid_nullspace.py +++ b/tests/slate/test_hybrid_nullspace.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * from firedrake.slate.preconditioners import create_schur_nullspace diff --git a/tests/slate/test_hybrid_poisson_sphere.py b/tests/slate/test_hybrid_poisson_sphere.py index c38698502e..fd4e1c0981 100644 --- a/tests/slate/test_hybrid_poisson_sphere.py +++ b/tests/slate/test_hybrid_poisson_sphere.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import numpy as np diff --git a/tests/slate/test_linear_algebra.py b/tests/slate/test_linear_algebra.py index b1a5eb26d4..5a6d5e37ee 100644 --- a/tests/slate/test_linear_algebra.py +++ b/tests/slate/test_linear_algebra.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/slate/test_mimetic.py b/tests/slate/test_mimetic.py index ab24833210..cc123f192a 100644 --- a/tests/slate/test_mimetic.py +++ b/tests/slate/test_mimetic.py @@ -1,5 +1,4 @@ """Tests for the successful assembly of mimetic elements in Slate""" -from __future__ import absolute_import, print_function, division import pytest import numpy as np from firedrake import * diff --git a/tests/slate/test_orientations.py b/tests/slate/test_orientations.py index 6d3215d83a..0b89497cf0 100644 --- a/tests/slate/test_orientations.py +++ b/tests/slate/test_orientations.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/slate/test_scalar_tensors.py b/tests/slate/test_scalar_tensors.py index 861a1e5dfb..bce084d1ed 100644 --- a/tests/slate/test_scalar_tensors.py +++ b/tests/slate/test_scalar_tensors.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import itertools import numpy as np diff --git a/tests/slate/test_scalar_tensors_extr.py b/tests/slate/test_scalar_tensors_extr.py index ec0b5375c6..c381385f18 100644 --- a/tests/slate/test_scalar_tensors_extr.py +++ b/tests/slate/test_scalar_tensors_extr.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest import numpy as np diff --git a/tests/slate/test_slac.py b/tests/slate/test_slac.py index f45fd70f7e..97b911b5c2 100644 --- a/tests/slate/test_slac.py +++ b/tests/slate/test_slac.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * from firedrake.slate.slac import compile_expression as compile_slate diff --git a/tests/slate/test_slac_parallel.py b/tests/slate/test_slac_parallel.py index 62a7007e2a..dd9915849a 100644 --- a/tests/slate/test_slac_parallel.py +++ b/tests/slate/test_slac_parallel.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division from firedrake import * import pytest diff --git a/tests/slate/test_slate_hybridization.py b/tests/slate/test_slate_hybridization.py index 4f23f23f61..ef476b4345 100644 --- a/tests/slate/test_slate_hybridization.py +++ b/tests/slate/test_slate_hybridization.py @@ -21,7 +21,6 @@ which appears in the variational form as the term: -<42*tau, n> """ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/slate/test_slate_hybridization_extr.py b/tests/slate/test_slate_hybridization_extr.py index c840b297f8..fc16905f1a 100644 --- a/tests/slate/test_slate_hybridization_extr.py +++ b/tests/slate/test_slate_hybridization_extr.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/slate/test_slate_infrastructure.py b/tests/slate/test_slate_infrastructure.py index ffb045e61a..2adf8554e3 100644 --- a/tests/slate/test_slate_infrastructure.py +++ b/tests/slate/test_slate_infrastructure.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/test_0init.py b/tests/test_0init.py index 372cc780ff..247e1c3fb1 100644 --- a/tests/test_0init.py +++ b/tests/test_0init.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * diff --git a/tests/test_tsfc_interface.py b/tests/test_tsfc_interface.py index b9d4156803..abe82d1462 100644 --- a/tests/test_tsfc_interface.py +++ b/tests/test_tsfc_interface.py @@ -1,4 +1,3 @@ -from __future__ import absolute_import, print_function, division import pytest from firedrake import * import os diff --git a/versioneer.py b/versioneer.py index 0120a65043..01699a035c 100644 --- a/versioneer.py +++ b/versioneer.py @@ -348,7 +348,6 @@ """ -from __future__ import absolute_import, print_function, division try: import configparser except ImportError: From 49193262e0dafe904cf599c41cf674eaf1d199cc Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 17:25:55 +0100 Subject: [PATCH 43/62] Defuturize firedrake-clean/firedrake-status --- scripts/firedrake-clean | 3 +-- scripts/firedrake-status | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/scripts/firedrake-clean b/scripts/firedrake-clean index 777ce8c863..025f0c39b0 100755 --- a/scripts/firedrake-clean +++ b/scripts/firedrake-clean @@ -1,6 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 -from __future__ import absolute_import, print_function, division from firedrake.tsfc_interface import clear_cache, TSFCKernel from pyop2.compilation import clear_cache as pyop2_clear_cache diff --git a/scripts/firedrake-status b/scripts/firedrake-status index 53cdfacdbb..47912065d2 100755 --- a/scripts/firedrake-status +++ b/scripts/firedrake-status @@ -1,5 +1,4 @@ -#! /usr/bin/env python -from __future__ import absolute_import, print_function, division +#! /usr/bin/env python3 from six import iteritems from argparse import ArgumentParser, RawDescriptionHelpFormatter From fb4ea4f97cfd30368b3dad7779d2a80c8b9973cc Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 17:29:07 +0100 Subject: [PATCH 44/62] py3ise firedrake-zenodo --- scripts/firedrake-zenodo | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/scripts/firedrake-zenodo b/scripts/firedrake-zenodo index b7bf140bec..a43bf20264 100755 --- a/scripts/firedrake-zenodo +++ b/scripts/firedrake-zenodo @@ -1,5 +1,4 @@ -#! /usr/bin/env python -from __future__ import absolute_import, print_function, division +#! /usr/bin/env python3 import logging import sys import os @@ -8,7 +7,8 @@ from argparse import ArgumentParser, RawDescriptionHelpFormatter from collections import OrderedDict import json import time -from urllib2 import urlopen, HTTPError +from urllib.request import urlopen +from urllib.error import HTTPError descriptions = OrderedDict([ @@ -35,7 +35,7 @@ projects = dict( ("petsc", "firedrakeproject"), ("petsc4py", "firedrakeproject")]) -components = descriptions.keys() +components = list(descriptions.keys()) optional_components = ("SLOPE",) @@ -111,9 +111,9 @@ except KeyError: def check_call(arguments): if args.log: try: - log.debug(subprocess.check_output(arguments, stderr=subprocess.STDOUT)) + log.debug(subprocess.check_output(arguments, stderr=subprocess.STDOUT).decode()) except subprocess.CalledProcessError as e: - log.debug(e.output) + log.debug(e.output.decode()) raise else: subprocess.check_call(arguments) @@ -121,9 +121,9 @@ def check_call(arguments): def check_output(args): try: - return subprocess.check_output(args, stderr=subprocess.STDOUT) + return subprocess.check_output(args, stderr=subprocess.STDOUT).decode() except subprocess.CalledProcessError as e: - log.debug(e.output) + log.debug(e.output.decode()) raise From a0c8f7b65c2f3ba96cf67b2731bf6b47bd9e1369 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 17:34:57 +0100 Subject: [PATCH 45/62] Add --honour-petsc-dir to firedrake-zenodo --- scripts/firedrake-zenodo | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/firedrake-zenodo b/scripts/firedrake-zenodo index a43bf20264..2328e62835 100755 --- a/scripts/firedrake-zenodo +++ b/scripts/firedrake-zenodo @@ -71,6 +71,9 @@ group.add_argument("--bibtex-file", action="store", nargs=1, default=["firedrake help="Output to the named bibtex file rather than firedrake-zenodo.bib") parser.add_argument("--message", "-m", action="store", nargs=1, help="Short description of the reason for this release. E.g. Version of Firedrake used in .") +parser.add_argument("--honour-petsc-dir", action="store_true", + help="Does your firedrake use a self-built PETSc?") + for component in components: parser.add_argument("--%s" % component, action="store", nargs=1, help="Use this git hash for %s instead of that in the file or the checked out version." @@ -144,8 +147,12 @@ def collect_repo_shas(): log.warning("Failed to retrieve git hash for optional " "component '%s', continuing without it" % component) else: - log.error("Failed to retrieve git hash for %s" % component) - raise + if component == "petsc" and args.honour_petsc_dir: + log.warning("Cannot retrieve git hash for PETSc, if you want a release " + "you will have to provide it manually") + else: + log.error("Failed to retrieve git hash for %s" % component) + raise return shas From 4bbc09268ccb40dc93b1554a7239e3cc544447e0 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 17:57:13 +0100 Subject: [PATCH 46/62] Desix all modules --- firedrake/assemble_expressions.py | 4 +--- firedrake/bcs.py | 1 - firedrake/expression.py | 4 +--- firedrake/function.py | 1 - firedrake/functionspace.py | 2 -- firedrake/functionspacedata.py | 5 +---- firedrake/interpolation.py | 5 ++--- firedrake/matrix.py | 3 +-- firedrake/matrix_free/preconditioners.py | 4 +--- firedrake/mesh.py | 11 ++++------- firedrake/mg/utils.py | 5 +---- firedrake/parameters.py | 4 +--- firedrake/plot.py | 1 - firedrake/pointquery_utils.py | 2 -- firedrake/slate/slac/compiler.py | 2 -- firedrake/slate/slac/tsfc_driver.py | 4 +--- firedrake/slate/slate.py | 6 ++---- firedrake/slope_limiter/limiter.py | 3 +-- firedrake/solving.py | 6 ++---- firedrake/solving_utils.py | 9 ++++----- firedrake/tsfc_interface.py | 6 +++--- 21 files changed, 26 insertions(+), 62 deletions(-) diff --git a/firedrake/assemble_expressions.py b/firedrake/assemble_expressions.py index 1835a579ff..18eb0eaa53 100644 --- a/firedrake/assemble_expressions.py +++ b/firedrake/assemble_expressions.py @@ -1,5 +1,3 @@ -from six import iteritems -from six.moves import map, zip import weakref import ufl @@ -45,7 +43,7 @@ def _ast(expr): try: return expr.ast except AttributeError: - for t, f in iteritems(_ast_map): + for t, f in _ast_map.items(): if isinstance(expr, t): return f(expr) raise TypeError("No ast handler for %s" % str(type(expr))) diff --git a/firedrake/bcs.py b/firedrake/bcs.py index b1439a1967..36caeaccc4 100644 --- a/firedrake/bcs.py +++ b/firedrake/bcs.py @@ -1,5 +1,4 @@ # A module implementing strong (Dirichlet) boundary conditions. -from six.moves import map, range import numpy as np from ufl import as_ufl, SpatialCoordinate, UFLException from ufl.algorithms.analysis import has_type diff --git a/firedrake/expression.py b/firedrake/expression.py index 77ec01f4b0..d0fd7f80ba 100644 --- a/firedrake/expression.py +++ b/firedrake/expression.py @@ -1,5 +1,3 @@ -from six import iteritems - import numpy as np import collections import ufl @@ -156,7 +154,7 @@ def __init__(self, code=None, element=None, cell=None, degree=None, **kwargs): # want every Expression to have all the properties of all # Expressions. cls = type(self.__class__.__name__, (self.__class__, ), {}) - for slot, val in iteritems(kwargs): + for slot, val in kwargs.items(): # Save the argument for later reconstruction self._kwargs[slot] = val # Scalar arguments have to be treated specially diff --git a/firedrake/function.py b/firedrake/function.py index 02782959da..bba65b4514 100644 --- a/firedrake/function.py +++ b/firedrake/function.py @@ -1,4 +1,3 @@ -from six.moves import range, zip import numpy as np import sys import ufl diff --git a/firedrake/functionspace.py b/firedrake/functionspace.py index 7932c04a30..e237364c31 100644 --- a/firedrake/functionspace.py +++ b/firedrake/functionspace.py @@ -4,8 +4,6 @@ API is functional, rather than object-based, to allow for simple backwards-compatibility, argument checking, and dispatch. """ -from six.moves import range - import ufl from pyop2.utils import flatten diff --git a/firedrake/functionspacedata.py b/firedrake/functionspacedata.py index b44c4d13f3..1e10be8683 100644 --- a/firedrake/functionspacedata.py +++ b/firedrake/functionspacedata.py @@ -14,9 +14,6 @@ vs VectorElement) can share the PyOP2 Set and Map data. """ -from six.moves import map, range -from six import iteritems - import numpy import finat from decorator import decorator @@ -542,7 +539,7 @@ def get_map(self, V, entity_set, map_arity, bcs, name, offset, parent, if kind == "interior_facet" and self.bt_masks is not None: bt_masks = {} off = map_arity // 2 - for method, (bottom, top) in iteritems(self.bt_masks): + for method, (bottom, top) in self.bt_masks.items(): b = [] t = [] for i in bottom: diff --git a/firedrake/interpolation.py b/firedrake/interpolation.py index 831f6e6286..5762706a24 100644 --- a/firedrake/interpolation.py +++ b/firedrake/interpolation.py @@ -1,5 +1,3 @@ -from six import iterkeys - import numpy from functools import partial @@ -148,7 +146,8 @@ def _interpolator(V, dat, expr, subset): if not isinstance(dual, FIAT.functional.PointEvaluation): raise NotImplementedError("Can only interpolate onto point " "evaluation operators. Try projecting instead") - to_pts.append(list(iterkeys(dual.pt_dict))[0]) + pts, = dual.pt_dict.keys() + to_pts.append(pts) if len(expr.ufl_shape) != len(V.ufl_element().value_shape()): raise RuntimeError('Rank mismatch: Expression rank %d, FunctionSpace rank %d' diff --git a/firedrake/matrix.py b/firedrake/matrix.py index ffb999d9b0..beafee6dd9 100644 --- a/firedrake/matrix.py +++ b/firedrake/matrix.py @@ -1,4 +1,3 @@ -from six import with_metaclass import copy import abc @@ -8,7 +7,7 @@ from firedrake.petsc import PETSc -class MatrixBase(with_metaclass(abc.ABCMeta)): +class MatrixBase(object, metaclass=abc.ABCMeta): """A representation of the linear operator associated with a bilinear form and bcs. Explicitly assembled matrices and matrix-free matrix classes will derive from this diff --git a/firedrake/matrix_free/preconditioners.py b/firedrake/matrix_free/preconditioners.py index 0210ed97e6..4023974d70 100644 --- a/firedrake/matrix_free/preconditioners.py +++ b/firedrake/matrix_free/preconditioners.py @@ -1,5 +1,3 @@ -from six import with_metaclass - import abc from firedrake.citations import Citations @@ -8,7 +6,7 @@ __all__ = ("AssembledPC", "MassInvPC", "PCDPC", "PCBase") -class PCBase(with_metaclass(abc.ABCMeta)): +class PCBase(object, metaclass=abc.ABCMeta): def __init__(self): """Create a PC context suitable for PETSc. diff --git a/firedrake/mesh.py b/firedrake/mesh.py index 5959627e72..63e6c06ba2 100644 --- a/firedrake/mesh.py +++ b/firedrake/mesh.py @@ -1,6 +1,3 @@ -from six import iteritems, itervalues -from six.moves import map, range - import numpy as np import ctypes import os @@ -839,7 +836,7 @@ def make_dofs_per_plex_entity(self, entity_dofs): :arg entity_dofs: FInAT element entity DoFs """ dofs_per_entity = [0] * (1 + self._base_mesh.cell_dimension()) - for (b, v), entities in iteritems(entity_dofs): + for (b, v), entities in entity_dofs.items(): dofs_per_entity[b] += (self.layers - v) * len(entities[0]) return dofs_per_entity @@ -851,12 +848,12 @@ def make_offset(self, entity_dofs, ndofs): :arg ndofs: number of DoFs in the FInAT element """ entity_offset = [0] * (1 + self._base_mesh.cell_dimension()) - for (b, v), entities in iteritems(entity_dofs): + for (b, v), entities in entity_dofs.items(): entity_offset[b] += len(entities[0]) dof_offset = np.zeros(ndofs, dtype=IntType) - for (b, v), entities in iteritems(entity_dofs): - for dof_indices in itervalues(entities): + for (b, v), entities in entity_dofs.items(): + for dof_indices in entities.values(): for i in dof_indices: dof_offset[i] = entity_offset[b] return dof_offset diff --git a/firedrake/mg/utils.py b/firedrake/mg/utils.py index 01f954ba68..ac4209a667 100644 --- a/firedrake/mg/utils.py +++ b/firedrake/mg/utils.py @@ -1,6 +1,3 @@ -from six import iteritems -from six.moves import range, map, zip - from itertools import permutations import numpy as np @@ -195,7 +192,7 @@ def apply_transform(T, v): pt = node.get_point_dict() assert len(pt.keys()) == 1 nodes.append(np.asarray(next(iter(pt.keys())), dtype=float)) - for perm, transform in iteritems(transforms): + for perm, transform in transforms.items(): p = -np.ones(len(functionals), dtype=PETSc.IntType) new_nodes = [apply_transform(transform, node) for node in nodes] for i, node in enumerate(new_nodes): diff --git a/firedrake/parameters.py b/firedrake/parameters.py index 9cf066b487..51b1870102 100644 --- a/firedrake/parameters.py +++ b/firedrake/parameters.py @@ -1,6 +1,4 @@ """The parameters dictionary contains global parameter settings.""" -from six import iteritems - from coffee import coffee_reconfigure from pyop2.configuration import configuration from tsfc import default_parameters @@ -16,7 +14,7 @@ def __init__(self, name=None, **kwargs): self._name = name self._update_function = None - for key, value in iteritems(kwargs): + for key, value in kwargs.items(): self.add(key, value) def add(self, key, value=None): diff --git a/firedrake/plot.py b/firedrake/plot.py index 786fc18e76..da22f1e09a 100644 --- a/firedrake/plot.py +++ b/firedrake/plot.py @@ -1,4 +1,3 @@ -from six.moves import range, zip import numpy as np from ufl import Cell from tsfc.fiatinterface import create_element diff --git a/firedrake/pointquery_utils.py b/firedrake/pointquery_utils.py index d30adc8cbc..84f2a1f903 100644 --- a/firedrake/pointquery_utils.py +++ b/firedrake/pointquery_utils.py @@ -1,5 +1,3 @@ -from six.moves import range - from os import path import numpy import sympy diff --git a/firedrake/slate/slac/compiler.py b/firedrake/slate/slac/compiler.py index 7c0fafea97..7d775b3c64 100644 --- a/firedrake/slate/slac/compiler.py +++ b/firedrake/slate/slac/compiler.py @@ -14,8 +14,6 @@ all low-level numerical linear algebra operations are performed using this templated function library. """ -from six.moves import range - from coffee import base as ast from collections import OrderedDict diff --git a/firedrake/slate/slac/tsfc_driver.py b/firedrake/slate/slac/tsfc_driver.py index 9a45086dd1..ac9cb85bee 100644 --- a/firedrake/slate/slac/tsfc_driver.py +++ b/firedrake/slate/slac/tsfc_driver.py @@ -1,5 +1,3 @@ -from six import iteritems - import collections from functools import partial @@ -47,7 +45,7 @@ def compile_terminal_form(tensor, prefix=None, tsfc_parameters=None): transformed_integrals = transform_integrals(integrals) cxt_kernels = [] - for orig_it_type, integrals in iteritems(transformed_integrals): + for orig_it_type, integrals in transformed_integrals.items(): subkernel_prefix = prefix + "%s_to_" % orig_it_type kernels = tsfc_compile(Form(integrals), subkernel_prefix, diff --git a/firedrake/slate/slate.py b/firedrake/slate/slate.py index e3b84f247c..94af3f3bd4 100644 --- a/firedrake/slate/slate.py +++ b/firedrake/slate/slate.py @@ -14,8 +14,6 @@ compiler, which interprets expressions and produces C++ kernel functions to be executed within the Firedrake architecture. """ -from six import with_metaclass, iteritems - from abc import ABCMeta, abstractproperty, abstractmethod from collections import OrderedDict @@ -45,7 +43,7 @@ def negative_restrictions(self, o): raise ValueError("Must contain only positive restrictions!") -class TensorBase(with_metaclass(ABCMeta)): +class TensorBase(object, metaclass=ABCMeta): """An abstract Slate node class. .. warning:: @@ -328,7 +326,7 @@ def subdomain_data(self): for op in self.operands: op_sd = op.subdomain_data()[op.ufl_domain()] - for it_type, domain in iteritems(op_sd): + for it_type, domain in op_sd.items(): if it_type not in sd: sd[it_type] = domain diff --git a/firedrake/slope_limiter/limiter.py b/firedrake/slope_limiter/limiter.py index 03d5abedec..f4904136a8 100644 --- a/firedrake/slope_limiter/limiter.py +++ b/firedrake/slope_limiter/limiter.py @@ -1,10 +1,9 @@ -from six import with_metaclass from abc import ABCMeta, abstractmethod __all__ = ("Limiter",) -class Limiter(with_metaclass(ABCMeta)): +class Limiter(object, metaclass=ABCMeta): @abstractmethod def __init__(self, space): diff --git a/firedrake/solving.py b/firedrake/solving.py index 88f5436a93..ec97ea3f0c 100644 --- a/firedrake/solving.py +++ b/firedrake/solving.py @@ -17,8 +17,6 @@ # You should have received a copy of the GNU Lesser General Public License # along with DOLFIN. If not, see . -from six import iterkeys - __all__ = ["solve"] import ufl @@ -232,7 +230,7 @@ def _extract_linear_solver_args(*args, **kwargs): if len(args) != 3: raise RuntimeError("Missing required arguments, expecting solve(A, x, b, **kwargs)") - for kwarg in iterkeys(kwargs): + for kwarg in kwargs.keys(): if kwarg not in valid_kwargs: raise RuntimeError("Illegal keyword argument '%s'; valid keywords are %s" % (kwarg, ", ".join("'%s'" % kw for kw in valid_kwargs))) @@ -258,7 +256,7 @@ def _extract_args(*args, **kwargs): if "nest" in kwargs: raise DeprecationWarning("The 'nest' argument is deprecated, please set 'mat_type' in the solver parameters") - for kwarg in iterkeys(kwargs): + for kwarg in kwargs.keys(): if kwarg not in valid_kwargs: raise RuntimeError("Illegal keyword argument '%s'; valid keywords \ are %s" % (kwarg, ", ".join("'%s'" % kwarg diff --git a/firedrake/solving_utils.py b/firedrake/solving_utils.py index 45803fe037..2a07ee04e1 100644 --- a/firedrake/solving_utils.py +++ b/firedrake/solving_utils.py @@ -1,4 +1,3 @@ -from six import iteritems import numpy import itertools from contextlib import contextmanager @@ -44,7 +43,7 @@ def flatten(parameters, *prefixes): sentinel = object() try: option = sentinel - for option, value in iteritems(parameters): + for option, value in parameters.items(): # Recurse into values to flatten any dicts. for pair in flatten(value, option, *prefixes): yield pair @@ -137,14 +136,14 @@ def __init__(self, parameters, options_prefix): self.options_prefix = options_prefix # Remove those options from the dict that were passed on # the commandline. - self.parameters = {k: v for k, v in iteritems(parameters) + self.parameters = {k: v for k, v in parameters.items() if options_prefix + k not in self.commandline_options} self.to_delete = set(self.parameters) # Now update parameters from options, so that they're # available to solver setup (for, e.g., matrix-free). # Can't ask for the prefixed guy in the options object, # since that does not DTRT for flag options. - for k, v in iteritems(self.options_object.getAll()): + for k, v in self.options_object.getAll().items(): if k.startswith(self.options_prefix): self.parameters[k[len(self.options_prefix):]] = v self._setfromoptions = False @@ -185,7 +184,7 @@ def inserted_options(self): """Context manager inside which the petsc options database contains the parameters from this object.""" try: - for k, v in iteritems(self.parameters): + for k, v in self.parameters.items(): key = self.options_prefix + k if type(v) is bool: if v: diff --git a/firedrake/tsfc_interface.py b/firedrake/tsfc_interface.py index 9519ba03b5..7bd2dc4139 100644 --- a/firedrake/tsfc_interface.py +++ b/firedrake/tsfc_interface.py @@ -1,6 +1,6 @@ """Provides the interface to TSFC for compiling a form, and transforms the TSFC- generated code in order to make it suitable for passing to the backends.""" -from six.moves import cPickle +import pickle from hashlib import md5 from os import path, environ, getuid, makedirs @@ -70,7 +70,7 @@ def _read_from_disk(cls, key, comm): if val is None: raise KeyError("Object with key %s not found" % key) - val = cPickle.loads(val) + val = pickle.loads(val) cls._cache[key] = val return val @@ -85,7 +85,7 @@ def _cache_store(cls, key, val): # No need for a barrier after this, since non root # processes will never race on this file. with gzip.open(tempfile, 'wb') as f: - cPickle.dump(val, f, 0) + pickle.dump(val, f, 0) os.rename(tempfile, filepath) comm.barrier() From d62c6d4f68e8bdf61d2e6fd48fc63741c722f00f Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 18:08:49 +0100 Subject: [PATCH 47/62] install: Remove get-pip.py after use --- scripts/firedrake-install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 28cb882494..f9fdea8a94 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -964,6 +964,8 @@ if mode == "install": urllib.request.urlretrieve("https://bootstrap.pypa.io/get-pip.py", filename="get-pip.py") check_call(python + ["get-pip.py"]) log.debug("bootstrapping pip succeeded") + log.debug("Removing get-pip.py") + os.remove("get-pip.py") # Ensure pip and setuptools are at the latest version. run_pip(["install", "-U", "setuptools"]) run_pip(["install", "-U", "pip"]) From 583a55aff4c1e599cac4e3fab96b6c72f38b0069 Mon Sep 17 00:00:00 2001 From: David Ham Date: Wed, 26 Jul 2017 18:29:43 +0100 Subject: [PATCH 48/62] Python 3 install instructions and webpage fixes --- docs/source/download.rst | 155 ++++----------------------------------- docs/source/team.py | 15 ++-- 2 files changed, 22 insertions(+), 148 deletions(-) diff --git a/docs/source/download.rst b/docs/source/download.rst index e7342a785d..483fb8c974 100644 --- a/docs/source/download.rst +++ b/docs/source/download.rst @@ -4,13 +4,13 @@ Obtaining Firedrake The simplest way to install Firedrake is to use our install script:: curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install - python firedrake-install + python3 firedrake-install Running ``firedrake-install`` with no arguments will install firedrake in -a python virtualenv_ created in a ``firedrake`` subdirectory of the +a python venv_ created in a ``firedrake`` subdirectory of the current directory. Run:: - python firedrake-install --help + python3 firedrake-install --help for a full list of install options, including system-wide installs and installation in developer mode. In particular, you may @@ -19,8 +19,8 @@ set the environment variable ``PETSC_CONFIGURE_OPTIONS`` before running ``firedrake-install``. You can see the set of options passed to PETSc by providing the flag ``--show-petsc-configure-options``. -If you install in virtualenv_ mode, you will need to activate the -virtualenv in each shell from which you use Firedrake:: +You will need to activate the virtualenv in each shell from which you +use Firedrake:: source firedrake/bin/activate @@ -60,17 +60,18 @@ may stop to ask you to install some dependency packages. Installation on other Unix platforms may work but is untested. Installation on Windows is very unlikely to work. -Supported python distributions +Supported Python distributions ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -On Ubuntu, the system installed python 2.7 is supported and tested. -On Mac OS, the homebrew_ installed python 2.7 is supported and tested. +Firedrake requires Python 3.5 or later. + +On Ubuntu (16.04 or later), the system installed Python 3 is supported and tested. +On Mac OS, the homebrew_ installed Python 3 is supported and tested. .. warning:: The installation script *does not work* with anaconda_ based python - installations, because it uses virtualenvs which anaconda does not - support. + installations. This is due to venv issues in anaconda. Upgrade ------- @@ -81,7 +82,7 @@ Firedrake and all its dependencies. .. note:: - You should activate the virtualenv_ before running + You should activate the venv_ before running `firedrake-update`. @@ -113,126 +114,9 @@ Paraview_. On Ubuntu and similar systems, you can obtain Paraview by installing the ``paraview`` package. On Mac OS, the easiest approach is to download a binary from the `paraview website `_. -Installing from individual components -===================================== - -.. warning:: - - Installation from individual components is an unsupported route. If - you tried the installation script and it failed, please let us know - by filing a `bug report - `__, we - *absolutely* want to fix it. This section of the documentation - provides a bare-bones description of the required dependencies. - -Firedrake itself is a Python package available on `github -`__, however, you will -need a number of additional libraries to use it. - -Mac OS ------- - -We list here the required homebrew_ packages: - -- openmpi (or mpich) -- python -- autoconf -- automake -- libtool -- cmake -- glpk (science tap) - -Ubuntu ------- - -On Ubuntu, the following apt packages are required: - -- build-essential -- autoconf -- automake -- cmake -- gfortran -- git-core -- glpk-utils -- libblas-dev -- liblapack-dev -- libopenmpi-dev -- libtool -- mercurial -- openmpi-bin -- python-dev -- python-pip - -Common dependencies -------------------- - -PETSc -~~~~~ - -We maintain branches of PETSc_ and petsc4py_ that are known to work -with Firedrake. Use the ``firedrake`` branch for both: - -- https://github.com/firedrakeproject/petsc -- https://github.com/firedrakeproject/petsc4py - -PETSc must be built with (at least) support for: - -- HDF5 -- CHACO -- Triangle -- Ctetgen - -We also recommend that you build PETSc with shared libraries. - -h5py -~~~~ - -Firedrake uses h5py_ to write checkpoint files. It is critical that -h5py_ is linked against the same version of the HDF5 library that -PETSc was built with. This is unfortunately not possible to specify -when using ``pip``. Instead, please follow the instructions for a -`custom installation`_. If PETSc was linked against a system HDF5 -library, use that library when building h5py. If the PETSc -installation was used to build HDF5 (via ``--download-hdf5``) then the -appropriate HDF5 library is in the PETSc install directory. If -installed with ``pip``, this can be obtained using:: - - python -c "import petsc; print petsc.get_petsc_dir()" - -Otherwise, use the appropriate values of ``PETSC_DIR`` and ``PETSC_ARCH``. - -.. note:: - - It is not necessary that h5py be built with MPI support, although - Firedrake supports both options. - -libspatialindex -~~~~~~~~~~~~~~~ - -libspatialindex_ is utilised during point evaluations. Since we need a -recent version, the system provided package is unlikely to work. This -version is known to work with Firedrake: - -- https://github.com/firedrakeproject/libspatialindex - -Firedrake will find libspatialindex installations in ``sys.prefix`` -and in the standard paths. - -Further dependencies -~~~~~~~~~~~~~~~~~~~~ - -Firedrake depends on the Python packages PyOP2_, FInAT_, TSFC_, FIAT_ and UFL_. - -Optional dependencies -~~~~~~~~~~~~~~~~~~~~~ - -For performance reasons, certain operations are cached within Firedrake. -To support this, you will need to install the python package: - -- cachetools Documentation dependencies -~~~~~~~~~~~~~~~~~~~~~~~~~~ +-------------------------- Building the documention requires Sphinx_ (including the Youtube and Bibtex plugins) and wget_. In addition the Sphinx Youtube and bibtex @@ -241,20 +125,9 @@ plugins are required. The former is available from the `__, the latter is the python package ``sphinxcontrib-bibtex``. -.. _petsc4py: https://github.com/firedrakeproject/petsc4py -.. _PETSc: http://www.mcs.anl.gov/petsc/ -.. _PyOP2: http://op2.github.io/PyOP2 -.. _FInAT: https://github.com/FInAT/FInAT -.. _TSFC: https://github.com/firedrakeproject/tsfc -.. _FIAT: https://github.com/firedrakeproject/fiat -.. _UFL: https://github.com/firedrakeproject/ufl .. _Paraview: http://www.paraview.org .. _Sphinx: http://www.sphinx-doc.org/ .. _wget: http://www.gnu.org/software/wget/ -.. _virtualenv: https://virtualenv.pypa.io/ -.. _pytest: http://pytest.org/latest/ -.. _libspatialindex: https://libspatialindex.github.io/ -.. _h5py: http://www.h5py.org/ -.. _custom installation: http://docs.h5py.org/en/latest/build.html#custom-installation +.. _venv: https://docs.python.org/3/tutorial/venv.html .. _homebrew: https://brew.sh/ .. _anaconda: https://www.continuum.io/downloads diff --git a/docs/source/team.py b/docs/source/team.py index 43045de2cf..341bbd52e1 100644 --- a/docs/source/team.py +++ b/docs/source/team.py @@ -33,7 +33,7 @@ def separator(n): def blank(n): out.write((" " * coldashes).join("|" * (n + 1)) + "\n") -out = file("teamgrid.rst", "w") +out = open("teamgrid.rst", "w") out.write("..\n This file is generated by team.py. DO NOT EDIT DIRECTLY\n") @@ -41,12 +41,13 @@ def blank(n): images = [] names = [] + def imagename(name): - puny = name.split()[0].lower().decode("utf-8").encode("punycode") + puny = name.split()[0].lower().encode("punycode").decode() return puny[:-1] if puny[-1]=="-" else puny # Write substitution rules for member images. -for member, url in team.iteritems(): +for member, url in team.items(): out.write(".. |" + member + "| image:: /images/" + imagename(member) + ".*\n") out.write(" :width: 70%\n") @@ -54,21 +55,21 @@ def imagename(name): out.write(".. _" + member + ": " + url + "\n") im = " |" + member + "|" - images.append(im + " " * (coldashes - len(im.decode("utf-8")))) + images.append(im + " " * (coldashes - len(im))) nm = " `" + member + "`_" - names.append(nm + " " * (coldashes - len(nm.decode("utf-8")))) + names.append(nm + " " * (coldashes - len(nm))) out.write("\n\n") separator(cols) -members = iter(zip(images, names)) +members = zip(images, names) try: while True: irow = "|" nrow = "|" for c in range(cols): - image, name = members.next() + image, name = next(members) irow += image + "|" nrow += name + "|" From 2398bd144ab3a38d6ea48941730ae691ebd324e8 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Wed, 26 Jul 2017 16:13:31 +0100 Subject: [PATCH 49/62] jenkins: Work around shebang line length limits execve(2) says: A maximum line length of 127 characters is allowed for the first line in an interpreter scripts. Jenkins runs the test suite in a very deep directory hierarchy. The installation of pip and pytest puts binaries in PATH with a shebang line that is therefore longer than this limit. As a result, the interpreter fails to execute them. To fix this, just run as "python -m xxx ...", rather than "xxx ...". --- tests/conftest.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index c2dc3badad..7067149520 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -21,8 +21,8 @@ def parallel(item): # Only spew tracebacks on rank 0. # Run xfailing tests to ensure that errors are reported to calling process - call = ["mpiexec", "-n", "1", "py.test", "--runxfail", "-s", "-q", "%s::%s" % (item.fspath, item.name)] - call.extend([":", "-n", "%d" % (nprocs - 1), "py.test", "--runxfail", "--tb=no", "-q", + call = ["mpiexec", "-n", "1", "python", "-m", "pytest", "--runxfail", "-s", "-q", "%s::%s" % (item.fspath, item.name)] + call.extend([":", "-n", "%d" % (nprocs - 1), "python", "-m", "pytest", "--runxfail", "--tb=no", "-q", "%s::%s" % (item.fspath, item.name)]) check_call(call) From f3cc1d88750e6a7302d17b9b87a1d03a609b3bd3 Mon Sep 17 00:00:00 2001 From: David Ham Date: Thu, 27 Jul 2017 10:37:49 +0100 Subject: [PATCH 50/62] Documentation fixes --- docs/source/download.rst | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/source/download.rst b/docs/source/download.rst index 483fb8c974..efbbd355d3 100644 --- a/docs/source/download.rst +++ b/docs/source/download.rst @@ -1,7 +1,7 @@ Obtaining Firedrake =================== -The simplest way to install Firedrake is to use our install script:: +Firedrake is installed using its install script:: curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install python3 firedrake-install @@ -12,8 +12,7 @@ current directory. Run:: python3 firedrake-install --help -for a full list of install options, including system-wide -installs and installation in developer mode. In particular, you may +for a full list of install options. In particular, you may wish to customise the set of options used to build PETSc. To do so, set the environment variable ``PETSC_CONFIGURE_OPTIONS`` before running ``firedrake-install``. You can see the set of options passed From 4aa19751987e67c700dfc3ee7a7d85a223c09bb8 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 27 Jul 2017 11:10:07 +0100 Subject: [PATCH 51/62] xfail app import tests for now Gusto and Thetis are not yet py3 compatible. --- tests/regression/test_import_applications.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/regression/test_import_applications.py b/tests/regression/test_import_applications.py index bbb06cd262..b8f5f3e351 100644 --- a/tests/regression/test_import_applications.py +++ b/tests/regression/test_import_applications.py @@ -10,6 +10,7 @@ def app(request): @pytest.mark.skipif("FIREDRAKE_CI_TESTS" not in os.environ, reason="Not running in CI") +@pytest.mark.xfail(reason="Gusto/Thetis not yet python 3 compatible") def test_import_app(app): # Have to run this in a subprocess in case the import pollutes the # test environment, e.g. by modifying firedrake parameters. From 6c2851d98334d5cecdca1eee5a3c3b455f8533d6 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 27 Jul 2017 14:11:20 +0100 Subject: [PATCH 52/62] install: Make libadjoint find the right python --- scripts/firedrake-install | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index f9fdea8a94..0248354db2 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -759,7 +759,8 @@ def build_and_install_adjoint(): dir_util.mkpath("build") with directory("build"): log.info("Configuring libadjoint for venv installation in %s" % os.environ["VIRTUAL_ENV"]) - check_call(["cmake", "-DCMAKE_INSTALL_PREFIX=%s" % os.environ["VIRTUAL_ENV"], ".."], env=env) + check_call(["cmake", "-DCMAKE_INSTALL_PREFIX=%s" % os.environ["VIRTUAL_ENV"], + "-DPYTHON_EXECUTABLE=%s/bin/python3" % os.environ["VIRTUAL_ENV"], ".."], env=env) log.info("Installing libadjoint.") check_call(["make", "install"]) From 738d7d0bf58fa6207d5645a42f022790c215c3e4 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 27 Jul 2017 16:15:39 +0100 Subject: [PATCH 53/62] Remove singledispatch and six requirements --- firedrake/mg/ufl_utils.py | 2 +- requirements-ext.txt | 2 -- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/firedrake/mg/ufl_utils.py b/firedrake/mg/ufl_utils.py index a2d5407910..d6a1663871 100644 --- a/firedrake/mg/ufl_utils.py +++ b/firedrake/mg/ufl_utils.py @@ -3,7 +3,7 @@ from ufl.corealg.map_dag import map_expr_dag from ufl.algorithms.multifunction import MultiFunction -from singledispatch import singledispatch +from functools import singledispatch import firedrake from firedrake.petsc import PETSc diff --git a/requirements-ext.txt b/requirements-ext.txt index 92413d9681..4260162c20 100644 --- a/requirements-ext.txt +++ b/requirements-ext.txt @@ -1,7 +1,5 @@ -six sympy cachetools -singledispatch pytest pytest-xdist pytest-benchmark From eed616c90f896680ec3f6b01d1de41bf2820937d Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Thu, 27 Jul 2017 16:16:59 +0100 Subject: [PATCH 54/62] Add better version-checking for upgrade path --- scripts/firedrake-install | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 0248354db2..780046b393 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -33,10 +33,6 @@ class InstallError(Exception): pass -if sys.version_info < (3, 5): - raise InstallError("Firedrake requires Python 3, at least version 3.5") - - class FiredrakeConfiguration(dict): """A dictionary extended to facilitate the storage of Firedrake configuration information.""" @@ -222,6 +218,19 @@ where shortname is one of the names given below: print(help_string) sys.exit(0) +if sys.version_info < (3, 5): + if mode == "install": + quit("""\nInstalling Firedrake requires Python 3, at least version 3.5. +You should run firedrake-install with python3.""") + if mode == "update": + if not args.update_script: + # Existing install trying to update past the py2/py3 barrier + quit("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. +Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") + else: + # Accidentally (?) running firedrake-update with python2. + quit("""\nfiredrake-update must be run with Python 3, did you accidentally use Python 2?""") + # Set up logging # Log to file at DEBUG level logging.basicConfig(level=logging.DEBUG, From 4aa3531f1f3010f70d7b1499fc5c4a1b1981bc4c Mon Sep 17 00:00:00 2001 From: Miklos Homolya Date: Thu, 27 Jul 2017 18:50:10 +0100 Subject: [PATCH 55/62] fix one more print statement --- .../linear_fluid_structure_interaction.py.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst b/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst index 6e08a8c3aa..0e4f41a91e 100644 --- a/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst +++ b/demos/linear_fluid_structure_interaction/linear_fluid_structure_interaction.py.rst @@ -278,7 +278,7 @@ In the end, we proceed with the actual computation loop:: while t <= t_end + dt: t += dt - print 'time = ', t * T + print('time = ', t * T) # symplectic Euler scheme LVS_phi_f.solve() LVS_U_phi.solve() From 11b5a0d34e50c7e235bf2eeba10cf9edf181d8bc Mon Sep 17 00:00:00 2001 From: David Ham Date: Fri, 28 Jul 2017 11:36:52 +0100 Subject: [PATCH 56/62] Unified cache setup --- firedrake/__init__.py | 4 ++++ firedrake_configuration/__init__.py | 8 ++++++++ scripts/firedrake-install | 31 +++++++++++++++++++---------- 3 files changed, 32 insertions(+), 11 deletions(-) diff --git a/firedrake/__init__.py b/firedrake/__init__.py index 7fdcf73da5..33d8c92420 100644 --- a/firedrake/__init__.py +++ b/firedrake/__init__.py @@ -22,6 +22,10 @@ pass del ufl from ufl import * +# Set up the cache directories before importing PyOP2. +import firedrake_configuration +firedrake_configuration.setup_cache_dirs() + from pyop2 import op2 # noqa from pyop2.mpi import COMM_WORLD, COMM_SELF # noqa diff --git a/firedrake_configuration/__init__.py b/firedrake_configuration/__init__.py index 00d0bf2a33..b64b1b52e9 100644 --- a/firedrake_configuration/__init__.py +++ b/firedrake_configuration/__init__.py @@ -38,3 +38,11 @@ def get_config_json(): could be output by a Firedrake application to assist in the reproduction of results.""" return json.dumps(_config) + + +def setup_cache_dirs(): + config = get_config() + if "PYOP2_CACHE_DIR" not in os.environ: + os.environ["PYOP2_CACHE_DIR"] = os.path.join(config["options"]["cache_dir"], "pyop2") + if 'FIREDRAKE_TSFC_KERNEL_CACHE_DIR' not in os.environ: + os.environ["FIREDRAKE_TSFC_KERNEL_CACHE_DIR"] = os.path.join(config["options"]["cache_dir"], "tsfc") diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 780046b393..09c0a7a51a 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -55,7 +55,7 @@ class FiredrakeConfiguration(dict): "minimal_petsc", "mpicc", "disable_ssh", "show_petsc_configure_options", "adjoint", "slepc", "slope", "packages", "honour_pythonpath", - "petsc_int_type"] + "petsc_int_type", "cache_dir"] def deep_update(this, that): @@ -144,6 +144,9 @@ honoured.""", help="Additional packages to be installed. The address should be in format vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir . Some additional packages have shortcut install options for more information see --install_help.") parser.add_argument("--install-help", action="store_true", help="Provide information on packages which can be installed using shortcut names.") + parser.add_argument("--cache-dir", type=str, + action="store", + help="Directory to use for disk caches of compiled code (default is the .cache subdirectory of the Firedrake installation).") args = parser.parse_args() @@ -190,6 +193,9 @@ else: help="Additional packages to be installed. The address should be in format vcs+protocol://repo_url/#egg=pkg&subdirectory=pkg_dir. Some additional packages have shortcut install options for more information see --install_help.") parser.add_argument("--install_help", action="store_true", help="Provide information on packages which can be installed using shortcut names.") + parser.add_argument("--cache-dir", type=str, + action="store", default=config["options"].get("cache_dir", ""), + help="Directory to use for disk caches of compiled code (default is the .cache subdirectory of the Firedrake installation).") args = parser.parse_args() @@ -292,6 +298,10 @@ else: except KeyError: quit("Unable to retrieve venv name from the environment.\n Please ensure the venv is active before running firedrake-update.") +if "cache_dir" not in config["options"] or not config["options"]["cache_dir"]: + config["options"]["cache_dir"] = os.path.join(firedrake_env, ".cache") + + # venv install python = ["%s/bin/python" % firedrake_env] # Use the pip from the venv @@ -1125,9 +1135,18 @@ if options["adjoint"]: if options["slope"]: build_and_install_slope() +try: + import firedrake_configuration + firedrake_configuration.write_config(config) + log.info("Configuration saved to configuration.json") +except Exception as e: + log.warning("Unable to save configuration to a JSON file") + log.warning("Error Message:") + log.warning(e.message) if mode == "update": try: + firedrake_configuration.setup_cache_dirs() log.info("Clearing just in time compilation caches.") from firedrake.tsfc_interface import clear_cache, TSFCKernel from pyop2.compilation import clear_cache as pyop2_clear_cache @@ -1148,13 +1167,3 @@ log.info(" . %s/bin/activate\n" % firedrake_env) log.info("The venv can be deactivated by running:\n") log.info(" deactivate\n\n") log.info("To upgrade Firedrake activate the venv and run firedrake-update\n") - - -try: - import firedrake_configuration - firedrake_configuration.write_config(config) - log.info("Configuration saved to configuration.json") -except Exception as e: - log.info("Unable to save configuations to a JSON file") - log.info("Error Message:") - log.info(e.message) From feb1a6a3ff9d4bedef5d666788d6fd668f19ea14 Mon Sep 17 00:00:00 2001 From: David Ham Date: Fri, 28 Jul 2017 13:46:44 +0100 Subject: [PATCH 57/62] Also use the new cache locations in firedrake-clean --- scripts/firedrake-clean | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/firedrake-clean b/scripts/firedrake-clean index 025f0c39b0..23c842eeb2 100755 --- a/scripts/firedrake-clean +++ b/scripts/firedrake-clean @@ -1,5 +1,7 @@ #!/usr/bin/env python3 +import firedrake_configuration +firedrake_configuration.setup_cache_dirs() from firedrake.tsfc_interface import clear_cache, TSFCKernel from pyop2.compilation import clear_cache as pyop2_clear_cache From 9c18b2a4740ef9f92587a61c74fd6b1750b2a4eb Mon Sep 17 00:00:00 2001 From: David Ham Date: Fri, 28 Jul 2017 13:56:02 +0100 Subject: [PATCH 58/62] Safer test for upgrade trap --- scripts/firedrake-install | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 09c0a7a51a..03b3e316fc 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -229,7 +229,9 @@ if sys.version_info < (3, 5): quit("""\nInstalling Firedrake requires Python 3, at least version 3.5. You should run firedrake-install with python3.""") if mode == "update": - if not args.update_script: + if hasattr(sys, "real_prefix"): + # sys.real_prefix exists iff we are in an active virtualenv. + # # Existing install trying to update past the py2/py3 barrier quit("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") From a89087f625ac8e110ff8a00f21cec08946a53dd3 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 28 Jul 2017 14:01:43 +0100 Subject: [PATCH 59/62] Move version checks earlier --- scripts/firedrake-install | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 03b3e316fc..02967ffac3 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -28,6 +28,24 @@ firedrake_apps = { } +if sys.version_info < (3, 5): + if mode == "install": + print("""\nInstalling Firedrake requires Python 3, at least version 3.5. +You should run firedrake-install with python3.""") + if mode == "update": + if hasattr(sys, "real_prefix"): + # sys.real_prefix exists iff we are in an active virtualenv. + # + # Existing install trying to update past the py2/py3 barrier + print("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. +Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") + sys.exit(1) + else: + # Accidentally (?) running firedrake-update with python2. + print("""\nfiredrake-update must be run with Python 3, did you accidentally use Python 2?""") + sys.exit(1) + + class InstallError(Exception): # Exception for generic install problems. pass @@ -224,21 +242,6 @@ where shortname is one of the names given below: print(help_string) sys.exit(0) -if sys.version_info < (3, 5): - if mode == "install": - quit("""\nInstalling Firedrake requires Python 3, at least version 3.5. -You should run firedrake-install with python3.""") - if mode == "update": - if hasattr(sys, "real_prefix"): - # sys.real_prefix exists iff we are in an active virtualenv. - # - # Existing install trying to update past the py2/py3 barrier - quit("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. -Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") - else: - # Accidentally (?) running firedrake-update with python2. - quit("""\nfiredrake-update must be run with Python 3, did you accidentally use Python 2?""") - # Set up logging # Log to file at DEBUG level logging.basicConfig(level=logging.DEBUG, @@ -256,10 +259,6 @@ log = logging.getLogger() log.info("Running %s" % " ".join(sys.argv)) -# Python version idiot check as soon as logging is up -if sys.version_info.major != 3: - quit("Firedrake requires Python 3. firedrake-%s was run with Python %s" % (mode, sys.version)) - @atexit.register def print_log_location(): From d887c03f57bab51255cb632db4be62cb03a09c75 Mon Sep 17 00:00:00 2001 From: David Ham Date: Fri, 28 Jul 2017 14:03:46 +0100 Subject: [PATCH 60/62] but not before mode is set --- scripts/firedrake-install | 37 +++++++++++++++++++------------------ 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 02967ffac3..5602d4559d 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -28,24 +28,6 @@ firedrake_apps = { } -if sys.version_info < (3, 5): - if mode == "install": - print("""\nInstalling Firedrake requires Python 3, at least version 3.5. -You should run firedrake-install with python3.""") - if mode == "update": - if hasattr(sys, "real_prefix"): - # sys.real_prefix exists iff we are in an active virtualenv. - # - # Existing install trying to update past the py2/py3 barrier - print("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. -Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") - sys.exit(1) - else: - # Accidentally (?) running firedrake-update with python2. - print("""\nfiredrake-update must be run with Python 3, did you accidentally use Python 2?""") - sys.exit(1) - - class InstallError(Exception): # Exception for generic install problems. pass @@ -94,6 +76,25 @@ elif os.path.basename(__file__) == "firedrake-update": else: sys.exit("Script must be invoked either as firedrake-install or firedrake-update") + +if sys.version_info < (3, 5): + if mode == "install": + print("""\nInstalling Firedrake requires Python 3, at least version 3.5. +You should run firedrake-install with python3.""") + if mode == "update": + if hasattr(sys, "real_prefix"): + # sys.real_prefix exists iff we are in an active virtualenv. + # + # Existing install trying to update past the py2/py3 barrier + print("""\nFiredrake is now Python 3 only. You cannot upgrade your existing installation. +Please follow the instructions at http://www.firedrakeproject.org/download.html to reinstall.""") + sys.exit(1) + else: + # Accidentally (?) running firedrake-update with python2. + print("""\nfiredrake-update must be run with Python 3, did you accidentally use Python 2?""") + sys.exit(1) + + branches = {} jenkins = "JENKINS_URL" in os.environ From e365c6ea37feb4412fdaca98187eaa8fe0fafe84 Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 28 Jul 2017 14:41:18 +0100 Subject: [PATCH 61/62] install: Correct success message for firedrake-update --- scripts/firedrake-install | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/scripts/firedrake-install b/scripts/firedrake-install index 5602d4559d..6934e0abcf 100755 --- a/scripts/firedrake-install +++ b/scripts/firedrake-install @@ -1162,10 +1162,13 @@ if mode == "update": os.chdir("../..") -log.info("\n\nSuccessfully installed Firedrake.\n") +if mode == "install": + log.info("\n\nSuccessfully installed Firedrake.\n") -log.info("\nFiredrake has been installed in a python venv. You activate it with:\n") -log.info(" . %s/bin/activate\n" % firedrake_env) -log.info("The venv can be deactivated by running:\n") -log.info(" deactivate\n\n") -log.info("To upgrade Firedrake activate the venv and run firedrake-update\n") + log.info("\nFiredrake has been installed in a python venv. You activate it with:\n") + log.info(" . %s/bin/activate\n" % firedrake_env) + log.info("The venv can be deactivated by running:\n") + log.info(" deactivate\n\n") + log.info("To upgrade Firedrake activate the venv and run firedrake-update\n") +else: + log.info("\n\nSuccessfully updated Firedrake.\n") From c5da773b8de0ecb7c9e411a88cfa51eda722ae1e Mon Sep 17 00:00:00 2001 From: Lawrence Mitchell Date: Fri, 28 Jul 2017 14:47:44 +0100 Subject: [PATCH 62/62] docs: Note that Python2 is required to build PETSc --- docs/source/download.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/download.rst b/docs/source/download.rst index efbbd355d3..78e18afe3c 100644 --- a/docs/source/download.rst +++ b/docs/source/download.rst @@ -67,6 +67,10 @@ Firedrake requires Python 3.5 or later. On Ubuntu (16.04 or later), the system installed Python 3 is supported and tested. On Mac OS, the homebrew_ installed Python 3 is supported and tested. +.. note:: + + Your system still needs to have Python 2 available to build PETSc_. + .. warning:: The installation script *does not work* with anaconda_ based python @@ -130,3 +134,4 @@ the python package ``sphinxcontrib-bibtex``. .. _venv: https://docs.python.org/3/tutorial/venv.html .. _homebrew: https://brew.sh/ .. _anaconda: https://www.continuum.io/downloads +.. _PETSc: https://www.mcs.anl.gov/petsc/