forked from BrandinGrindstaff/GMpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfiguration.py
executable file
·35 lines (30 loc) · 936 Bytes
/
configuration.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python3
import os
from sys import exit, argv
from GMPi_Pack import BuildConfig
print("Making configuration file: config.txt")
try:
if len(argv) == 3:
dht = argv[1]
data_pin = argv[2]
elif len(argv) == 4:
dht = argv[2]
data_pin = argv[3]
else:
print("ERROR: Unable to parse DHT and Data Pin (should be integers)...\n")
print("Usage:")
print(" ./configure.py <dht> <data pin>")
exit(-1)
except:
print("ERROR: Unable to parse DHT and Data Pin (should be integers)...\n")
print("Usage:")
print(" ./configure.py <dht> <data pin>")
exit(-1)
if os.path.exists('config.txt'):
print("\nError: Configuration file already exists.")
print(" Please remove it before generating a new one.\n\n")
exit(-1)
BuildConfig(dht, data_pin)
print("Done.\n\n")
print("Please open config.txt and enter the appropriate information")
print("for all entries with <REPLACE> as the current value.\n\n")