[nvda-addons] commit/addonTemplate: norrumar: Help menu will be added just for addons containing doc\en folder.

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons@xxxxxxxxxxxxx
  • Date: Sat, 25 May 2013 09:52:29 -0000

1 new commit in addonTemplate:

https://bitbucket.org/nvdaaddonteam/addontemplate/commits/e2f009c142a6/
Changeset:   e2f009c142a6
Branch:      addondocsupport
User:        norrumar
Date:        2013-05-25 11:49:48
Summary:     Help menu will be added just for addons containing doc\en folder.

Affected #:  2 files

diff --git a/README.md b/README.md
index a907e1e..4e3a13f 100644
--- a/README.md
+++ b/README.md
@@ -33,7 +33,7 @@ To create a new NVDA add-on, taking advantage of this 
template:
 - In the **buildVars.py** file, change variable **addon_info** with your 
add-on's information (name, summary, description, version, author and url).
 - Put your code in the usual folders for NVDA extension, under the **addon** 
folder. For instance: globalPlugins, synthDrivers, etc. You can delete folders 
you don't need for your particular add-on package.
 - Gettext translations must be placed into 
addon\locale\<lang>/LC_MESSAGES\nvda.po. 
-- Documentation files must be placed into addon\doc\<lang>/fileName, 
readme.html by default.
+- Documentation files must be placed into addon\doc\<lang>/fileName, 
readme.html by default. Don't use **docHandler.py** or 
**yourAddonName_docHandler.py** as file names contained in **globalPlugins** if 
your addon include documentation files; they will be removed to create a menu 
item for opening your doc addon, under NVDA's help menu.
 - To package the add-on for distribution, open a command line, change to the 
folder that has the **SCONSTRUCT** file and run the **scons** command. The 
created add-on, if there were no errors, is placed in the current directory.
 - You can further customize variables in the **buildVars.py** file.
 

diff --git a/sconstruct b/sconstruct
index f84cd82..e6a7a4a 100644
--- a/sconstruct
+++ b/sconstruct
@@ -58,28 +58,27 @@ env['BUILDERS']['gettextMergePotFile']=env.Builder(
        ], lambda t, s, e : "Generating pot file %s" % t[0]),
        suffix=".pot")
 
+def createAddonHelp(dir):
+       docdir = os.path.join(dir, "doc", "en")
+       if not os.path.isdir(docdir):
+               return
+       docFilename = 
"{addonName}_docHandler.py".format(addonName=buildVars.addon_info["addon-name"])
+       plugindir = os.path.join(dir, "globalPlugins")
+       docPath = os.path.join(plugindir, docFilename)
+       if not os.path.isdir(plugindir):
+               os.makedirs(plugindir)
+       shutil.copy("docHandler.py", plugindir)
+       curdir = os.getcwd()
+       if os.path.isfile(docPath):
+               os.unlink(docPath)
+       os.chdir(plugindir)
+       os.rename("docHandler.py", docFilename)
+       os.chdir(curdir)
+
 def createAddonBundleFromPath(path, dest):
        """ Creates a bundle from a directory that contains an addon manifest 
file."""
        basedir = os.path.abspath(path)
-       plugindir = os.path.join(basedir, "globalPlugins")
-       docFilename = 
"{addonName}_docHandler.py".format(addonName=buildVars.addon_info["addon-name"])
-       if not os.path.isdir(plugindir):
-               try:
-                       os.makedirs(plugindir)
-               except:
-                       pass
-       try:
-               shutil.copy("docHandler.py", plugindir)
-       except:
-               pass
-       if not os.path.isfile(docFilename):
-               curdir = os.getcwd()
-               os.chdir(plugindir)
-               try:
-                       os.rename("docHandler.py", docFilename)
-               except:
-                       pass
-               os.chdir(curdir)
+       createAddonHelp(basedir)
        with zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) as z:
                # FIXME: the include/exclude feature may or may not be useful. 
Also python files can be pre-compiled.
                for dir, dirnames, filenames in os.walk(basedir):

Repository URL: https://bitbucket.org/nvdaaddonteam/addontemplate/

--

This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
----------------------------------------------------------------

NVDA add-ons Central: A list for discussing NVDA add-ons

To post a message, send an email to nvda-addons@xxxxxxxxxxxxx.

To unsubscribe, send an email with the subject line of "unsubscribe" (without 
quotes) to nvda-addons-request@xxxxxxxxxxxxx.

If you have questions for list moderators, please send a message to 
nvda-addons-moderators@xxxxxxxxxxxxx.

Community addons can be found here: http://addons.nvda-project.org

Other related posts:

  • » [nvda-addons] commit/addonTemplate: norrumar: Help menu will be added just for addons containing doc\en folder. - commits-noreply