Skip to content

Commit e88a7c2

Browse files
authored
Merge pull request #792 from tiran/no-hostname-warning
fix: remove warning about missing hostname command
2 parents b3a547f + 4e0bc17 commit e88a7c2

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

src/fromager/build_environment.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,10 @@ def get_distributions(self) -> typing.Mapping[str, Version]:
237237
"json.dump({d.name: d.version for d in distributions()}, sys.stdout)",
238238
]
239239
result = self.run([str(self.python), "-c", "; ".join(lines)])
240-
mapping = json.loads(result.strip())
240+
try:
241+
mapping = json.loads(result.strip())
242+
except Exception:
243+
logger.exception("failed to de-serialize JSON: %s", result)
241244
return {name: Version(version) for name, version in sorted(mapping.items())}
242245

243246

@@ -296,9 +299,13 @@ def prepare_build_environment(
296299
dep_req_type=RequirementType.BUILD_SDIST,
297300
)
298301

299-
logger.debug(
300-
"build env %r has packages %r", build_env.path, build_env.get_distributions()
301-
)
302+
try:
303+
distributions = build_env.get_distributions()
304+
except Exception:
305+
# ignore error for debug call, error reason is logged in get_distributions()
306+
pass
307+
else:
308+
logger.debug("build env %r has packages %r", build_env.path, distributions)
302309

303310
return build_env
304311

src/fromager/run_network_isolation.sh

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ fi
3232
# set hostname to "localhost"
3333
if command -v hostname 2>&1 >/dev/null; then
3434
hostname localhost
35-
else
36-
echo "'hostname' command is missing, cannot set host name to 'localhost' for $@" >&2
3735
fi
3836

3937
# replace with command

0 commit comments

Comments
 (0)