Commit c46259e5 authored by Benjamin Winger's avatar Benjamin Winger

Restructured portmod.globals

Moved default values outside of if statement to ensure that they always
have a value
Fixed ACCEPT_LICENSE default in case where config file is not found
parent b541d119
Pipeline #60260237 (#54) passed with stage
in 45 seconds
......@@ -38,6 +38,13 @@ DOWNLOAD_DIR = os.path.join(CACHE_DIR, "downloads")
INSTALLED_DB = os.path.join(PORTMOD_LOCAL_DIR, "db")
PORTMOD_MIRRORS_DEFAULT = "https://gitlab.com/portmod/mirror/raw/master/"
ACCEPT_LICENSE = ["*", "-@EULA"]
GLOBAL_USE = []
ARCH = "openmw"
ACCEPT_KEYWORDS = [ARCH]
PORTMOD_MIRRORS = PORTMOD_MIRRORS_DEFAULT.split()
# Ensure that INSTALLED_DB exists
if not os.path.exists(INSTALLED_DB):
# Initialize as git repo
......@@ -61,12 +68,6 @@ if os.path.exists(PORTMOD_CONFIG):
.get("PORTMOD_MIRRORS", PORTMOD_MIRRORS_DEFAULT)
.split()
)
else:
GLOBAL_USE = []
ARCH = "openmw"
ACCEPT_KEYWORDS = [ARCH]
ACCEPT_LICENSE = ["*", "-@EULA"]
PORTMOD_MIRRORS = PORTMOD_MIRRORS_DEFAULT.split()
else:
print("Could not find portmod.cfg. Creating new config: {}".format(PORTMOD_CONFIG))
os.makedirs(PORTMOD_CONFIG_DIR)
......@@ -74,7 +75,3 @@ else:
print("[general]", file=config)
print("USE=", file=config)
print("ARCH=openmw", file=config)
GLOBAL_USE = []
ARCH = "openmw"
ACCEPT_KEYWORDS = [ARCH]
PORTMOD_MIRRORS = PORTMOD_MIRRORS_DEFAULT.split()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment