1# -*- coding: utf-8 -*-
2#
3# Copyright 2021, Haiku, Inc. All rights reserved.
4# Distributed under the terms of the MIT License.
5#
6# Authors:
7#   Alexander von Gluck IV <kallisti5@unixzen.com>
8
9# -- Modules ------------------------------------------------------------------
10
11import json
12import os
13
14
15class ReporterJson(object):
16	def __init__(self, filename, branch, architecture):
17		self.filename = filename
18		self.branch = branch
19		self.architecture = architecture
20
21	def connected(self):
22		return True
23
24	def updateBuildrun(self, buildNumber, status):
25		tempFile = self.filename + '.temp'
26		with open(tempFile, 'w') as outputFile:
27			outputFile.write(json.dumps(status))
28			os.rename(tempFile, self.filename)
29