diff --git a/giteapc/repo.py b/giteapc/repo.py index dcea81d..44ca935 100644 --- a/giteapc/repo.py +++ b/giteapc/repo.py @@ -105,7 +105,7 @@ def pretty_repo(r): class Spec: # A spec in REPOSITORY[@VERSION][:CONFIGURATION] - RE_SPEC = re.compile(r'^([^@:]+)(?:@([^@:]+))?(?:[:]([^@:]+))?') + RE_SPEC = re.compile(r'^([^@:]+)(?:@([^@:]+))?(?:([:])([^@:]*))?') def __init__(self, string): m = re.match(Spec.RE_SPEC, string) @@ -114,7 +114,7 @@ class Spec: self.name = m[1] self.version = m[2] - self.config = m[3] + self.config = m[4] or (m[3] and "") self.repo = None def resolve(self, local_only=False, remote_only=False): @@ -286,7 +286,7 @@ def build(*args, install=False, skip_configure=False): raise Error(f"{r.fullname} has no giteapc.make") env = os.environ.copy() - if s.config: + if s.config is not None: env["GITEAPC_CONFIG"] = s.config r.set_config(s.config) env["GITEAPC_PREFIX"] = PREFIX_FOLDER diff --git a/giteapc/repos.py b/giteapc/repos.py index d223d22..cafe0d3 100644 --- a/giteapc/repos.py +++ b/giteapc/repos.py @@ -165,8 +165,19 @@ class LocalRepo: source = self.folder + f"/giteapc-config.make" target = self.folder + f"/giteapc-config-{config}.make" - if os.path.exists(source): + if config == "": + if os.path.islink(source): + os.remove(source) + return + + if not os.path.exists(target): + raise Error(f"config '{config}' does not exist") + + if os.path.islink(source): os.remove(source) + elif os.path.exists(source): + raise Error("giteapc-config.make is not a link, was it altered?") + os.symlink(target, source) # Metadata