28
28
_SWIFT_PATH / "benchmark/scripts/Benchmark_Driver" ,
29
29
_SWIFT_PATH / "benchmark/scripts/Benchmark_DTrace.in" ,
30
30
_SWIFT_PATH / "benchmark/scripts/Benchmark_GuardMalloc.in" ,
31
+ _SWIFT_PATH / "benchmark/scripts/Benchmark_QuickCheck.in" ,
31
32
_SWIFT_PATH / "benchmark/scripts/Benchmark_RuntimeLeaksRunner.in" ,
33
+ _SWIFT_PATH / "benchmark/scripts/run_smoke_bench" ,
32
34
_SWIFT_PATH / "docs/scripts/ns-html2rst" ,
33
35
_SWIFT_PATH / "test/Driver/Inputs/fake-toolchain/ld" ,
34
36
_SWIFT_PATH / "utils/80+-check" ,
@@ -100,6 +102,14 @@ def _is_package_installed(name):
100
102
def parse_args ():
101
103
parser = argparse .ArgumentParser ()
102
104
105
+ parser .add_argument (
106
+ "paths" ,
107
+ type = Path ,
108
+ metavar = "PATH" ,
109
+ nargs = "*" ,
110
+ help = "Source path to format." ,
111
+ )
112
+
103
113
parser .add_argument (
104
114
"--check" ,
105
115
action = "store_true" ,
@@ -110,7 +120,7 @@ def parse_args():
110
120
"-v" ,
111
121
"--verbose" ,
112
122
action = "store_true" ,
113
- help = "Also emit messages to stderr about files that were not changed" ,
123
+ help = "Emit messages to stderr about files that were not changed. " ,
114
124
)
115
125
116
126
return parser .parse_args ()
@@ -136,7 +146,23 @@ def main():
136
146
if args .verbose :
137
147
command .append ("--verbose" )
138
148
139
- command += [str (path ) for path in _get_python_sources ()]
149
+ requested_paths = [path .resolve () for path in args .paths ]
150
+
151
+ # Narrow down the set of paths to format to only those paths which are either
152
+ # included in the set of requested paths or are subpaths of the requested paths.
153
+ format_paths = {
154
+ known_path
155
+ for path in requested_paths
156
+ for known_path in _get_python_sources ()
157
+ if path == known_path or path in known_path .parents
158
+ }
159
+
160
+ # Add requested paths that exists, but aren't included in the format set.
161
+ for path in requested_paths :
162
+ if path not in format_paths and path .exists ():
163
+ format_paths .add (path )
164
+
165
+ command += sorted ([str (path ) for path in format_paths ])
140
166
141
167
return subprocess .call (command )
142
168
0 commit comments