Skip to content

Commit

Permalink
Explicitly invoke python3 (AMReX-Codes#2850)
Browse files Browse the repository at this point in the history
According to PEP 394, a python distributor may choose to not provide the
python command.  In fact, that's what recent versions of macOS do.
  • Loading branch information
WeiqunZhang authored Jun 23, 2022
1 parent 2d931f6 commit 5188a6a
Show file tree
Hide file tree
Showing 25 changed files with 24 additions and 96 deletions.
2 changes: 1 addition & 1 deletion Tools/Backtrace/parse_bt.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys
import re
Expand Down
6 changes: 1 addition & 5 deletions Tools/C_scripts/describe_sources.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import sys

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for dep.py")

import argparse
import os
import subprocess
Expand Down
6 changes: 1 addition & 5 deletions Tools/C_scripts/gatherbuildtime.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from __future__ import print_function
import sys, os, glob, operator, time

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for dep.py")

if __name__ == "__main__":
dt = float(sys.argv[3])-float(sys.argv[2])
hours, rem = divmod(dt, 3600)
Expand Down
4 changes: 1 addition & 3 deletions Tools/CompileTesting/compiletesting.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/usr/bin/env python
#!/usr/bin/env python3

from __future__ import print_function
import sys
import os
import shlex
Expand Down Expand Up @@ -148,4 +147,3 @@ def run(command, outfile=None):

if __name__ == "__main__":
compiletesting(sys.argv[1:])

13 changes: 1 addition & 12 deletions Tools/F_scripts/dep.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# automatically generate Makefile dependencies for Fortran 90 source.
#
Expand All @@ -20,18 +20,7 @@
# (e.g. iso_c_binding). Add any system-provided modules to the
# `IGNORES` list below

from __future__ import print_function

import sys

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for dep.py")

if sys.version[0] == "2":
reload(sys)
sys.setdefaultencoding('latin-1')


import io
import re
import os
Expand Down
8 changes: 1 addition & 7 deletions Tools/F_scripts/fcheck.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# a simple routine to parse Fortran files and make sure that things are
# declared double precision, and constants are of the form 1.0_dp_t or
Expand Down Expand Up @@ -122,9 +122,3 @@ def visit(argFiles, dirname, files):

if (badFile == 1):
print " "






4 changes: 1 addition & 3 deletions Tools/F_scripts/find_files_vpath.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""
Take a vpath and a list of files and find where in the first vpath the
first occurrence of the file.
"""

from __future__ import print_function

import sys
import os
import argparse
Expand Down
4 changes: 1 addition & 3 deletions Tools/F_scripts/findparams.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys
import os
Expand Down
2 changes: 1 addition & 1 deletion Tools/F_scripts/makebuildinfo.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# a simple script that writes the build_info.f90 file that is used
# to store information for the job_info file that we store in plotfiles.
Expand Down
4 changes: 1 addition & 3 deletions Tools/F_scripts/write_probin.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

"""This routine parses plain-text parameter files that list runtime
parameters for use in our codes. The general format of a parameter
Expand All @@ -24,8 +24,6 @@
"""

from __future__ import print_function

import os
import sys
import argparse
Expand Down
5 changes: 0 additions & 5 deletions Tools/GNUMake/Make.defs
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# Check python version
my_python_version := $(word 2, $(shell python --version 2>&1))
ifneq ($(firstword $(sort 2.7 $(my_python_version))), 2.7)
$(error Python >= 2.7 required! Your version is $(my_python_version))
endif

ifneq (,$(findstring ~,$(AMREX_HOME)))
$(warning *** AMREX_HOME string constains ~ and make will not like it. So it is replaced.)
Expand Down
2 changes: 1 addition & 1 deletion Tools/Postprocessing/python/column_depth.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
import numpy

Expand Down
2 changes: 1 addition & 1 deletion Tools/Postprocessing/python/conv_slopes.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
import sys
import os
import commands
Expand Down
7 changes: 1 addition & 6 deletions Tools/Postprocessing/python/dumpparthistory.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# a simple routine to parse particle files and dump out the particle
# histories into separate files (1 file per particle) so that they can
Expand Down Expand Up @@ -96,8 +96,3 @@ def main(files):
sys.exit(2)

main(sys.argv[1:])





2 changes: 1 addition & 1 deletion Tools/Postprocessing/python/test_helmeos.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3
#
# a script showing how to use the helmeos module
# it reads T, rho, X data from a sample data file, calculates abar and zbar
Expand Down
3 changes: 1 addition & 2 deletions Tools/Postprocessing/python/test_parseparticles.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# simple script showing how to make plots of particles using the parseparticles
# module
Expand Down Expand Up @@ -92,4 +92,3 @@ def main(fileList):

# this is for profiling
# cProfile.run("main(sys.argv[1:])","profile.tmp2")

4 changes: 1 addition & 3 deletions Tools/Py_util/plotsinglevar.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
#!/usr/bin/env python
#!/usr/bin/env python3

# a simple script to plot 2-d or 3-d BoxLib data using the matplotlib
# library
#

from __future__ import print_function

import matplotlib
matplotlib.use('agg')

Expand Down
2 changes: 1 addition & 1 deletion Tools/Release/ppCleanup.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import shutil
Expand Down
2 changes: 1 addition & 1 deletion Tools/Release/ppCleanupDir.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import shutil
Expand Down
2 changes: 1 addition & 1 deletion Tools/Release/release.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env python
#!/usr/bin/env python3

import os
import shutil
Expand Down
8 changes: 1 addition & 7 deletions Tools/libamrex/configure.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for configure.py")

import argparse

def configure(argv):
Expand Down
8 changes: 1 addition & 7 deletions Tools/libamrex/mkconfig.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys, re

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for mkconfig.py")

import argparse

def doit(defines, undefines, comp, allow_diff_comp):
Expand Down
8 changes: 1 addition & 7 deletions Tools/libamrex/mkpkgconfig.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for mkpkgconfig.py")

import argparse

def doit(prefix, version, cflags, libs, libpriv, fflags):
Expand Down
8 changes: 1 addition & 7 deletions Tools/libamrex/mkversionheader.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import sys, re

if sys.version_info < (2, 7):
sys.exit("ERROR: need python 2.7 or later for mkversionheader.py")

import argparse

def doit(code, defines):
Expand Down
4 changes: 1 addition & 3 deletions Tools/typechecker/typechecker.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/usr/bin/env python

from __future__ import print_function
#!/usr/bin/env python3

import os
import sys
Expand Down

0 comments on commit 5188a6a

Please sign in to comment.