Loading build/moz.configure/bootstrap.configure +5 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,11 @@ def bootstrap_path(path, **kwargs): return False artifact_path = mozbuild.tbbutils.get_artifact_path( tor_browser_build_out, artifact, target, prefix=path_prefix tor_browser_build_out, artifact, target, prefix=path_prefix, log=log.warning, ) if not artifact_path: log.info("no path found in tbb/out for %s", artifact) Loading python/mozbuild/mozbuild/tbbutils.py +6 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ def get_artifact_name(original_artifact_name, host): return ARTIFACT_NAME_MAP.get(original_artifact_name) def get_artifact_path(url, artifact, target, prefix=""): def get_artifact_path(url, artifact, target, prefix="", log=lambda *args, **kwargs: {}): if prefix: path = prefix else: Loading @@ -71,6 +71,7 @@ def get_artifact_path(url, artifact, target, prefix=""): files = list_files_http(f"{url}/{path}?C=M;O=D") if not files: log(f"No files found in {url} for {artifact}.") return None def filter_files(files, keyword): Loading @@ -78,6 +79,10 @@ def get_artifact_path(url, artifact, target, prefix=""): artifact_files = [file for file in files if file.startswith(artifact)] if len(artifact_files) == 0: log(f"No files found in {url} for {artifact}.") return None if len(artifact_files) == 1: return f"{url}/{path}/{artifact_files[0]}" Loading python/mozbuild/mozbuild/test/test_tbbutils.py +6 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ class TestGetArtifactPath(unittest.TestCase): result = get_artifact_path(self.url, self.artifact, self.target) self.assertIsNone(result) @patch("mozbuild.tbbutils.list_files_http") def test_no_matching_files_returns_none(self, mock_list_files): mock_list_files.return_value = ["somethingelse.zip", "yetanotherthing.zip"] result = get_artifact_path(self.url, self.artifact, self.target) self.assertIsNone(result) @patch("mozbuild.tbbutils.list_files_http") def test_single_artifact_match(self, mock_list_files): mock_list_files.return_value = ["artifact-1.zip"] Loading Loading
build/moz.configure/bootstrap.configure +5 −1 Original line number Diff line number Diff line Loading @@ -214,7 +214,11 @@ def bootstrap_path(path, **kwargs): return False artifact_path = mozbuild.tbbutils.get_artifact_path( tor_browser_build_out, artifact, target, prefix=path_prefix tor_browser_build_out, artifact, target, prefix=path_prefix, log=log.warning, ) if not artifact_path: log.info("no path found in tbb/out for %s", artifact) Loading
python/mozbuild/mozbuild/tbbutils.py +6 −1 Original line number Diff line number Diff line Loading @@ -58,7 +58,7 @@ def get_artifact_name(original_artifact_name, host): return ARTIFACT_NAME_MAP.get(original_artifact_name) def get_artifact_path(url, artifact, target, prefix=""): def get_artifact_path(url, artifact, target, prefix="", log=lambda *args, **kwargs: {}): if prefix: path = prefix else: Loading @@ -71,6 +71,7 @@ def get_artifact_path(url, artifact, target, prefix=""): files = list_files_http(f"{url}/{path}?C=M;O=D") if not files: log(f"No files found in {url} for {artifact}.") return None def filter_files(files, keyword): Loading @@ -78,6 +79,10 @@ def get_artifact_path(url, artifact, target, prefix=""): artifact_files = [file for file in files if file.startswith(artifact)] if len(artifact_files) == 0: log(f"No files found in {url} for {artifact}.") return None if len(artifact_files) == 1: return f"{url}/{path}/{artifact_files[0]}" Loading
python/mozbuild/mozbuild/test/test_tbbutils.py +6 −0 Original line number Diff line number Diff line Loading @@ -48,6 +48,12 @@ class TestGetArtifactPath(unittest.TestCase): result = get_artifact_path(self.url, self.artifact, self.target) self.assertIsNone(result) @patch("mozbuild.tbbutils.list_files_http") def test_no_matching_files_returns_none(self, mock_list_files): mock_list_files.return_value = ["somethingelse.zip", "yetanotherthing.zip"] result = get_artifact_path(self.url, self.artifact, self.target) self.assertIsNone(result) @patch("mozbuild.tbbutils.list_files_http") def test_single_artifact_match(self, mock_list_files): mock_list_files.return_value = ["artifact-1.zip"] Loading