forked from OCA/maintainer-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
36 lines (28 loc) · 974 Bytes
/
config.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
36
# -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function
import ConfigParser
import os
CREDENTIALS_FILE = 'oca.cfg'
def init_config():
config = ConfigParser.ConfigParser()
config.add_section("GitHub")
config.set("GitHub", "username", "")
config.set("GitHub", "token", "")
config.add_section("odoo")
config.set("odoo", "username", "")
config.set("odoo", "password", "")
config.add_section("Transifex")
config.set("Transifex", "username", "[email protected]")
config.set("Transifex", "password", "")
config.set("Transifex", "num_retries", 3)
config.set("Transifex", "organization", "OCA")
write_config(config)
def read_config():
if not os.path.exists(CREDENTIALS_FILE):
init_config()
config = ConfigParser.ConfigParser()
config.read(CREDENTIALS_FILE)
return config
def write_config(config):
with open(CREDENTIALS_FILE, 'w') as fd:
config.write(fd)