defs.mk, projects.py: Add command htdocs-dir

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-02-11 12:51:36 +00:00
commit c426a3748c
2 changed files with 20 additions and 0 deletions

View file

@ -721,6 +721,7 @@ endef
proj_query = $(shell python $(MOD_SCRIPT_DIR)/projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) $(1)) proj_query = $(shell python $(MOD_SCRIPT_DIR)/projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) $(1))
proj_dir = $(call proj_query,proj-dir $(1)) proj_dir = $(call proj_query,proj-dir $(1))
htdocs_dir = $(call proj_query,htdocs-dir $(1))
# ----- local.mk # ----- local.mk

View file

@ -4,6 +4,7 @@ from __future__ import print_function
import sys import sys
import argparse import argparse
from sets import Set from sets import Set
from os.path import isdir
from os.path import expanduser from os.path import expanduser
from os.path import basename from os.path import basename
from os.path import realpath from os.path import realpath
@ -23,6 +24,15 @@ def debug(*objs):
def proj_dir(name): def proj_dir(name):
return projs_root + '/' + name return projs_root + '/' + name
# TODO: add support for customizing this in project.conf
def htdocs_dir(name):
pd = proj_dir(name)
for r in [ pd + "/tools/html/htdocs", pd + "/htdocs", "/srv/www/proj/" + name
]:
if isdir(r):
return r
return None
def strip_module_from_spec(mod): def strip_module_from_spec(mod):
return re.sub(r'-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip()) return re.sub(r'-devel$|-run$', '', re.split('([=><]+)', mod)[0].strip())
@ -266,6 +276,15 @@ def cmd_proj_dir(args_):
r.append(proj_dir(m)) r.append(proj_dir(m))
print(' '.join(r)) print(' '.join(r))
def cmd_htdocs_dir(args_):
parser = argparse.ArgumentParser(description='htdocs-dir')
parser.add_argument('module', nargs='*', help='Modules')
args=parser.parse_args(args_)
r = []
for m in args.module:
r.append(htdocs_dir(m))
print(' '.join(r))
# -------------------------------------------------------------------- here we go # -------------------------------------------------------------------- here we go
global_args = [] global_args = []