Skip to content

Commit 986d881

Browse files
committed
Fix formatting issues
1 parent 0f522c2 commit 986d881

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

src/bootstrap/bootstrap_test.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,25 +193,35 @@ def test_set_target(self):
193193
)
194194

195195
def test_set_target_option(self):
196-
build = serialize_and_parse(["--build=x86_64-unknown-linux-gnu", "--llvm-config=/usr/bin/llvm-config"])
196+
build = serialize_and_parse(
197+
["--build=x86_64-unknown-linux-gnu", "--llvm-config=/usr/bin/llvm-config"]
198+
)
197199
self.assertEqual(
198-
build.get_toml("llvm-config", section="target.x86_64-unknown-linux-gnu"), "/usr/bin/llvm-config"
200+
build.get_toml("llvm-config", section="target.x86_64-unknown-linux-gnu"),
201+
"/usr/bin/llvm-config",
199202
)
200203

201204
def test_set_targets(self):
202205
# Multiple targets can be set
203-
build = serialize_and_parse(["--set", "target.x86_64-unknown-linux-gnu.cc=gcc", "--set", "target.aarch64-apple-darwin.cc=clang"])
206+
build = serialize_and_parse(
207+
[
208+
"--set",
209+
"target.x86_64-unknown-linux-gnu.cc=gcc",
210+
"--set",
211+
"target.aarch64-apple-darwin.cc=clang",
212+
]
213+
)
204214
self.assertEqual(
205215
build.get_toml("cc", section="target.x86_64-unknown-linux-gnu"), "gcc"
206216
)
207217
self.assertEqual(
208218
build.get_toml("cc", section="target.aarch64-apple-darwin"), "clang"
209219
)
210220

211-
build = serialize_and_parse(["--target", "x86_64-unknown-linux-gnu,aarch64-apple-darwin"])
212-
self.assertNotEqual(
213-
build.config_toml.find("target.aarch64-apple-darwin"), -1
221+
build = serialize_and_parse(
222+
["--target", "x86_64-unknown-linux-gnu,aarch64-apple-darwin"]
214223
)
224+
self.assertNotEqual(build.config_toml.find("target.aarch64-apple-darwin"), -1)
215225
self.assertNotEqual(
216226
build.config_toml.find("target.x86_64-unknown-linux-gnu"), -1
217227
)

src/bootstrap/configure.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,7 @@ def is_value_list(key):
374374

375375
VERBOSE = False
376376

377+
377378
# Parse command line arguments into a valid build configuration.
378379
def parse_args(args):
379380
known_args = validate_args(args)
@@ -383,6 +384,7 @@ def parse_args(args):
383384
_set("build.configure-args", args, config)
384385
return config
385386

387+
386388
# Validate command line arguments, throwing an error if there are any unknown
387389
# arguments, missing values or duplicate arguments when option-checking is also
388390
# passed as an argument. Returns a dictionary of known arguments.
@@ -434,7 +436,7 @@ def validate_args(args):
434436
known_args[option.name] = []
435437
elif option.name in known_args and option.name != "set":
436438
duplicate_args.append(option.name)
437-
439+
438440
known_args[option.name].append((option, value))
439441
break
440442

@@ -595,7 +597,7 @@ def get_configured_targets(config):
595597

596598
def write_block(f, config, block):
597599
last_line = block[-1]
598-
key = last_line.split("=")[0].strip(' #')
600+
key = last_line.split("=")[0].strip(" #")
599601
value = config[key] if key in config else None
600602
if value is not None:
601603
for ln in block[:-1]:
@@ -624,10 +626,12 @@ def write_config_toml(f, config):
624626
section = []
625627
block = []
626628

629+
i = 0
627630
# Drop the initial comment block
628-
for i, line in enumerate(lines):
631+
for line in lines:
629632
if not line.startswith("#"):
630633
break
634+
i += 1
631635

632636
for line in lines[i:]:
633637
if line.startswith("["):

0 commit comments

Comments
 (0)