diff --git a/make/defs.mk b/make/defs.mk index c1471262..f9e8e5d1 100644 --- a/make/defs.mk +++ b/make/defs.mk @@ -721,6 +721,7 @@ endef proj_query = $(shell python $(MOD_SCRIPT_DIR)/projects.py -p $(PROJECTS_DIR) -t $(TOPDIR) $(1)) proj_dir = $(call proj_query,proj-dir $(1)) +htdocs_dir = $(call proj_query,htdocs-dir $(1)) # ----- local.mk diff --git a/scripts/projects.py b/scripts/projects.py index ce451337..cb50b507 100644 --- a/scripts/projects.py +++ b/scripts/projects.py @@ -4,6 +4,7 @@ from __future__ import print_function import sys import argparse from sets import Set +from os.path import isdir from os.path import expanduser from os.path import basename from os.path import realpath @@ -23,6 +24,15 @@ def debug(*objs): def proj_dir(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): 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)) 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 global_args = []