mirror of
https://git.planet-casio.com/Lephenixnoir/GiteaPC.git
synced 2024-12-26 19:43:40 +01:00
giteapc: allow GiteaPC files to be in .giteapc instead of root (#8)
The only change is that giteapc.make must explicitly include .giteapc/giteapc-config.make and not giteapc-config.make, as the makefile still runs in the root folder.
This commit is contained in:
parent
c3b6148d34
commit
416564d40a
1 changed files with 10 additions and 5 deletions
|
@ -57,7 +57,11 @@ class LocalRepo:
|
|||
self.owner, self.name = fullname.split("/")
|
||||
self.folder = REPO_FOLDER + "/" + fullname
|
||||
self.remote = False
|
||||
self.makefile = self.folder + "/giteapc.make"
|
||||
|
||||
if os.path.exists(self.folder + "/.giteapc/giteapc.make"):
|
||||
self.makefile = self.folder + "/.giteapc/giteapc.make"
|
||||
else:
|
||||
self.makefile = self.folder + "/giteapc.make"
|
||||
|
||||
@staticmethod
|
||||
def path(fullname):
|
||||
|
@ -159,16 +163,17 @@ class LocalRepo:
|
|||
command = "make"
|
||||
|
||||
with ChangeDirectory(self.folder):
|
||||
return run([command, "-f", "giteapc.make", target], env=env)
|
||||
return run([command, "-f", self.makefile, target], env=env)
|
||||
|
||||
def configs(self):
|
||||
RE_NAME = re.compile(r'giteapc-config-(.*)\.make')
|
||||
files = glob.glob(self.folder + "/giteapc-config-*.make")
|
||||
files += glob.glob(self.folder + "/.giteapc/giteapc-config-*.make")
|
||||
return sorted(RE_NAME.match(os.path.basename(x))[1] for x in files)
|
||||
|
||||
def set_config(self, config):
|
||||
source = self.folder + f"/giteapc-config.make"
|
||||
target = self.folder + f"/giteapc-config-{config}.make"
|
||||
source = os.path.dirname(self.makefile) + f"/giteapc-config.make"
|
||||
target = os.path.dirname(self.makefile) + f"/giteapc-config-{config}.make"
|
||||
|
||||
if config == "":
|
||||
if os.path.islink(source):
|
||||
|
@ -191,7 +196,7 @@ class LocalRepo:
|
|||
RE_METADATA = re.compile(r'^\s*#\s*giteapc\s*:\s*(.*)$')
|
||||
metadata = dict()
|
||||
|
||||
with open(self.folder + "/giteapc.make", "r") as fp:
|
||||
with open(self.makefile, "r") as fp:
|
||||
makefile = fp.read()
|
||||
|
||||
for line in makefile.split("\n"):
|
||||
|
|
Loading…
Reference in a new issue