mirror of
https://github.com/rosalinux/image-builder.git
synced 2025-02-23 18:32:51 +00:00
move load_config to common.py
This commit is contained in:
parent
b88af3d45f
commit
326c886725
4 changed files with 13 additions and 11 deletions
3
build.py
3
build.py
|
@ -4,7 +4,8 @@ import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
from utils.bootstrap_setup import setup_bootstrap, load_config
|
from utils.bootstrap_setup import setup_bootstrap
|
||||||
|
from utils.common import load_config
|
||||||
|
|
||||||
BASE_DIR = os.getcwd()
|
BASE_DIR = os.getcwd()
|
||||||
TMP_DIR = os.path.join(BASE_DIR, "tmp")
|
TMP_DIR = os.path.join(BASE_DIR, "tmp")
|
||||||
|
|
Binary file not shown.
|
@ -1,16 +1,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from utils.common import load_config
|
||||||
|
|
||||||
def load_config(config_path):
|
|
||||||
config = {}
|
|
||||||
with open(config_path, "r") as f:
|
|
||||||
for line in f:
|
|
||||||
if "=" in line and not line.strip().startswith("#"):
|
|
||||||
key, value = line.strip().split("=", 1)
|
|
||||||
config[key] = value.strip('"')
|
|
||||||
return config
|
|
||||||
|
|
||||||
|
|
||||||
def load_bootstrap_config(bootstrap_path):
|
def load_bootstrap_config(bootstrap_path):
|
||||||
|
|
10
utils/common.py
Normal file
10
utils/common.py
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
#!/usr/bin/env python
|
||||||
|
|
||||||
|
def load_config(config_path):
|
||||||
|
config = {}
|
||||||
|
with open(config_path, "r") as f:
|
||||||
|
for line in f:
|
||||||
|
if "=" in line and not line.strip().startswith("#"):
|
||||||
|
key, value = line.strip().split("=", 1)
|
||||||
|
config[key] = value.strip('"')
|
||||||
|
return config
|
Loading…
Add table
Reference in a new issue