Skip to content

Commit

Permalink
Bump version: 3.17
Browse files Browse the repository at this point in the history
* Use sconstruct provided by @abdel792 to make translated summary available for documentation title
* l10n updates
  • Loading branch information
nvdaes committed Dec 4, 2018
1 parent d3a475e commit e527266
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 33 deletions.
2 changes: 1 addition & 1 deletion buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
You can get more information about eMule at
http://www.emule-project.net"""),
# version
"addon_version" : "3.16",
"addon_version" : "3.17",
# Author(s)
"addon_author" : u"Noelia <[email protected]>, Chris <[email protected]>, Alberto <[email protected]>",
# URL for the add-on documentation support
Expand Down
62 changes: 30 additions & 32 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ import buildVars
def md2html(source, dest):
import markdown
lang = os.path.basename(os.path.dirname(source)).replace('_', '-')
title="{addonSummary} {addonVersion}".format(addonSummary=buildVars.addon_info["addon_summary"], addonVersion=buildVars.addon_info["addon_version"])
localeLang = os.path.basename(os.path.dirname(source))
try:
_ = gettext.translation("nvda", localedir=os.path.join("addon", "locale"), languages=[localeLang]).ugettext
title=u"{0}".format(_(buildVars.addon_info["addon_summary"]))
except:
title="{0}".format(buildVars.addon_info["addon_summary"])
headerDic = {
"[[!meta title=\"": "# ",
"\"]]": " #",
Expand All @@ -39,20 +44,12 @@ def md2html(source, dest):
f.write(htmlText)
f.write("\n</body>\n</html>")

def mdTool(env):
mdAction=env.Action(
lambda target,source,env: md2html(source[0].path, target[0].path),
lambda target,source,env: 'Generating %s'%target[0],
)
mdBuilder=env.Builder(
action=mdAction,
suffix='.html',
src_suffix='.md',
)
env['BUILDERS']['markdown']=mdBuilder

def generateHelpFiles (source, target, env, for_signature):
action = env.Action(lambda target, source, env : md2html(source[0].abspath, target[0].abspath) and None,
lambda target, source, env : "Generating %s" % target[0])
return action

env = Environment(ENV=os.environ, tools=['gettexttool', mdTool])
env = Environment(ENV=os.environ, tools=['gettexttool'])
env.Append(**buildVars.addon_info)

addonFile = env.File("${addon_name}-${addon_version}.nvda-addon")
Expand All @@ -76,6 +73,9 @@ def translatedManifestGenerator(target, source, env, for_signature):
return action

env['BUILDERS']['NVDAAddon'] = Builder(generator=addonGenerator)
env['BUILDERS']['markdown']=Builder(generator = generateHelpFiles,
suffix='.html',
src_suffix='.md')
env['BUILDERS']['NVDAManifest'] = Builder(generator=manifestGenerator)
env['BUILDERS']['NVDATranslatedManifest'] = Builder(generator=translatedManifestGenerator)

Expand Down Expand Up @@ -128,28 +128,10 @@ def expandGlobs(files):

addon = env.NVDAAddon(addonFile, env.Dir('addon'))

langDirs = [f for f in env.Glob(os.path.join("addon", "locale", "*"))]

#Allow all NVDA's gettext po files to be compiled in source/locale, and manifest files to be generated
for dir in langDirs:
poFile = dir.File(os.path.join("LC_MESSAGES", "nvda.po"))
moFile=env.gettextMoFile(poFile)
env.Depends(moFile, poFile)
translatedManifest = env.NVDATranslatedManifest(dir.File("manifest.ini"), [moFile, os.path.join("manifest-translated.ini.tpl")])
env.Depends(translatedManifest, ["buildVars.py"])
env.Depends(addon, [translatedManifest, moFile])

pythonFiles = expandGlobs(buildVars.pythonSources)
for file in pythonFiles:
env.Depends(addon, file)

#Convert markdown files to html
createAddonHelp("addon") # We need at least doc in English and should enable the Help button for the add-on in Add-ons Manager
for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')):
htmlFile = env.markdown(mdFile)
env.Depends(htmlFile, mdFile)
env.Depends(addon, htmlFile)

# Pot target
i18nFiles = expandGlobs(buildVars.i18nSources)
gettextvars={
Expand All @@ -171,4 +153,20 @@ manifest = env.NVDAManifest(os.path.join("addon", "manifest.ini"), os.path.join(
env.Depends(manifest, "buildVars.py")

env.Depends(addon, manifest)
createAddonHelp("addon") # We need at least doc in English and should enable the Help button for the add-on in Add-ons Manager
langDirs = [f for f in env.Glob(os.path.join("addon", "locale", "*"))]

#Allow all NVDA's gettext po files to be compiled in source/locale, and manifest files to be generated
for dir in langDirs:
poFile = dir.File(os.path.join("LC_MESSAGES", "nvda.po"))
moFile=env.gettextMoFile(poFile)
env.Depends(moFile, poFile)
translatedManifest = env.NVDATranslatedManifest(dir.File("manifest.ini"), [moFile, os.path.join("manifest-translated.ini.tpl")])
env.Depends(translatedManifest, ["buildVars.py"])
env.Depends(addon, [translatedManifest, moFile])
#Convert markdown files to html
for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')):
htmlFile = env.markdown(mdFile)
env.Depends(htmlFile, [mdFile, moFile])
env.Depends(addon, htmlFile)
env.Default(addon)

0 comments on commit e527266

Please sign in to comment.