summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buildstream/plugins/sources/_downloadablefilesource.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/buildstream/plugins/sources/_downloadablefilesource.py b/buildstream/plugins/sources/_downloadablefilesource.py
index f5c5b3d08..b9b15e268 100644
--- a/buildstream/plugins/sources/_downloadablefilesource.py
+++ b/buildstream/plugins/sources/_downloadablefilesource.py
@@ -231,7 +231,13 @@ class DownloadableFileSource(Source):
if not DownloadableFileSource.__urlopener:
try:
netrc_config = netrc.netrc()
- except FileNotFoundError:
+ except OSError:
+ # If the .netrc file was not found, FileNotFoundError will be
+ # raised, but OSError will be raised directly by the netrc package
+ # in the case that $HOME is not set.
+ #
+ # This will catch both cases.
+ #
DownloadableFileSource.__urlopener = urllib.request.build_opener()
except netrc.NetrcParseError as e:
self.warn('{}: While reading .netrc: {}'.format(self, e))