Skip to content

Commit

Permalink
Flags to compatibility until NVDA 2019.2
Browse files Browse the repository at this point in the history
  • Loading branch information
javidominguez committed Nov 3, 2019
1 parent ba2d709 commit 49e7687
Show file tree
Hide file tree
Showing 7 changed files with 269 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
This addon translates a chess game position from FEN code to human friendly description.

ForsythEdwards Notation (FEN) is a standard notation for describing a particular board position of a chess game.
Forsyth–Edwards Notation (FEN) is a standard notation for describing a particular board position of a chess game.

## Usage:

Expand Down
File renamed without changes.
10 changes: 8 additions & 2 deletions buildVars.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,19 @@
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
"addon_description" : _("This addon translates a chess game position from FEN code to human friendly description"),
# version
"addon_version" : "1.0",
"addon_version" : "1.0.1",
# Author(s)
"addon_author" : u"Javi Dominguez <[email protected]>",
# URL for the add-on documentation support
"addon_url" : 'http://addons.nvda-project.org',
# File name for the add-on help file.
"addon_docFileName" : "readme.html"
"addon_docFileName" : "readme.html",
# Minimum NVDA version supported (e.g. "2018.3")
"addon_minimumNVDAVersion" : "2018.1.0",
# Last NVDA version supported/tested (e.g. "2018.4", ideally more recent than minimum version)
"addon_lastTestedNVDAVersion" : "2019.2.1",
# Add-on update channel (default is stable or None)
"addon_updateChannel" : None
}


Expand Down
3 changes: 3 additions & 0 deletions manifest.ini.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ author = "{addon_author}"
url = {addon_url}
version = {addon_version}
docFileName = {addon_docFileName}
minimumNVDAVersion = {addon_minimumNVDAVersion}
lastTestedNVDAVersion = {addon_lastTestedNVDAVersion}
updateChannel = {addon_updateChannel}
205 changes: 205 additions & 0 deletions scons.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
#! /usr/bin/env python
#
# SCons - a Software Constructor
#
# Copyright (c) 2001 - 2016 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

__revision__ = "src/script/scons.py rel_2.5.0:3544:95d356f188a3 2016/04/09 14:38:50 bdbaddog"

__version__ = "2.5.0"

__build__ = "rel_2.5.0:3544:95d356f188a3[MODIFIED]"

__buildsys__ = "ubuntu1404-32bit"

__date__ = "2016/04/09 14:38:50"

__developer__ = "bdbaddog"

import os
import sys


##############################################################################
# BEGIN STANDARD SCons SCRIPT HEADER
#
# This is the cut-and-paste logic so that a self-contained script can
# interoperate correctly with different SCons versions and installation
# locations for the engine. If you modify anything in this section, you
# should also change other scripts that use this same header.
##############################################################################

# Strip the script directory from sys.path() so on case-insensitive
# (WIN32) systems Python doesn't think that the "scons" script is the
# "SCons" package. Replace it with our own library directories
# (version-specific first, in case they installed by hand there,
# followed by generic) so we pick up the right version of the build
# engine modules if they're in either directory.


if sys.version_info >= (3,0,0):
msg = "scons: *** SCons version %s does not run under Python version %s.\n\
Python 3 is not yet supported.\n"
sys.stderr.write(msg % (__version__, sys.version.split()[0]))
sys.exit(1)


script_dir = sys.path[0]

if script_dir in sys.path:
sys.path.remove(script_dir)

libs = []

if "SCONS_LIB_DIR" in os.environ:
libs.append(os.environ["SCONS_LIB_DIR"])

# - running from source takes priority (since 2.3.2), excluding SCONS_LIB_DIR settings
script_path = os.path.abspath(os.path.dirname(__file__))
source_path = os.path.join(script_path, '..', 'engine')
libs.append(source_path)

local_version = 'scons-local-' + __version__
local = 'scons-local'
if script_dir:
local_version = os.path.join(script_dir, local_version)
local = os.path.join(script_dir, local)
libs.append(os.path.abspath(local_version))
libs.append(os.path.abspath(local))

scons_version = 'scons-%s' % __version__

# preferred order of scons lookup paths
prefs = []


# - running from egg check
try:
import pkg_resources
except ImportError:
pass
else:
# when running from an egg add the egg's directory
try:
d = pkg_resources.get_distribution('scons')
except pkg_resources.DistributionNotFound:
pass
else:
prefs.append(d.location)

if sys.platform == 'win32':
# sys.prefix is (likely) C:\Python*;
# check only C:\Python*.
prefs.append(sys.prefix)
prefs.append(os.path.join(sys.prefix, 'Lib', 'site-packages'))
else:
# On other (POSIX) platforms, things are more complicated due to
# the variety of path names and library locations. Try to be smart
# about it.
if script_dir == 'bin':
# script_dir is `pwd`/bin;
# check `pwd`/lib/scons*.
prefs.append(os.getcwd())
else:
if script_dir == '.' or script_dir == '':
script_dir = os.getcwd()
head, tail = os.path.split(script_dir)
if tail == "bin":
# script_dir is /foo/bin;
# check /foo/lib/scons*.
prefs.append(head)

head, tail = os.path.split(sys.prefix)
if tail == "usr":
# sys.prefix is /foo/usr;
# check /foo/usr/lib/scons* first,
# then /foo/usr/local/lib/scons*.
prefs.append(sys.prefix)
prefs.append(os.path.join(sys.prefix, "local"))
elif tail == "local":
h, t = os.path.split(head)
if t == "usr":
# sys.prefix is /foo/usr/local;
# check /foo/usr/local/lib/scons* first,
# then /foo/usr/lib/scons*.
prefs.append(sys.prefix)
prefs.append(head)
else:
# sys.prefix is /foo/local;
# check only /foo/local/lib/scons*.
prefs.append(sys.prefix)
else:
# sys.prefix is /foo (ends in neither /usr or /local);
# check only /foo/lib/scons*.
prefs.append(sys.prefix)

temp = [os.path.join(x, 'lib') for x in prefs]
temp.extend([os.path.join(x,
'lib',
'python' + sys.version[:3],
'site-packages') for x in prefs])
prefs = temp

# Add the parent directory of the current python's library to the
# preferences. On SuSE-91/AMD64, for example, this is /usr/lib64,
# not /usr/lib.
try:
libpath = os.__file__
except AttributeError:
pass
else:
# Split /usr/libfoo/python*/os.py to /usr/libfoo/python*.
libpath, tail = os.path.split(libpath)
# Split /usr/libfoo/python* to /usr/libfoo
libpath, tail = os.path.split(libpath)
# Check /usr/libfoo/scons*.
prefs.append(libpath)

# Look first for 'scons-__version__' in all of our preference libs,
# then for 'scons'.
libs.extend([os.path.join(x, scons_version) for x in prefs])
libs.extend([os.path.join(x, 'scons') for x in prefs])

sys.path = libs + sys.path

##############################################################################
# END STANDARD SCons SCRIPT HEADER
##############################################################################

if __name__ == "__main__":
try:
import SCons.Script
except ImportError:
print("SCons import failed. Unable to find engine files in:")
for path in libs:
print(" %s" % path)
raise

# this does all the work, and calls sys.exit
# with the proper exit status when done.
SCons.Script.main()

# Local Variables:
# tab-width:4
# indent-tabs-mode:nil
# End:
# vim: set expandtab tabstop=4 shiftwidth=4:
28 changes: 22 additions & 6 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import zipfile

import buildVars


def md2html(source, dest):
import markdown
lang = os.path.basename(os.path.dirname(source)).replace('_', '-')
Expand Down Expand Up @@ -51,10 +50,25 @@ def mdTool(env):
)
env['BUILDERS']['markdown']=mdBuilder

vars = Variables()
vars.Add("version", "The version of this build", buildVars.addon_info["addon_version"])
vars.Add(BoolVariable("dev", "Whether this is a daily development version", False))
vars.Add("channel", "Update channel for this build", buildVars.addon_info["addon_updateChannel"])

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()
year, month, day = str(buildDate.year), str(buildDate.month), str(buildDate.day)
env["addon_version"] = "".join([year, month.zfill(2), day.zfill(2), "-dev"])
env["channel"] = "dev"
elif env["version"] is not None:
env["addon_version"] = env["version"]
if "channel" in env and env["channel"] is not None:
env["addon_updateChannel"] = env["channel"]

addonFile = env.File("${addon_name}-${addon_version}.nvda-addon")

def addonGenerator(target, source, env, for_signature):
Expand All @@ -67,7 +81,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)
Expand All @@ -90,8 +103,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)
Expand All @@ -106,9 +117,12 @@ def createAddonBundleFromPath(path, dest):
return dest

def generateManifest(source, dest):
addon_info = buildVars.addon_info
addon_info["addon_version"] = env["addon_version"]
addon_info["addon_updateChannel"] = env["addon_updateChannel"]
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)

Expand Down Expand Up @@ -167,6 +181,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)
30 changes: 30 additions & 0 deletions style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
@charset "utf-8";
body {
font-family : Verdana, Arial, Helvetica, Sans-serif;
color : #FFFFFF;
background-color : #000000;
line-height: 1.2em;
}
h1, h2 {text-align: center}
dt {
font-weight : bold;
float : left;
width: 10%;
clear: left
}
dd {
margin : 0 0 0.4em 0;
float : left;
width: 90%;
display: block;
}
p { clear : both;
}
a { text-decoration : underline;
}
:active {
text-decoration : none;
}
a:focus, a:hover {outline: solid}
:link {color: #0000FF;
background-color: #FFFFFF}

0 comments on commit 49e7687

Please sign in to comment.