]> git.scottworley.com Git - pinch/blobdiff - pinch.py
Get configuration from config file
[pinch] / pinch.py
index c77d891eaee06a3db6a0494b2bd84d4c82ad43de..1dbd6679c068ced7cdfdb0162abccd32aa3751ab 100644 (file)
--- a/pinch.py
+++ b/pinch.py
@@ -1,3 +1,4 @@
+import configparser
 import filecmp
 import functools
 import hashlib
 import filecmp
 import functools
 import hashlib
@@ -6,6 +7,7 @@ import os
 import os.path
 import shutil
 import subprocess
 import os.path
 import shutil
 import subprocess
+import sys
 import tempfile
 import types
 import urllib.parse
 import tempfile
 import types
 import urllib.parse
@@ -357,11 +359,11 @@ def check_channel_contents(v: Verification, channel: Channel) -> None:
     v.ok()
 
 
     v.ok()
 
 
-def main() -> None:
+def main(argv: List[str]) -> None:
     v = Verification()
     v = Verification()
-    channel = Channel(url='https://channels.nixos.org/nixos-20.03',
-                      git_repo='https://github.com/NixOS/nixpkgs.git',
-                      git_ref='nixos-20.03')
+    config = configparser.ConfigParser()
+    config.read_file(open(argv[1]), argv[1])
+    channel = Channel(**dict(config['nixos'].items()))
     fetch(v, channel)
     parse_channel(v, channel)
     fetch_resources(v, channel)
     fetch(v, channel)
     parse_channel(v, channel)
     fetch_resources(v, channel)
@@ -370,4 +372,4 @@ def main() -> None:
     print(channel)
 
 
     print(channel)
 
 
-main()
+main(sys.argv)