craftbeerpi4-pione/sample.py

20 lines
475 B
Python
Raw Normal View History

2019-08-05 20:51:20 +02:00
import datetime
2019-01-14 07:33:59 +01:00
2019-08-16 21:36:55 +02:00
import yaml
from cbpi.utils.utils import load_config
2019-01-14 07:33:59 +01:00
2019-08-16 21:36:55 +02:00
package_name = "test222"
2019-01-14 07:33:59 +01:00
2019-08-16 21:36:55 +02:00
with open("./config/plugin_list.txt", 'rt') as f:
print(f)
plugins = yaml.load(f)
if plugins is None:
plugins = {}
2019-01-14 07:33:59 +01:00
2019-08-16 21:36:55 +02:00
now = datetime.datetime.now()
2019-08-05 20:51:20 +02:00
2019-08-16 21:36:55 +02:00
plugins[package_name] = dict(version="1.0", installation_date=now.strftime("%Y-%m-%d %H:%M:%S"))
with open('./config/plugin_list.txt', 'w') as outfile:
yaml.dump(plugins, outfile, default_flow_style=False)