summaryrefslogtreecommitdiffstats
path: root/bin/dohtml.py
diff options
context:
space:
mode:
authorArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-06-25 06:12:01 +0200
committerArfrever Frehtes Taifersar Arahesis <Arfrever@Apache.Org>2012-06-25 06:12:01 +0200
commitc92b3b0fcccd61af78b3777e863938abe9f2ac34 (patch)
tree8a0e91d33c9b4f5d2851f0b3b6b7d786aa1705f8 /bin/dohtml.py
parent4ef716471e4879833cc3804d81bebf1bfa5e24fb (diff)
downloadportage-c92b3b0fcccd61af78b3777e863938abe9f2ac34.tar.gz
portage-c92b3b0fcccd61af78b3777e863938abe9f2ac34.tar.bz2
portage-c92b3b0fcccd61af78b3777e863938abe9f2ac34.zip
dohtml: Support PORTAGE_DOHTML_WARN_ON_SKIPPED_FILES environmental variable.
Diffstat (limited to 'bin/dohtml.py')
-rwxr-xr-xbin/dohtml.py18
1 files changed, 12 insertions, 6 deletions
diff --git a/bin/dohtml.py b/bin/dohtml.py
index ba16b4662..3e80ef5f6 100755
--- a/bin/dohtml.py
+++ b/bin/dohtml.py
@@ -47,6 +47,10 @@ def eqawarn(lines):
os.spawnlp(os.P_WAIT, "bash", "bash", "-c", cmd)
skipped_directories = []
+skipped_files = []
+warn_on_skipped_files = os.environ.get("PORTAGE_DOHTML_WARN_ON_SKIPPED_FILES") is not None
+unwarned_skipped_extensions = os.environ.get("PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS", "").split()
+unwarned_skipped_files = os.environ.get("PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES", "").split()
def install(basename, dirname, options, prefix=""):
fullpath = basename
@@ -64,10 +68,12 @@ def install(basename, dirname, options, prefix=""):
sys.stderr.write("!!! dohtml: %s does not exist\n" % fullpath)
return False
elif os.path.isfile(fullpath):
- ext = os.path.splitext(basename)[1]
- if (len(ext) and ext[1:] in options.allowed_exts) or basename in options.allowed_files:
+ ext = os.path.splitext(basename)[1][1:]
+ if ext in options.allowed_exts or basename in options.allowed_files:
dodir(destdir)
dofile(fullpath, destdir + "/" + basename)
+ elif warn_on_skipped_files and ext not in unwarned_skipped_extensions and basename not in unwarned_skipped_files:
+ skipped_files.append(fullpath)
elif options.recurse and os.path.isdir(fullpath) and \
basename not in options.disallowed_dirs:
for i in os.listdir(fullpath):
@@ -169,7 +175,7 @@ def main():
if options.verbose:
print("Allowed extensions:", options.allowed_exts)
- print("Document prefix : '" + options.doc_prefix + "'")
+ print("Document prefix : '" + options.doc_prefix + "'")
print("Allowed files :", options.allowed_files)
success = False
@@ -179,10 +185,10 @@ def main():
dirname = os.path.dirname(x)
success |= install(basename, dirname, options)
- global skipped_directories
for x in skipped_directories:
- eqawarn(["QA Notice: dohtml on directory " + \
- "'%s' without recursion option" % x])
+ eqawarn(["QA Notice: dohtml on directory '%s' without recursion option" % x])
+ for x in skipped_files:
+ eqawarn(["dohtml: skipped file '%s'" % x])
if success:
retcode = 0