summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Takhar <amar@rtems.org>2016-01-18 17:53:44 -0500
committerAmar Takhar <verm@darkbeer.org>2016-05-02 20:51:24 -0400
commitf916fcaaae92aa57dd1d644badd1979bd93a4d35 (patch)
treede1d1d5bff4039bd0beb2eabe1eb7c6f9303f3ee
parentd389819eea3a84e388935153e3be847342809da3 (diff)
downloadrtems-docs-f916fcaaae92aa57dd1d644badd1979bd93a4d35.tar.bz2
Add support for spellchecking with a custom dictionary.
To use: 1. Install aspell 2. waf spell <list of files> * waf spell mydoc.rst * waf spell *.rst This uses a custom dictionary stored in common/spell/dict/. We should add all RTEMS and programming terms to this to ensure we are consistent. Amar.
-rw-r--r--book/wscript2
-rw-r--r--bsp_howto/wscript2
-rw-r--r--c_user/wscript2
-rw-r--r--common/spell/dict/rtems15
-rw-r--r--common/spell/en_GB-ise-w_accents-only.rwsbin0 -> 92560 bytes
-rw-r--r--common/spell/en_GB-ise-w_accents.multi3
-rw-r--r--common/waf.py37
-rw-r--r--cpu_supplement/wscript2
-rw-r--r--develenv/wscript2
-rw-r--r--filesystem/wscript2
-rw-r--r--networking/wscript2
-rw-r--r--porting/wscript2
-rw-r--r--posix1003_1/wscript2
-rw-r--r--posix_users/wscript2
-rw-r--r--rtemsconfig/wscript2
-rw-r--r--shell/wscript2
-rw-r--r--user/wscript2
17 files changed, 66 insertions, 15 deletions
diff --git a/book/wscript b/book/wscript
index bcd9860..0503604 100644
--- a/book/wscript
+++ b/book/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath, exists
path.append(abspath('../common/'))
-from waf import cmd_configure_path, cmd_build_path, cmd_options_path
+from waf import cmd_configure_path, cmd_build_path, cmd_options_path, spell, cmd_spell
def options(ctx):
diff --git a/bsp_howto/wscript b/bsp_howto/wscript
index 0956726..0565c4b 100644
--- a/bsp_howto/wscript
+++ b/bsp_howto/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/c_user/wscript b/c_user/wscript
index 0956726..0565c4b 100644
--- a/c_user/wscript
+++ b/c_user/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/common/spell/dict/rtems b/common/spell/dict/rtems
new file mode 100644
index 0000000..4ee7367
--- /dev/null
+++ b/common/spell/dict/rtems
@@ -0,0 +1,15 @@
+personal_ws-1.1 en 14
+lseek
+rtems
+fstat
+filesystems
+filesystem
+API
+chown
+pathname
+APIs
+unmount
+TFTP
+instantiation
+IMFS
+POSIX
diff --git a/common/spell/en_GB-ise-w_accents-only.rws b/common/spell/en_GB-ise-w_accents-only.rws
new file mode 100644
index 0000000..d248714
--- /dev/null
+++ b/common/spell/en_GB-ise-w_accents-only.rws
Binary files differ
diff --git a/common/spell/en_GB-ise-w_accents.multi b/common/spell/en_GB-ise-w_accents.multi
new file mode 100644
index 0000000..ba27862
--- /dev/null
+++ b/common/spell/en_GB-ise-w_accents.multi
@@ -0,0 +1,3 @@
+# Generated with Aspell Dicts "proc" script version 0.60.4
+add en-common.rws
+add en_GB-ise-w_accents-only.rws
diff --git a/common/waf.py b/common/waf.py
index 5437ab3..88c5690 100644
--- a/common/waf.py
+++ b/common/waf.py
@@ -1,9 +1,40 @@
import sys, os
+from waflib.Build import BuildContext
+def cmd_spell(ctx):
+ from waflib import Options
+ from sys import argv
+ from subprocess import call
+
+ Options.commands = None # stop warnings about knowing commands.
+
+ if not ctx.env.BIN_ASPELL:
+ ctx.fatal("'aspell' is required please add binary to your path and re-run configure.")
+
+ if len(argv) < 3:
+ ctx.fatal("Please supply at least one file name")
+
+ files = argv[2:]
+
+ path = ctx.path.parent.abspath()
+
+ # XXX: add error checking eg check if file exists.
+ for file in files:
+ cmd = ctx.env.BIN_ASPELL + ["-c", "--personal=%s/common/spell/dict/rtems" % path, "--extra-dicts=%s/common/spell/en_GB-ise-w_accents.multi" % path, file]
+
+ print "running:", cmd
+ call(cmd)
+
+
+class spell(BuildContext):
+ __doc__ = "Check spelling. Supply a list of files or a glob (*.rst)"
+ cmd = 'spell'
+ fun = 'cmd_spell'
def cmd_configure(ctx):
- ctx.find_program("sphinx-build", var="SPHINX_BUILD")
+ ctx.find_program("sphinx-build", var="BIN_SPHINX_BUILD")
+ ctx.find_program("aspell", var="BIN_ASPELL", mandatory=False)
def cmd_build(ctx, conf_dir=".", source_dir="."):
srcnode = ctx.srcnode.abspath()
@@ -21,7 +52,7 @@ def cmd_build(ctx, conf_dir=".", source_dir="."):
)
ctx(
- rule = "${SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
+ rule = "${BIN_SPHINX_BUILD} -b html -c %s -j %d -d build/doctrees %s build/html" % (conf_dir, ctx.options.jobs, source_dir),
cwd = ctx.path.abspath(),
source = ctx.path.ant_glob('**/*.rst'),# + ctx.path.ant_glob('conf.py'),
target = ctx.path.find_or_declare('html/index.html')
@@ -66,3 +97,5 @@ def cmd_build_path(ctx):
)
cmd_build(ctx, conf_dir="build", source_dir="build")
+
+
diff --git a/cpu_supplement/wscript b/cpu_supplement/wscript
index 0956726..0565c4b 100644
--- a/cpu_supplement/wscript
+++ b/cpu_supplement/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/develenv/wscript b/develenv/wscript
index 0956726..0565c4b 100644
--- a/develenv/wscript
+++ b/develenv/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/filesystem/wscript b/filesystem/wscript
index 0956726..0565c4b 100644
--- a/filesystem/wscript
+++ b/filesystem/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/networking/wscript b/networking/wscript
index 0956726..0565c4b 100644
--- a/networking/wscript
+++ b/networking/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/porting/wscript b/porting/wscript
index 0956726..0565c4b 100644
--- a/porting/wscript
+++ b/porting/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/posix1003_1/wscript b/posix1003_1/wscript
index 0956726..0565c4b 100644
--- a/posix1003_1/wscript
+++ b/posix1003_1/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/posix_users/wscript b/posix_users/wscript
index 0956726..0565c4b 100644
--- a/posix_users/wscript
+++ b/posix_users/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/rtemsconfig/wscript b/rtemsconfig/wscript
index 7d9e282..6a44966 100644
--- a/rtemsconfig/wscript
+++ b/rtemsconfig/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_options_path, cmd_configure_path, cmd_build_path
+from waf import cmd_options_path, cmd_configure_path, cmd_build_path, spell, cmd_spell
def options(ctx):
diff --git a/shell/wscript b/shell/wscript
index 0956726..0565c4b 100644
--- a/shell/wscript
+++ b/shell/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)
diff --git a/user/wscript b/user/wscript
index 0956726..0565c4b 100644
--- a/user/wscript
+++ b/user/wscript
@@ -2,7 +2,7 @@ from sys import path
from os.path import abspath
path.append(abspath('../common/'))
-from waf import cmd_configure, cmd_build
+from waf import cmd_configure, cmd_build, spell, cmd_spell
def configure(ctx):
cmd_configure(ctx)