Skip to content

Commit 5f10845

Browse files
committed
Update Python interpreter setting on first line of Python scripts.
Scripts that use only standard modules can use 'python3'. Everything else is set to use 'nemesis'.
1 parent 662865b commit 5f10845

File tree

124 files changed

+3307
-3084
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

124 files changed

+3307
-3084
lines changed

developer/downloads.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
2+
3+
import json
4+
import urllib.request
25

36
packages = ["pylith", "pylith_installer", "spatialdata"]
47
baseurl = "https://api.github.com/repos/geodynamics/%s/releases"
58

6-
import urllib2
7-
import json
89

910
for package in packages:
10-
raw = urllib2.urlopen(baseurl % package).read()
11+
raw = urllib.request.urlopen(baseurl % package).read()
1112

1213
data = json.loads(raw)
1314
count = 0

developer/format_source.py

+20-11
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env python
1+
#!/usr/bin/env python3
22
# ----------------------------------------------------------------------
33
#
44
# Brad T. Aagaard, U.S. Geological Survey
@@ -90,7 +90,8 @@ def _verify_configuration(self):
9090
"""Verify project configuration file exists."""
9191
path_filename = os.path.join(self.config_dir, self._config_filename())
9292
if not os.path.isfile(path_filename):
93-
raise IOError("Could not find configuration file '{}'.".format(path_filename))
93+
raise IOError(
94+
"Could not find configuration file '{}'.".format(path_filename))
9495
self.config_filename = path_filename
9596
return
9697

@@ -119,7 +120,8 @@ def _prog_test(self):
119120
def _prog_format(self, filename):
120121
suffix = "." + filename.split(".")[-1]
121122
language = self.LANGUAGE[suffix]
122-
options = ["-l", language, "-c", self.config_filename, "--no-backup", filename]
123+
options = ["-l", language, "-c",
124+
self.config_filename, "--no-backup", filename]
123125
return ["uncrustify"] + options
124126

125127

@@ -133,7 +135,8 @@ def _prog_test(self):
133135
return ["autopep8", "--version"]
134136

135137
def _prog_format(self, filename):
136-
options = ["--global-config={}".format(self.config_filename), "--in-place", filename]
138+
options = [
139+
"--global-config={}".format(self.config_filename), "--in-place", filename]
137140
return ["autopep8"] + options
138141

139142

@@ -204,9 +207,10 @@ def _find_files(self, patterns):
204207
:returns: Files matching pattern.
205208
"""
206209
files = []
207-
root, dirs, names = os.walk(os.getcwd())
210+
root, _, names = os.walk(os.getcwd())
208211
for pattern in patterns:
209-
files += [os.path.join(root, filename) for filename in fnmatch.filter(names, pattern)]
212+
files += [os.path.join(root, filename)
213+
for filename in fnmatch.filter(names, pattern)]
210214
return files
211215

212216
def _parse_command_line(self):
@@ -215,11 +219,16 @@ def _parse_command_line(self):
215219
import argparse
216220

217221
parser = argparse.ArgumentParser()
218-
parser.add_argument("--cplusplus", action="store", dest="cplusplus", default=None, help="[None, 'all', FILE, PATTERN]")
219-
parser.add_argument("--python", action="store", dest="python", default=None, help="[None, 'all', FILE, PATTERN]")
220-
parser.add_argument("--config-dir", action="store", dest="config_dir", default="doc/developer", help="Directory containing config files for formatters.")
221-
parser.add_argument("--quiet", action="store_false", dest="show_progress", default=True)
222-
parser.add_argument("--debug", action="store_true", dest="debug", default=True)
222+
parser.add_argument("--cplusplus", action="store", dest="cplusplus",
223+
default=None, help="[None, 'all', FILE, PATTERN]")
224+
parser.add_argument("--python", action="store", dest="python",
225+
default=None, help="[None, 'all', FILE, PATTERN]")
226+
parser.add_argument("--config-dir", action="store", dest="config_dir",
227+
default="doc/developer", help="Directory containing config files for formatters.")
228+
parser.add_argument("--quiet", action="store_false",
229+
dest="show_progress", default=True)
230+
parser.add_argument("--debug", action="store_true",
231+
dest="debug", default=True)
223232
return parser.parse_args()
224233

225234

0 commit comments

Comments
 (0)