Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

_1password-gui: Fix update-sources.py truncation bug (#422521)

authored by Austin Horstman and committed by GitHub 6ef5e612 c18842be

Changed files
+4 -6
pkgs
by-name
_1
_1password-gui
+4 -6
pkgs/by-name/_1/_1password-gui/update-sources.py
··· 14 14 15 15 class Sources(OrderedDict): 16 16 def __init__(self): 17 - self._jsonfp = open("sources.json", "r+") 18 - self.update(json.load(self._jsonfp)) 19 - self._jsonfp.seek(0, os.SEEK_SET) 17 + with open("sources.json", "r") as fp: 18 + self.update(json.load(fp)) 20 19 21 20 def persist(self): 22 - json.dump(self, self._jsonfp, indent=2) 23 - self._jsonfp.write("\n") # keep fmt.check happy 24 - 21 + with open("sources.json", "w") as fp: 22 + print(json.dumps(self, indent=2), file=fp) 25 23 26 24 class GPG: 27 25 def __new__(cls):