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

@ -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 = []