commit/instantTranslate: parkcorp: more correct implementation of versionning

  • From: commits-noreply@xxxxxxxxxxxxx
  • To: nvda-addons-commits@xxxxxxxxxxxxx
  • Date: Sat, 09 Feb 2019 17:30:59 +0000 (UTC)

1 new commit in instantTranslate:

https://bitbucket.org/nvdaaddonteam/instanttranslate/commits/23ea748641cc/
Changeset:   23ea748641cc
Branch:      master
User:        parkcorp
Date:        2019-02-09 17:30:52+00:00
Summary:     more correct implementation of versionning

added a parameter "dev" to enable development builds to sconstruct

Affected #:  2 files

diff --git a/buildVars.py b/buildVars.py
index 6f20800..f038364 100644
--- a/buildVars.py
+++ b/buildVars.py
@@ -2,8 +2,6 @@
 
 # Build customizations
 # Change this file instead of sconstruct or manifest files, whenever possible.
-from datetime import datetime
-
 # Full getext (please don't change)
 _ = lambda x : x
 # Add-on information variables
@@ -19,7 +17,7 @@ addon_info = {
        # Translators: Long description to be shown for this add-on on add-on 
information from add-ons manager
        "addon_description" : _("This addon translates selected or clipboard 
text using the Yandex Translate service and presents it."),
        # version
-       "addon_version" : 
"4.3-{buildDate}-dev".format(buildDate=datetime.now().strftime('%Y%m%d')),
+       "addon_version" : "4.3",
        # Author(s)
        "addon_author" : "Alexy Sadovoy aka Lex <lex@xxxxxxxxxx>, ruslan 
<ru2020slan@xxxxxxxxx>, beqa <beqaprogger@xxxxxxxxx>, Mesar Hameed 
<mhameed@xxxxxxxxxxxxx>, Alberto Buffolino <a.buffolino@xxxxxxxxx>, and other 
NVDA contributors",
        # URL for the add-on documentation support

diff --git a/sconstruct b/sconstruct
index b77cfe6..3d46fb0 100644
--- a/sconstruct
+++ b/sconstruct
@@ -11,7 +11,6 @@ import zipfile
 
 import buildVars
 
-
 def md2html(source, dest):
        import markdown
        lang = os.path.basename(os.path.dirname(source)).replace('_', '-')
@@ -51,10 +50,17 @@ def mdTool(env):
        )
        env['BUILDERS']['markdown']=mdBuilder
 
+vars = Variables()
+vars.Add(BoolVariable("dev", "Whether this is a development build", False))
 
-env = Environment(ENV=os.environ, tools=['gettexttool', mdTool])
+env = Environment(variables=vars, ENV=os.environ, tools=['gettexttool', 
mdTool])
 env.Append(**buildVars.addon_info)
 
+if env["dev"]:
+       import datetime
+       buildDate = datetime.datetime.now().strftime('%Y%m%d')
+       env["addon_version"] = "".join([buildDate, "-dev"])
+
 addonFile = env.File("${addon_name}-${addon_version}.nvda-addon")
 
 def addonGenerator(target, source, env, for_signature):
@@ -67,7 +73,6 @@ def manifestGenerator(target, source, env, for_signature):
        lambda target, source, env : "Generating manifest %s" % target[0])
        return action
 
-
 def translatedManifestGenerator(target, source, env, for_signature):
        dir = os.path.abspath(os.path.join(os.path.dirname(str(source[0])), 
".."))
        lang = os.path.basename(dir)
@@ -90,8 +95,6 @@ def createAddonHelp(dir):
                readmeTarget = env.Command(readmePath, "readme.md", 
Copy("$TARGET", "$SOURCE"))
                env.Depends(addon, readmeTarget)
 
-
-
 def createAddonBundleFromPath(path, dest):
        """ Creates a bundle from a directory that contains an addon manifest 
file."""
        basedir = os.path.abspath(path)
@@ -106,9 +109,11 @@ def createAddonBundleFromPath(path, dest):
        return dest
 
 def generateManifest(source, dest):
+       addon_info = buildVars.addon_info
+       addon_info["addon_version"] = env["addon_version"]
        with codecs.open(source, "r", "utf-8") as f:
                manifest_template = f.read()
-       manifest = manifest_template.format(**buildVars.addon_info)
+       manifest = manifest_template.format(**addon_info)
        with codecs.open(dest, "w", "utf-8") as f:
                f.write(manifest)
 
@@ -167,6 +172,8 @@ env.Depends(mergePot, i18nFiles)
 
 # Generate Manifest path
 manifest = env.NVDAManifest(os.path.join("addon", "manifest.ini"), 
os.path.join("manifest.ini.tpl"))
+# Ensure manifest is rebuilt if buildVars is updated.
+env.Depends(manifest, "buildVars.py")
 
 env.Depends(addon, manifest)
 env.Default(addon)

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

--

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

Other related posts:

  • » commit/instantTranslate: parkcorp: more correct implementation of versionning - commits-noreply