diff options
author | Russel Winder <russel@winder.org.uk> | 2017-08-05 08:11:25 +0100 |
---|---|---|
committer | Russel Winder <russel@winder.org.uk> | 2017-08-05 08:11:25 +0100 |
commit | 957f2678b2b3a4e516f18f091f752319332bef25 (patch) | |
tree | d557e8efa99b0e39421a904d4268336d7fde9335 | |
parent | e71ea1913673759e7b01a2c0d4516912c26fd3bc (diff) | |
parent | 339dbb02d87eeb756467a66d9016a95582faaeee (diff) | |
download | scons-957f2678b2b3a4e516f18f091f752319332bef25.tar.gz |
Merge mainline.
32 files changed, 300 insertions, 155 deletions
@@ -385,22 +385,33 @@ def SCons_revision(target, source, env): """ t = str(target[0]) s = source[0].rstr() - with open(s, 'r') as fp: - contents = fp.read() - # Note: We construct the __*__ substitution strings here - # so that they don't get replaced when this file gets - # copied into the tree for packaging. - contents = contents.replace('__BUILD' + '__', env['BUILD']) - contents = contents.replace('__BUILDSYS' + '__', env['BUILDSYS']) - contents = contents.replace('__COPYRIGHT' + '__', env['COPYRIGHT']) - contents = contents.replace('__DATE' + '__', env['DATE']) - contents = contents.replace('__DEVELOPER' + '__', env['DEVELOPER']) - contents = contents.replace('__FILE' + '__', str(source[0]).replace('\\', '/')) - contents = contents.replace('__MONTH_YEAR'+ '__', env['MONTH_YEAR']) - contents = contents.replace('__REVISION' + '__', env['REVISION']) - contents = contents.replace('__VERSION' + '__', env['VERSION']) - contents = contents.replace('__NULL' + '__', '') - open(t, 'w').write(contents) + + try: + with open(s, 'r') as fp: + contents = fp.read() + + + # Note: We construct the __*__ substitution strings here + # so that they don't get replaced when this file gets + # copied into the tree for packaging. + contents = contents.replace('__BUILD' + '__', env['BUILD']) + contents = contents.replace('__BUILDSYS' + '__', env['BUILDSYS']) + contents = contents.replace('__COPYRIGHT' + '__', env['COPYRIGHT']) + contents = contents.replace('__DATE' + '__', env['DATE']) + contents = contents.replace('__DEVELOPER' + '__', env['DEVELOPER']) + contents = contents.replace('__FILE' + '__', str(source[0]).replace('\\', '/')) + contents = contents.replace('__MONTH_YEAR'+ '__', env['MONTH_YEAR']) + contents = contents.replace('__REVISION' + '__', env['REVISION']) + contents = contents.replace('__VERSION' + '__', env['VERSION']) + contents = contents.replace('__NULL' + '__', '') + open(t, 'w').write(contents) + except UnicodeDecodeError as e: + print("Error decoding file:%s just copying no revision edit") + with open(s, 'rb') as fp: + contents = fp.read() + open(t, 'wb').write(contents) + + os.chmod(t, os.stat(s)[0]) @@ -594,43 +605,6 @@ finally: except EnvironmentError: pass -# -# The original packaging scheme would have have required us to push -# the Python version number into the package name (python1.5-scons, -# python2.0-scons, etc.), which would have required a definition -# like the following. Leave this here in case we ever decide to do -# this in the future, but note that this would require some modification -# to src/engine/setup.py before it would really work. -# -#python2_scons = { -# 'pkg' : 'python2-' + project, -# 'src_subdir' : 'engine', -# 'inst_subdir' : os.path.join('lib', 'python2.2', 'site-packages'), -# -# 'debian_deps' : [ -# 'debian/changelog', -# 'debian/control', -# 'debian/copyright', -# 'debian/dirs', -# 'debian/docs', -# 'debian/postinst', -# 'debian/prerm', -# 'debian/rules', -# ], -# -# 'files' : [ -# 'LICENSE.txt', -# 'README.txt', -# 'setup.cfg', -# 'setup.py', -# ], -# 'filemap' : { -# 'LICENSE.txt' : '../LICENSE.txt', -# }, -# 'buildermap' : {}, -#} -# - scons_script = { 'pkg' : project + '-script', 'src_subdir' : 'script', @@ -836,6 +810,7 @@ for p in [ scons ]: builder = p['buildermap'].get(b, env.SCons_revision) x = builder(os.path.join(build, b), s) + Local(x) # @@ -944,11 +919,14 @@ for p in [ scons ]: ebuild = os.path.join(gentoo, 'scons-%s.ebuild' % version) digest = os.path.join(gentoo, 'files', 'digest-scons-%s' % version) env.Command(ebuild, os.path.join('gentoo', 'scons.ebuild.in'), SCons_revision) + def Digestify(target, source, env): - import md5 + import hashlib src = source[0].rfile() - contents = open(str(src)).read() - sig = md5.new(contents).hexdigest() + contents = open(str(src),'rb').read() + m = hashlib.md5() + m.update(contents) + sig = m.hexdigest() bytes = os.stat(str(src))[6] open(str(target[0]), 'w').write("MD5 %s %s %d\n" % (sig, src.name, @@ -1268,7 +1246,11 @@ if sfiles: Local(src_tar_gz, src_zip) for file in sfiles: - env.SCons_revision(os.path.join(b_ps, file), file) + if file.endswith('jpg') or file.endswith('png'): + # don't revision binary files. + env.Install(os.path.dirname(os.path.join(b_ps,file)), file) + else: + env.SCons_revision(os.path.join(b_ps, file), file) b_ps_files = [os.path.join(b_ps, x) for x in sfiles] cmds = [ diff --git a/doc/user/builders-writing.xml b/doc/user/builders-writing.xml index 35dd989d..07f2dec6 100644 --- a/doc/user/builders-writing.xml +++ b/doc/user/builders-writing.xml @@ -880,53 +880,6 @@ env2.Foo('file2') </section> - <section> - <title>Nested and namespace builders;</title> - - <para> - &SCons; now supports the ability for a Builder to be located within a sub-directory of the toolpath. - This is similar to namespacing within python. - - Normally when loading a tool into the environment, scons will search for the tool within two locations - </para> - - <sconstruct> -# Regular non namespace target -env = Environment(ENV = os.environ, tools = ['SomeTool']) -env.SomeTool(targets, sources) - </sconstruct> - - <para> - The locations would include - <filename>SCons\Tool\SomeTool.py</filename> - <filename>SCons\Tool\SomeTool\__init__.py</filename> - <filename>.\site_scons\site_tools\SomeTool.py</filename> - <filename>.\site_scons\site_tools\SomeTool\__init__.py</filename> - - If a toolpath is specified this is also searched as well. - With nested or namespaced tools we can use the dot notation to specify a sub-directoty that the tool is located under - </para> - - <sconstruct> -# namespaced target -env = Environment(ENV = os.environ, tools = ['SubDir1.SubDir2.SomeTool']) -env.SomeTool(targets, sources) - </sconstruct> - - <para> - With this example the search locations would include - <filename>SCons\Tool\SubDir1\SubDir2\SomeTool.py</filename> - <filename>SCons\Tool\SubDir1\SubDir2\SomeTool\__init__.py</filename> - <filename>.\site_scons\site_tools\SubDir1\SubDir2\SomeTool.py</filename> - <filename>.\site_scons\site_tools\SubDir1\SubDir2\SomeTool\__init__.py</filename> - - It's important to note when creating tools within sub-directories, there needs to be a __init__.py file within each directory. - This file can just be empty however. - This is the same constraint used by python when loading modules from within sub-directories (packages). - - </para> - </section> - <!-- <section> diff --git a/doc/user/environments.xml b/doc/user/environments.xml index d1da3f9c..d591dff0 100644 --- a/doc/user/environments.xml +++ b/doc/user/environments.xml @@ -1765,4 +1765,128 @@ env.AppendENVPath('LIB', '/usr/local/lib') </section> + + <section id="sect-environment-toolpath"> + <title>Using the toolpath for external Tools</title> + + <section> + <title>The default tool search path</title> + + <para> + Normally when using a tool from the construction environment, + several different search locations are checked by default. + This includes the <literal>Scons/Tools/</literal> directory + inbuilt to scons and the directory <literal>site_scons/site_tools</literal> + relative to the root SConstruct file. + </para> + + <sconstruct> +# Inbuilt tool or tool located within site_tools +env = Environment(tools = ['SomeTool']) +env.SomeTool(targets, sources) + +# The search locations would include by default +SCons/Tool/SomeTool.py +SCons/Tool/SomeTool/__init__.py +./site_scons/site_tools/SomeTool.py +./site_scons/site_tools/SomeTool/__init__.py + </sconstruct> + + </section> + + <section> + <title>Providing an external directory to toolpath</title> + + <para> + In some cases you may want to specify a different location to search for tools. + The Environment constructor contains an option for this called toolpath + This can be used to add additional search directories. + </para> + + <sconstruct> +# Tool located within the toolpath directory option +env = Environment(tools = ['SomeTool'], toolpath = ['/opt/SomeToolPath', '/opt/SomeToolPath2']) +env.SomeTool(targets, sources) + +# The search locations in this example would include: +/opt/SomeToolPath/SomeTool.py +/opt/SomeToolPath/SomeTool/__init__.py +/opt/SomeToolPath2/SomeTool.py +/opt/SomeToolPath2/SomeTool/__init__.py +SCons/Tool/SomeTool.py +SCons/Tool/SomeTool/__init__.py +./site_scons/site_tools/SomeTool.py +./site_scons/site_tools/SomeTool/__init__.py + </sconstruct> + + </section> + + <section> + <title>Nested Tools within a toolpath</title> + + <para> + &SCons; 3.0 now supports the ability for a Builder to be located + within a sub-directory / sub-package of the toolpath. + This is similar to namespacing within python. + With nested or namespaced tools we can use the dot notation + to specify a sub-directory that the tool is located under. + </para> + + <sconstruct> +# namespaced target +env = Environment(tools = ['SubDir1.SubDir2.SomeTool'], toolpath = ['/opt/SomeToolPath']) +env.SomeTool(targets, sources) + +# With this example the search locations would include +/opt/SomeToolPath/SubDir1/SubDir2/SomeTool.py +/opt/SomeToolPath/SubDir1/SubDir2/SomeTool/__init__.py +SCons/Tool/SubDir1/SubDir2/SomeTool.py +SCons/Tool/SubDir1/SubDir2/SomeTool/__init__.py +./site_scons/site_tools/SubDir1/SubDir2/SomeTool.py +./site_scons/site_tools/SubDir1/SubDir2/SomeTool/__init__.py + </sconstruct> + + <para> + It's important to note when creating tools within sub-directories, + there needs to be a __init__.py file within each directory. + This file can just be empty. + This is the same constraint used by python when loading modules + from within sub-directories (packages). + </para> + </section> + + <section> + <title>Using sys.path within the toolpath</title> + + <para> + Using the toolpath option with sys.path + we can also include tools installed via the pip package manager. + </para> + + <sconstruct> +# namespaced target using sys.path within toolpath +env = Environment(tools = ['someinstalledpackage.SomeTool'], toolpath = sys.path) +env.SomeTool(targets, sources) + </sconstruct> + + <para> + By supplying sys.path to the toolpath argument + and by using the nested syntax we can have scons search + the sys.path (which will include packages installed via pip). + </para> + +<sconstruct> +# For Windows based on the python version and install directory, this may be something like +C:\Python35\Lib\site-packages\someinstalledpackage\SomeTool.py +C:\Python35\Lib\site-packages\someinstalledpackage\SomeTool\__init__.py + +# For Linux this could be something like: +/usr/lib/python3/dist-packages/someinstalledpackage/SomeTool.py +/usr/lib/python3/dist-packages/someinstalledpackage/SomeTool/__init__.py +</sconstruct> + + </section> + + </section> + </chapter> diff --git a/src/CHANGES.txt b/src/CHANGES.txt index c3cafca7..a5bfa312 100644 --- a/src/CHANGES.txt +++ b/src/CHANGES.txt @@ -11,14 +11,6 @@ NOTE: This is a major release. You should expect that some targets may rebuild Significant changes in some python action signatures. Also switching between PY 2 and PY 3.5, 3.6 may cause rebuilds. In no case should rebuilds not happen. - From Ibrahim Esmat: - - Added the capability to build Windows Store Compatible libraries that can be used - with Universal Windows Platform (UWP) Apps and published to the store - - From Richard West: - - Added nested / namespace tool support - - Added a small fix to the python3 tool loader when loading a tool as a package - From William Blevins: - Updated D language scanner support to latest: 2.071.1. (PR #1924) https://dlang.org/spec/module.html accessed 11 August 2016 @@ -43,6 +35,10 @@ may cause rebuilds. In no case should rebuilds not happen. - Changes to Action Function and Action Class signiture creation. NOTE: This will cause rebuilds for many builds when upgrading to SCons 3.0 + From Ibrahim Esmat: + - Added the capability to build Windows Store Compatible libraries that can be used + with Universal Windows Platform (UWP) Apps and published to the store + From Daniel Holth: - Add basic support for PyPy (by deleting __slots__ from Node with a metaclass on PyPy); wrap most-used open() calls in 'with' statements to @@ -85,6 +81,12 @@ may cause rebuilds. In no case should rebuilds not happen. - Fixed PCHPDBFLAGS causing a deprecation warning on MSVC v8 and later when using PCHs and PDBs together. + From Richard West: + - Added nested / namespace tool support + - Added a small fix to the python3 tool loader when loading a tool as a package + - Added additional documentation to the user manual on using toolpaths with the environment + This includes the use of sys.path to search for tools installed via pip or package managers + From Russel Winder: - Reordered the default D tools from "dmd, gdc, ldc" to "dmd, ldc, gdc". - Add a ProgramAllAtOnce builder to the dmd, ldc, and gdc tools. (PR #448) @@ -330,35 +332,40 @@ RELEASE 2.3.3 - Sun, 24 Aug 2014 21:08:33 -0400 RELEASE 2.3.2 + From Dirk Baechle: + - Update XML doc editor configuration + - Fix: Allow varlist to be specified as list of strings for Actions (#2754) + From veon on bitbucket: - Fixed handling of nested ifs in CPP scanner PreProcessor class. + From Shane Gannon: + - Support for Visual Studio 2013 (12.0) + From Michael Haubenwallner: - Respect user's CC/CXX values; don't always overwrite in generate() - Delegate linker Tool.exists() to CC/CXX Tool.exists(). + From Rob Managan: + - Updated the TeX builder to support use of the -synctex=1 + option and the files it creates. + - Updated the TeX builder to correctly clean auxiliary files when + the biblatex package is used. + + From Gary Oberbrunner: + - get default RPM architecture more robustly when building RPMs + From Amir Szekely: - Fixed NoClean() for multi-target builders (#2353). + From Paweł Tomulik: + - Fix SConf tests that write output + From Russel Winder: - Revamp of the D language support. Tools for DMD, GDC and LDC provided and integrated with the C and C++ linking. NOTE: This is only tested with D v2. Support for D v1 is now deprecated. - From Paweł Tomulik: - - Fix SConf tests that write output - ->>>>>>> other - From Gary Oberbrunner: - - get default RPM architecture more robustly when building RPMs - - From Shane Gannon: - - Support for Visual Studio 2013 (12.0) - - From Sye van der Veen: - - Support for Visual Studio 12.0Exp, and fixes for earlier MSVS - versions. - From Anatoly Techtonik: - Several improvements for running scons.py from source: * engine files form source directory take priority over all other @@ -373,15 +380,10 @@ RELEASE 2.3.2 SCons initialization (it will still be possible to use these tools explicitly) - From Dirk Baechle: - - Update XML doc editor configuration - - Fix: Allow varlist to be specified as list of strings for Actions (#2754) + From Sye van der Veen: + - Support for Visual Studio 12.0Exp, and fixes for earlier MSVS + versions. - From Rob Managan: - - Updated the TeX builder to support use of the -synctex=1 - option and the files it creates. - - Updated the TeX builder to correctly clean auxiliary files when - the biblatex package is used. RELEASE 2.3.1 diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py index 072daf0f..072daf0f 100644 --- a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool1.py +++ b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool1.py diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py index f4ccefee..f4ccefee 100644 --- a/test/toolpath/nested/image/tools/subdir1/subdir2/Toolpath_TestTool2.py +++ b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/__init__.py diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/sconstest.skip index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/sconstest.skip +++ b/test/toolpath/nested/image/Libs/tools_example/Toolpath_TestTool2/sconstest.skip diff --git a/test/toolpath/nested/image/tools/subdir1/__init__.py b/test/toolpath/nested/image/Libs/tools_example/__init__.py index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/tools/subdir1/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/__init__.py diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/sconstest.skip index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/sconstest.skip +++ b/test/toolpath/nested/image/Libs/tools_example/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py index adae55bb..2a70e678 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Site_TestTool2.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_1.py @@ -1,4 +1,4 @@ def generate(env):
- env['Site_TestTool2'] = 1
+ env['Toolpath_TestTool1_1'] = 1
def exists(env):
return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py index 60bbd02f..424991f1 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool3/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/__init__.py @@ -1,4 +1,4 @@ def generate(env):
- env['Site_TestTool3'] = 1
+ env['Toolpath_TestTool1_2'] = 1
def exists(env):
return 1
diff --git a/test/toolpath/nested/image/tools/subdir1/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/sconstest.skip index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/tools/subdir1/sconstest.skip +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/Toolpath_TestTool1_2/sconstest.skip diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/__init__.py index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/tools/subdir1/subdir2/__init__.py +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/__init__.py diff --git a/test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/subdir1/sconstest.skip index e69de29b..e69de29b 100644 --- a/test/toolpath/nested/image/tools/subdir1/subdir2/sconstest.skip +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/sconstest.skip diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py new file mode 100644 index 00000000..13d04963 --- /dev/null +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_1.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool2_1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py new file mode 100644 index 00000000..3f8fd5e2 --- /dev/null +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool2_2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/__init__.py b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/__init__.py diff --git a/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/sconstest.skip b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/Libs/tools_example/subdir1/subdir2/sconstest.skip diff --git a/test/toolpath/nested/image/SConstruct b/test/toolpath/nested/image/SConstruct index 284f21c5..211a0d73 100644 --- a/test/toolpath/nested/image/SConstruct +++ b/test/toolpath/nested/image/SConstruct @@ -1,15 +1,58 @@ -# Test where tools are located under site_scons/site_tools
-env1 = Environment(tools=['subdir1.Site_TestTool1', 'subdir1.subdir2.Site_TestTool2', 'subdir1.Site_TestTool3'])
-print("env1['Site_TestTool1'] =", env1.get('Site_TestTool1'))
-print("env1['Site_TestTool2'] =", env1.get('Site_TestTool2'))
-print("env1['Site_TestTool3'] =", env1.get('Site_TestTool3'))
-
-# Test where toolpath is set in the env constructor
-env2 = Environment(tools=['subdir1.Toolpath_TestTool1', 'subdir1.subdir2.Toolpath_TestTool2', 'subdir1.Toolpath_TestTool3'], toolpath=['tools'])
+import sys, os
+
+toollist = ['Toolpath_TestTool1',
+ 'Toolpath_TestTool2',
+ 'subdir1.Toolpath_TestTool1_1',
+ 'subdir1.Toolpath_TestTool1_2',
+ 'subdir1.subdir2.Toolpath_TestTool2_1',
+ 'subdir1.subdir2.Toolpath_TestTool2_2',
+ ]
+
+print('Test where tools are located under site_scons/site_tools')
+env1 = Environment(tools=toollist)
+print("env1['Toolpath_TestTool1'] =", env1.get('Toolpath_TestTool1'))
+print("env1['Toolpath_TestTool2'] =", env1.get('Toolpath_TestTool2'))
+print("env1['Toolpath_TestTool1_1'] =", env1.get('Toolpath_TestTool1_1'))
+print("env1['Toolpath_TestTool1_2'] =", env1.get('Toolpath_TestTool1_2'))
+print("env1['Toolpath_TestTool2_1'] =", env1.get('Toolpath_TestTool2_1'))
+print("env1['Toolpath_TestTool2_2'] =", env1.get('Toolpath_TestTool2_2'))
+
+print('Test where toolpath is set in the env constructor')
+env2 = Environment(tools=toollist, toolpath=['Libs/tools_example'])
print("env2['Toolpath_TestTool1'] =", env2.get('Toolpath_TestTool1'))
print("env2['Toolpath_TestTool2'] =", env2.get('Toolpath_TestTool2'))
-print("env2['Toolpath_TestTool3'] =", env2.get('Toolpath_TestTool3'))
+print("env2['Toolpath_TestTool1_1'] =", env2.get('Toolpath_TestTool1_1'))
+print("env2['Toolpath_TestTool1_2'] =", env2.get('Toolpath_TestTool1_2'))
+print("env2['Toolpath_TestTool2_1'] =", env2.get('Toolpath_TestTool2_1'))
+print("env2['Toolpath_TestTool2_2'] =", env2.get('Toolpath_TestTool2_2'))
+
+print('Test a Clone')
+base = Environment(tools=[], toolpath=['Libs/tools_example'])
+derived = base.Clone(tools=['subdir1.Toolpath_TestTool1_1'])
+print("derived['Toolpath_TestTool1_1'] =", derived.get('Toolpath_TestTool1_1'))
+
+
+print('Test using syspath as the toolpath')
+print('Lets pretend that tools_example within Libs is actually a module installed via pip')
+oldsyspath = sys.path
+dir_path = Dir('.').srcnode().abspath
+dir_path = os.path.join(dir_path, 'Libs')
+sys.path.append(dir_path)
+
+toollist = ['tools_example.Toolpath_TestTool1',
+ 'tools_example.Toolpath_TestTool2',
+ 'tools_example.subdir1.Toolpath_TestTool1_1',
+ 'tools_example.subdir1.Toolpath_TestTool1_2',
+ 'tools_example.subdir1.subdir2.Toolpath_TestTool2_1',
+ 'tools_example.subdir1.subdir2.Toolpath_TestTool2_2',
+ ]
+
+env3 = Environment(tools=toollist, toolpath=sys.path)
+print("env3['Toolpath_TestTool1'] =", env3.get('Toolpath_TestTool1'))
+print("env3['Toolpath_TestTool2'] =", env3.get('Toolpath_TestTool2'))
+print("env3['Toolpath_TestTool1_1'] =", env3.get('Toolpath_TestTool1_1'))
+print("env3['Toolpath_TestTool1_2'] =", env3.get('Toolpath_TestTool1_2'))
+print("env3['Toolpath_TestTool2_1'] =", env3.get('Toolpath_TestTool2_1'))
+print("env3['Toolpath_TestTool2_2'] =", env3.get('Toolpath_TestTool2_2'))
-base = Environment(tools=[], toolpath=['tools'])
-derived = base.Clone(tools=['subdir1.Toolpath_TestTool1'])
-print("derived['Toolpath_TestTool1'] =", derived.get('Toolpath_TestTool1'))
+sys.path = oldsyspath
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py index d4a19a82..072daf0f 100644 --- a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Site_TestTool1.py +++ b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool1.py @@ -1,4 +1,4 @@ def generate(env):
- env['Site_TestTool1'] = 1
+ env['Toolpath_TestTool1'] = 1
def exists(env):
return 1
diff --git a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py index 26bc7482..f4ccefee 100644 --- a/test/toolpath/nested/image/tools/subdir1/Toolpath_TestTool3/__init__.py +++ b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/__init__.py @@ -1,4 +1,4 @@ def generate(env):
- env['Toolpath_TestTool3'] = 1
+ env['Toolpath_TestTool2'] = 1
def exists(env):
return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/Toolpath_TestTool2/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/__init__.py diff --git a/test/toolpath/nested/image/site_scons/site_tools/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py new file mode 100644 index 00000000..2a70e678 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_1.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool1_1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py new file mode 100644 index 00000000..424991f1 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/__init__.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool1_2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/Toolpath_TestTool1_2/sconstest.skip diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py new file mode 100644 index 00000000..13d04963 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_1.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool2_1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py new file mode 100644 index 00000000..3f8fd5e2 --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/__init__.py @@ -0,0 +1,4 @@ +def generate(env):
+ env['Toolpath_TestTool2_2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/test/toolpath/nested/image/site_scons/site_tools/subdir1/subdir2/Toolpath_TestTool2_2/sconstest.skip diff --git a/test/toolpath/nested/nested.py b/test/toolpath/nested/nested.py index 7304dd57..a736d587 100644 --- a/test/toolpath/nested/nested.py +++ b/test/toolpath/nested/nested.py @@ -33,13 +33,30 @@ test.dir_fixture('image') test.run(arguments = '.', stdout = """\ scons: Reading SConscript files ... -env1['Site_TestTool1'] = 1 -env1['Site_TestTool2'] = 1 -env1['Site_TestTool3'] = 1 +Test where tools are located under site_scons/site_tools +env1['Toolpath_TestTool1'] = 1 +env1['Toolpath_TestTool2'] = 1 +env1['Toolpath_TestTool1_1'] = 1 +env1['Toolpath_TestTool1_2'] = 1 +env1['Toolpath_TestTool2_1'] = 1 +env1['Toolpath_TestTool2_2'] = 1 +Test where toolpath is set in the env constructor env2['Toolpath_TestTool1'] = 1 env2['Toolpath_TestTool2'] = 1 -env2['Toolpath_TestTool3'] = 1 -derived['Toolpath_TestTool1'] = 1 +env2['Toolpath_TestTool1_1'] = 1 +env2['Toolpath_TestTool1_2'] = 1 +env2['Toolpath_TestTool2_1'] = 1 +env2['Toolpath_TestTool2_2'] = 1 +Test a Clone +derived['Toolpath_TestTool1_1'] = 1 +Test using syspath as the toolpath +Lets pretend that tools_example within Libs is actually a module installed via pip +env3['Toolpath_TestTool1'] = 1 +env3['Toolpath_TestTool2'] = 1 +env3['Toolpath_TestTool1_1'] = 1 +env3['Toolpath_TestTool1_2'] = 1 +env3['Toolpath_TestTool2_1'] = 1 +env3['Toolpath_TestTool2_2'] = 1 scons: done reading SConscript files. scons: Building targets ... scons: `.' is up to date. |