Skip to content

Commit c5c64ec

Browse files
committed
Added detection errors during documentation processing.

1 parent 84985ad commit c5c64ec

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

project/PythonBuildPlugin.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,10 @@ object PythonBuildPlugin extends AutoPlugin {
9393
val cmd = Seq(pythonCommand.value, "setup.py") ++ args
9494
val ver = version.value
9595
s.log.info(s"Running '${cmd.mkString(" ")}' in '$wd'")
96-
Process(cmd, wd, "RASTERFRAMES_VERSION" -> ver).!
96+
val ec = Process(cmd, wd, "RASTERFRAMES_VERSION" -> ver).!
97+
if (ec != 0)
98+
throw new MessageOnlyException(s"'$cmd' exited with value '$ec'")
99+
ec
97100
},
98101
pyWhl := pyWhlImp.value,
99102
Compile / `package` := (Compile / `package`).dependsOn(Python / packageBin).value,

pyrasterframes/src/main/python/setup.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def run(self):
7878
"""Run pweave."""
7979
import traceback
8080
import pweave
81+
bad_words = ["Error"]
8182

8283
for file in self.files:
8384
name = path.splitext(path.basename(file))[0]
@@ -87,6 +88,16 @@ def run(self):
8788
file=str(file),
8889
doctype=self.format
8990
)
91+
if self.format == 'markdown':
92+
dest = path.splitext(file)[0] + '.md'
93+
if not path.exists(dest):
94+
raise FileNotFoundError("Markdown file '%s' didn't get created as expected" % dest)
95+
with open(dest, "r") as result:
96+
for (n, line) in enumerate(result):
97+
for word in bad_words:
98+
if word in line:
99+
raise ChildProcessError("Error detected on line %s in %s:\n%s" % (n + 1, dest, line))
100+
90101
except Exception:
91102
print(_divided('%s Failed:' % file))
92103
print(traceback.format_exc())

0 commit comments

Comments
 (0)