archive update (with location specified in local-config.ini) and small updates of links
This commit is contained in:
@ -3,6 +3,7 @@ Paths, properties.
|
||||
"""
|
||||
|
||||
import os
|
||||
import configparser
|
||||
|
||||
# paths
|
||||
root_path = os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.pardir, os.path.pardir))
|
||||
@ -10,4 +11,16 @@ entries_path = os.path.join(root_path, 'entries')
|
||||
tocs_path = os.path.join(entries_path, 'tocs')
|
||||
code_path = os.path.join(root_path, 'code')
|
||||
|
||||
local_properties_file = os.path.join(root_path, 'local.properties')
|
||||
local_config_file = os.path.join(root_path, 'local-config.ini')
|
||||
|
||||
config = configparser.ConfigParser()
|
||||
config.read(local_config_file)
|
||||
|
||||
|
||||
def get_config(key):
|
||||
"""
|
||||
|
||||
:param key:
|
||||
:return:
|
||||
"""
|
||||
return config['general'][key]
|
||||
|
@ -146,12 +146,12 @@ def determine_latest_last_modified_date(folder):
|
||||
return latest_last_modified
|
||||
|
||||
|
||||
def subprocess_run(cmd, display=True):
|
||||
def subprocess_run(cmd, display=True, shell=False, env={}):
|
||||
"""
|
||||
Runs a cmd via subprocess and displays the std output in case of success or the std error output in case of failure
|
||||
where it also stops execution.
|
||||
"""
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
result = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=shell, env=dict(os.environ, **env))
|
||||
if result.returncode:
|
||||
if display:
|
||||
print("error {} in call {}".format(result.returncode, cmd))
|
||||
|
Reference in New Issue
Block a user