summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussel Winder <russel@winder.org.uk>2017-07-02 07:02:35 (GMT)
committerRussel Winder <russel@winder.org.uk>2017-07-02 07:02:35 (GMT)
commit09744e75d75f5b9e83ae00096162497a89d0c7ec (patch)
tree31c8ccaa7d7a80ed8665da0b4078e6acb8199155
parent5c58fce9cf4e0fc3e8d0f44ec9181700f1380092 (diff)
parentfe8669695dad03dfe0c9e8b322d3ec86d8301229 (diff)
downloadSCons-09744e75d75f5b9e83ae00096162497a89d0c7ec.zip
SCons-09744e75d75f5b9e83ae00096162497a89d0c7ec.tar.gz
SCons-09744e75d75f5b9e83ae00096162497a89d0c7ec.tar.bz2
Merge mainline.
-rw-r--r--QMTest/TestCmd.py5
-rw-r--r--src/CHANGES.txt5
-rw-r--r--src/engine/SCons/ActionTests.py116
-rw-r--r--src/engine/SCons/Tool/__init__.py2
-rw-r--r--src/engine/SCons/Tool/docbook/__init__.py8
-rw-r--r--src/engine/SCons/Tool/zip.py44
-rw-r--r--src/script/scons.py10
-rw-r--r--src/setup.py304
-rw-r--r--test/toolpath/relative_import/image/SConstruct10
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py4
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py4
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py4
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/sconstest.skip0
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py11
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/sconstest.skip0
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/__init__.py9
-rw-r--r--test/toolpath/relative_import/image/tools/TestTool1/sconstest.skip0
-rw-r--r--test/toolpath/relative_import/relative_import.py53
18 files changed, 380 insertions, 209 deletions
diff --git a/QMTest/TestCmd.py b/QMTest/TestCmd.py
index e4c69a6..61da8b9 100644
--- a/QMTest/TestCmd.py
+++ b/QMTest/TestCmd.py
@@ -307,7 +307,8 @@ import traceback
import types
-PY3 = sys.version_info[0] == 3
+IS_PY3 = sys.version_info[0] == 3
+IS_WINDOWS = sys.platform == 'win32'
class null(object):
@@ -1245,7 +1246,7 @@ class TestCmd(object):
file = self.canonicalize(file)
if mode[0] != 'r':
raise ValueError("mode must begin with 'r'")
- if PY3 and 'b' not in mode:
+ if IS_PY3 and 'b' not in mode:
return open(file, mode, newline=newline).read()
else:
return open(file, mode).read()
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 9966229..5be0399 100644
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -7,6 +7,10 @@
RELEASE 3.0.0.alpha.20170614 - Mon, 14 Jun 2017 12:23:56 -0400
+NOTE: This is a major release. You should expect that some targets may rebuild when upgrading.
+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 Richard West:
- Added nested / namespace tool support
- Added a small fix to the python3 tool loader when loading a tool as a package
@@ -39,6 +43,7 @@ RELEASE 3.0.0.alpha.20170614 - Mon, 14 Jun 2017 12:23:56 -0400
avoid too many open files.
- Add __main__.py for `python -m SCons` in case it is on PYTHONPATH.
- Always use highest available pickle protocol for efficiency.
+ - Remove unused command line fallback for the zip tool.
From Gaurav Juvekar:
- Fix issue #2832: Expand construction variables in 'chdir' argument of builders. (PR #463)
diff --git a/src/engine/SCons/ActionTests.py b/src/engine/SCons/ActionTests.py
index 82c5e0e..34d9ffc 100644
--- a/src/engine/SCons/ActionTests.py
+++ b/src/engine/SCons/ActionTests.py
@@ -1428,10 +1428,16 @@ class CommandGeneratorActionTestCase(unittest.TestCase):
def LocalFunc():
pass
- func_matches = [
- b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
- b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
- ]
+ if TestCmd.IS_PY3 and TestCmd.IS_WINDOWS:
+ func_matches = [
+ b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()', # PY 3.6
+ b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()', # PY 3.5
+ ]
+ else:
+ func_matches = [
+ b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
+ b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
+ ]
meth_matches = [
b"1, 1, 0, 0,(),(),(d\000\000S),(),()",
@@ -1590,22 +1596,32 @@ class FunctionActionTestCase(unittest.TestCase):
def LocalFunc():
pass
- func_matches = [
- b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
- b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
+ if TestCmd.IS_PY3 and TestCmd.IS_WINDOWS:
+ func_matches = [
+ b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()', # py 3.6
+ b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()' # py 3.5
+ ]
+ meth_matches = [
+ b'1, 1, 0, 0,(),(),(d\x00S\x00),(),()', # py 3.6
+ b'1, 1, 0, 0,(),(),(d\x00\x00S),(),()', # py 3.5
]
- meth_matches = [
- b"1, 1, 0, 0,(),(),(d\000\000S),(),()",
- b"1, 1, 0, 0,(),(),(d\x00\x00S),(),()",
- ]
+ else:
+ func_matches = [
+ b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
+ b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
+ ]
+
+ meth_matches = [
+ b"1, 1, 0, 0,(),(),(d\000\000S),(),()",
+ b"1, 1, 0, 0,(),(),(d\x00\x00S),(),()",
+ ]
def factory(act, **kw):
return SCons.Action.FunctionAction(act, kw)
a = factory(GlobalFunc)
c = a.get_contents(target=[], source=[], env=Environment())
- # assert c in func_matches, repr(c)
assert c in func_matches, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(f) for f in func_matches])
@@ -1642,7 +1658,7 @@ class FunctionActionTestCase(unittest.TestCase):
lc = LocalClass()
a = factory(lc.LocalMethod)
c = a.get_contents(target=[], source=[], env=Environment())
- assert c in meth_matches, repr(c)
+ assert c in meth_matches, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(f) for f in meth_matches])
def test_strfunction(self):
"""Test the FunctionAction.strfunction() method
@@ -1808,10 +1824,16 @@ class LazyActionTestCase(unittest.TestCase):
def LocalFunc():
pass
- func_matches = [
- b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
- b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
- ]
+ if TestCmd.IS_PY3 and TestCmd.IS_WINDOWS:
+ func_matches = [
+ b'0, 0, 0, 0,(),(),(d\x00S\x00),(),()',
+ b'0, 0, 0, 0,(),(),(d\x00\x00S),(),()'
+ ]
+ else:
+ func_matches = [
+ b"0, 0, 0, 0,(),(),(d\000\000S),(),()",
+ b"0, 0, 0, 0,(),(),(d\x00\x00S),(),()",
+ ]
meth_matches = [
b"1, 1, 0, 0,(),(),(d\000\000S),(),()",
@@ -1859,10 +1881,16 @@ class ActionCallerTestCase(unittest.TestCase):
def LocalFunc():
pass
- matches = [
- b"d\000\000S",
- b"d\\x00\\x00S"
- ]
+ if TestCmd.IS_PY3 and TestCmd.IS_WINDOWS:
+ matches = [
+ b'd\x00S\x00',
+ b'd\x00\x00S'
+ ]
+ else:
+ matches = [
+ b"d\000\000S",
+ b"d\\x00\\x00S"
+ ]
af = SCons.Action.ActionFactory(GlobalFunc, strfunc)
ac = SCons.Action.ActionCaller(af, [], {})
@@ -1874,10 +1902,11 @@ class ActionCallerTestCase(unittest.TestCase):
c = ac.get_contents([], [], Environment())
assert c in matches, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(f) for f in matches])
- matches = [
- b'd\000\000S',
- b"d\x00\x00S"
- ]
+ # TODO: Same as above, why redefine?
+ # matches = [
+ # b'd\000\000S',
+ # b"d\x00\x00S"
+ # ]
class LocalActFunc(object):
def __call__(self):
@@ -2044,8 +2073,12 @@ class ObjectContentsTestCase(unittest.TestCase):
return a
c = SCons.Action._function_contents(func1)
- expected = bytearray('3, 3, 0, 0,(),(),(|\x00\x00S),(),()','utf-8')
- assert expected == c, "Got\n"+repr(c)+"\nExpected \n"+repr(expected)+"\n"
+ if TestCmd.IS_PY3 and TestCmd.IS_WINDOWS:
+ expected = [b'3, 3, 0, 0,(),(),(|\x00S\x00),(),()',
+ b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()']
+ else:
+ expected = [b'3, 3, 0, 0,(),(),(|\x00\x00S),(),()']
+ assert c in expected, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(e) for e in expected])
# @unittest.skip("Results vary between py2 and py3, not sure if test makes sense to implement")
@@ -2055,8 +2088,21 @@ class ObjectContentsTestCase(unittest.TestCase):
# See definition above
o = TestClass()
c = SCons.Action._object_contents(o)
- expected = bytearray("(i__main__\nTestClass\np1\n(dp2\nS'a'\nS'a'\nsS'b'\nS'b'\nsb.", 'utf-8')
- assert expected == c, "Got\n" + repr(c) + "\nExpected\n" + repr(expected)
+
+ if TestCmd.IS_PY3:
+ if TestCmd.IS_WINDOWS:
+ expected = [b'ccopy_reg\n_reconstructor\nq\x00(c__main__\nTestClass\nq\x01c__builtin__\nobject\nq\x02Ntq\x03Rq\x04}q\x05(X\x01\x00\x00\x00aq\x06h\x06X\x01\x00\x00\x00bq\x07h\x07ub.', # py 3.6
+ b'ccopy_reg\n_reconstructor\nq\x00(c__main__\nTestClass\nq\x01c__builtin__\nobject\nq\x02Ntq\x03Rq\x04}q\x05(X\x01\x00\x00\x00bq\x06h\x06X\x01\x00\x00\x00aq\x07h\x07ub.', # py 3.5
+ ]
+ else:
+ expected = [b'ccopy_reg\n_reconstructor\nq\x00(c__main__\nTestClass\nq\x01c__builtin__\nobject\nq\x02Ntq\x03Rq\x04}q\x05(X\x01\x00\x00\x00bq\x06h\x06X\x01\x00\x00\x00aq\x07h\x07ub.']
+ else:
+ if TestCmd.IS_WINDOWS:
+ expected = [b'(c__main__\nTestClass\nq\x01oq\x02}q\x03(U\x01aU\x01aU\x01bU\x01bub.']
+ else:
+ expected = [b'(c__main__\nTestClass\nq\x01oq\x02}q\x03(U\x01aU\x01aU\x01bU\x01bub.']
+
+ assert c in expected, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(e) for e in expected])
# @unittest.skip("Results vary between py2 and py3, not sure if test makes sense to implement")
def test_code_contents(self):
@@ -2064,8 +2110,16 @@ class ObjectContentsTestCase(unittest.TestCase):
code = compile("print('Hello, World!')", '<string>', 'exec')
c = SCons.Action._code_contents(code)
- expected = bytearray("0, 0, 0, 0,(N.),(),(d\x00\x00GHd\x01\x00S)", 'utf-8')
- assert expected == c, "Got\n" + repr(c) + "\nExpected\n" + repr(expected)
+ if TestCmd.IS_PY3:
+ if TestCmd.IS_WINDOWS:
+ expected = [b'0, 0, 0, 0,(N.),(X\x05\x00\x00\x00printq\x00.),(e\x00d\x00\x83\x01\x01\x00d\x01S\x00)',
+ b'0, 0, 0, 0,(N.),(X\x05\x00\x00\x00printq\x00.),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)'
+ ]
+ else:
+ expected = [b'0, 0, 0, 0,(N.),(X\x05\x00\x00\x00printq\x00.),(e\x00\x00d\x00\x00\x83\x01\x00\x01d\x01\x00S)']
+ else:
+ expected = [b"0, 0, 0, 0,(N.),(),(d\x00\x00GHd\x01\x00S)"]
+ assert c in expected, "Got\n"+repr(c)+"\nExpected one of \n"+"\n".join([repr(e) for e in expected])
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index f022a1f..1ab43e7 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -228,7 +228,7 @@ class Tool(object):
# Not sure what to do in the case that there already
# exists sys.modules[self.name] but the source file is
# different.. ?
- spec.loader.exec_module(module)
+ module = spec.loader.load_module(spec.name)
sys.modules[found_name] = module
if add_to_scons_tools_namespace:
diff --git a/src/engine/SCons/Tool/docbook/__init__.py b/src/engine/SCons/Tool/docbook/__init__.py
index d3ea8ae..d60789d 100644
--- a/src/engine/SCons/Tool/docbook/__init__.py
+++ b/src/engine/SCons/Tool/docbook/__init__.py
@@ -43,6 +43,8 @@ import SCons.Script
import SCons.Tool
import SCons.Util
+
+__debug_tool_location = False
# Get full path to this script
scriptpath = os.path.dirname(os.path.realpath(__file__))
@@ -182,8 +184,12 @@ def __detect_cl_tool(env, chainkey, cdict, cpriority=None):
if cpriority is None:
cpriority = cdict.keys()
for cltool in cpriority:
+ if __debug_tool_location:
+ print("DocBook: Looking for %s"%cltool)
clpath = env.WhereIs(cltool)
if clpath:
+ if __debug_tool_location:
+ print("DocBook: Found:%s"%cltool)
env[chainkey] = clpath
if not env[chainkey + 'COM']:
env[chainkey + 'COM'] = cdict[cltool]
@@ -204,7 +210,7 @@ def _detect(env):
__detect_cl_tool(env, 'DOCBOOK_XSLTPROC', xsltproc_com, xsltproc_com_priority)
__detect_cl_tool(env, 'DOCBOOK_XMLLINT', xmllint_com)
- __detect_cl_tool(env, 'DOCBOOK_FOP', fop_com)
+ __detect_cl_tool(env, 'DOCBOOK_FOP', fop_com, ['fop','xep','jw'])
#
# Scanners
diff --git a/src/engine/SCons/Tool/zip.py b/src/engine/SCons/Tool/zip.py
index 2613bfc..23d540f 100644
--- a/src/engine/SCons/Tool/zip.py
+++ b/src/engine/SCons/Tool/zip.py
@@ -40,31 +40,23 @@ import SCons.Defaults
import SCons.Node.FS
import SCons.Util
-try:
- import zipfile
- internal_zip = 1
-except ImportError:
- internal_zip = 0
-
-if internal_zip:
- zipcompression = zipfile.ZIP_DEFLATED
- def zip(target, source, env):
- compression = env.get('ZIPCOMPRESSION', 0)
- zf = zipfile.ZipFile(str(target[0]), 'w', compression)
- for s in source:
- if s.isdir():
- for dirpath, dirnames, filenames in os.walk(str(s)):
- for fname in filenames:
- path = os.path.join(dirpath, fname)
- if os.path.isfile(path):
- zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', ''))))
- else:
- zf.write(str(s), os.path.relpath(str(s), str(env.get('ZIPROOT', ''))))
- zf.close()
-else:
- zipcompression = 0
- zip = "$ZIP $ZIPFLAGS ${TARGET.abspath} $SOURCES"
-
+import zipfile
+
+zipcompression = zipfile.ZIP_DEFLATED
+def zip(target, source, env):
+ compression = env.get('ZIPCOMPRESSION', 0)
+ zf = zipfile.ZipFile(str(target[0]), 'w', compression)
+ for s in source:
+ if s.isdir():
+ for dirpath, dirnames, filenames in os.walk(str(s)):
+ for fname in filenames:
+ path = os.path.join(dirpath, fname)
+ if os.path.isfile(path):
+
+ zf.write(path, os.path.relpath(path, str(env.get('ZIPROOT', ''))))
+ else:
+ zf.write(str(s), os.path.relpath(str(s), str(env.get('ZIPROOT', ''))))
+ zf.close()
zipAction = SCons.Action.Action(zip, varlist=['ZIPCOMPRESSION'])
@@ -91,7 +83,7 @@ def generate(env):
env['ZIPROOT'] = SCons.Util.CLVar('')
def exists(env):
- return internal_zip or env.Detect('zip')
+ return True
# Local Variables:
# tab-width:4
diff --git a/src/script/scons.py b/src/script/scons.py
index 1cf9469..bdf0cea 100644
--- a/src/script/scons.py
+++ b/src/script/scons.py
@@ -58,11 +58,11 @@ import sys
# 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)
+if (3,0,0) < sys.version_info < (3,5,0) or sys.version_info < (2,7,0):
+ msg = "scons: *** SCons version %s does not run under Python version %s.\n\
+Python < 3.5 is not yet supported.\n"
+ sys.stderr.write(msg % (__version__, sys.version.split()[0]))
+ sys.exit(1)
script_dir = sys.path[0]
diff --git a/src/setup.py b/src/setup.py
index 41fc35a..1957db6 100644
--- a/src/setup.py
+++ b/src/setup.py
@@ -54,7 +54,6 @@ if head:
os.chdir(head)
sys.argv[0] = tail
-
# flag if setup.py is run on win32 or _for_ win32 platform,
# (when building windows installer on linux, for example)
is_win32 = 0
@@ -67,7 +66,6 @@ if not sys.platform == 'win32':
else:
is_win32 = 1
-
import distutils
import distutils.core
import distutils.command.install
@@ -77,6 +75,7 @@ import distutils.command.install_scripts
import distutils.command.build_scripts
import distutils.msvccompiler
+
def get_build_version():
""" monkey patch distutils msvc version if we're not on windows.
We need to use vc version 9 for python 2.7.x and it defaults to 6
@@ -84,6 +83,7 @@ def get_build_version():
monkey patching"""
return 9
+
distutils.msvccompiler.get_build_version = get_build_version
_install = distutils.command.install.install
@@ -92,13 +92,16 @@ _install_lib = distutils.command.install_lib.install_lib
_install_scripts = distutils.command.install_scripts.install_scripts
_build_scripts = distutils.command.build_scripts.build_scripts
+
class _options(object):
pass
+
Options = _options()
Installed = []
+
def set_explicitly(name, args):
"""
Return if the installation directory was set explicitly by the
@@ -119,51 +122,52 @@ def set_explicitly(name, args):
break
return set
+
class install(_install):
user_options = _install.user_options + [
- ('no-scons-script', None,
- "don't install 'scons', only install 'scons-%s'" % Version),
- ('no-version-script', None,
- "don't install 'scons-%s', only install 'scons'" % Version),
- ('install-bat', None,
- "install 'scons.bat' script"),
- ('no-install-bat', None,
- "do not install 'scons.bat' script"),
- ('install-man', None,
- "install SCons man pages"),
- ('no-install-man', None,
- "do not install SCons man pages"),
- ('standard-lib', None,
- "install SCons library in standard Python location"),
- ('standalone-lib', None,
- "install SCons library in separate standalone directory"),
- ('version-lib', None,
- "install SCons library in version-numbered directory"),
- ]
+ ('no-scons-script', None,
+ "don't install 'scons', only install 'scons-%s'" % Version),
+ ('no-version-script', None,
+ "don't install 'scons-%s', only install 'scons'" % Version),
+ ('install-bat', None,
+ "install 'scons.bat' script"),
+ ('no-install-bat', None,
+ "do not install 'scons.bat' script"),
+ ('install-man', None,
+ "install SCons man pages"),
+ ('no-install-man', None,
+ "do not install SCons man pages"),
+ ('standard-lib', None,
+ "install SCons library in standard Python location"),
+ ('standalone-lib', None,
+ "install SCons library in separate standalone directory"),
+ ('version-lib', None,
+ "install SCons library in version-numbered directory"),
+ ]
boolean_options = _install.boolean_options + [
- 'no-scons-script',
- 'no-version-script',
- 'install-bat',
- 'no-install-bat',
- 'install-man',
- 'no-install-man',
- 'standard-lib',
- 'standalone-lib',
- 'version-lib'
- ]
+ 'no-scons-script',
+ 'no-version-script',
+ 'install-bat',
+ 'no-install-bat',
+ 'install-man',
+ 'no-install-man',
+ 'standard-lib',
+ 'standalone-lib',
+ 'version-lib'
+ ]
if hasattr(os, 'link'):
user_options.append(
- ('hardlink-scons', None,
- "hard link 'scons' to the version-numbered script, don't make a separate 'scons' copy"),
- )
+ ('hardlink-scons', None,
+ "hard link 'scons' to the version-numbered script, don't make a separate 'scons' copy"),
+ )
boolean_options.append('hardlink-script')
if hasattr(os, 'symlink'):
user_options.append(
- ('symlink-scons', None,
- "make 'scons' a symbolic link to the version-numbered script, don't make a separate 'scons' copy"),
- )
+ ('symlink-scons', None,
+ "make 'scons' a symbolic link to the version-numbered script, don't make a separate 'scons' copy"),
+ )
boolean_options.append('symlink-script')
def initialize_options(self):
@@ -201,6 +205,7 @@ class install(_install):
Options.hardlink_scons = self.hardlink_scons
Options.symlink_scons = self.symlink_scons
+
def get_scons_prefix(libdir, is_win32):
"""
Return the right prefix for SCons library installation. Find
@@ -225,6 +230,7 @@ def get_scons_prefix(libdir, is_win32):
return os.path.join(drive + head)
return libdir
+
def force_to_usr_local(self):
"""
A hack to decide if we need to "force" the installation directories
@@ -236,6 +242,7 @@ def force_to_usr_local(self):
(self.install_dir[:9] == '/Library/' or
self.install_dir[:16] == '/System/Library/'))
+
class install_lib(_install_lib):
def finalize_options(self):
_install_lib.finalize_options(self)
@@ -258,6 +265,7 @@ class install_lib(_install_lib):
msg = "Installed SCons library modules into %s" % self.install_dir
Installed.append(msg)
+
class install_scripts(_install_scripts):
def finalize_options(self):
_install_scripts.finalize_options(self)
@@ -271,18 +279,24 @@ class install_scripts(_install_scripts):
pass
def hardlink_scons(self, src, dst, ver):
- try: os.unlink(dst)
- except OSError: pass
+ try:
+ os.unlink(dst)
+ except OSError:
+ pass
os.link(ver, dst)
def symlink_scons(self, src, dst, ver):
- try: os.unlink(dst)
- except OSError: pass
+ try:
+ os.unlink(dst)
+ except OSError:
+ pass
os.symlink(os.path.split(ver)[1], dst)
def copy_scons(self, src, dst, *args):
- try: os.unlink(dst)
- except OSError: pass
+ try:
+ os.unlink(dst)
+ except OSError:
+ pass
self.copy_file(src, dst)
self.outfiles.append(dst)
@@ -337,7 +351,7 @@ class install_scripts(_install_scripts):
self.copy_scons(src, scons_version_bat)
# --- distutils copy/paste ---
- if hasattr(os, 'chmod') and hasattr(os,'stat'):
+ if hasattr(os, 'chmod') and hasattr(os, 'stat'):
# Set the executable bits (owner, group, and world) on
# all the scripts we just installed.
for file in self.get_outputs():
@@ -347,20 +361,23 @@ class install_scripts(_install_scripts):
else:
# Use symbolic versions of permissions so this script doesn't fail to parse under python3.x
exec_and_read_permission = stat.S_IXOTH | stat.S_IXUSR | stat.S_IXGRP | stat.S_IROTH | stat.S_IRUSR | stat.S_IRGRP
- mode_mask = 4095 # Octal 07777 used because python3 has different octal syntax than python 2
+ mode_mask = 4095 # Octal 07777 used because python3 has different octal syntax than python 2
mode = ((os.stat(file)[stat.ST_MODE]) | exec_and_read_permission) & mode_mask
# log.info("changing mode of %s to %o", file, mode)
os.chmod(file, mode)
- # --- /distutils copy/paste ---
+ # --- /distutils copy/paste ---
+
class build_scripts(_build_scripts):
def finalize_options(self):
_build_scripts.finalize_options(self)
self.build_dir = os.path.join('build', 'scripts')
+
class install_data(_install_data):
def initialize_options(self):
_install_data.initialize_options(self)
+
def finalize_options(self):
_install_data.finalize_options(self)
if force_to_usr_local(self):
@@ -377,6 +394,7 @@ class install_data(_install_data):
else:
self.data_files = []
+
description = "Open Source next-generation build tool."
long_description = """Open Source next-generation build tool.
@@ -398,103 +416,103 @@ scripts = [
]
arguments = {
- 'name' : "scons",
- 'version' : Version,
- 'description' : description,
- 'long_description' : long_description,
- 'author' : 'Steven Knight',
- 'author_email' : 'knight@baldmt.com',
- 'url' : "http://www.scons.org/",
- 'packages' : ["SCons",
- "SCons.compat",
- "SCons.Node",
- "SCons.Options",
- "SCons.Platform",
- "SCons.Scanner",
- "SCons.Script",
- "SCons.Tool",
- "SCons.Tool.docbook",
- "SCons.Tool.MSCommon",
- "SCons.Tool.packaging",
- "SCons.Variables",
- ],
- 'package_dir' : {'' : 'engine',
- 'SCons.Tool.docbook' : 'engine/SCons/Tool/docbook'},
- 'package_data' : {'SCons.Tool.docbook' : ['docbook-xsl-1.76.1/*',
- 'docbook-xsl-1.76.1/common/*',
- 'docbook-xsl-1.76.1/docsrc/*',
- 'docbook-xsl-1.76.1/eclipse/*',
- 'docbook-xsl-1.76.1/epub/*',
- 'docbook-xsl-1.76.1/epub/bin/*',
- 'docbook-xsl-1.76.1/epub/bin/lib/*',
- 'docbook-xsl-1.76.1/epub/bin/xslt/*',
- 'docbook-xsl-1.76.1/extensions/*',
- 'docbook-xsl-1.76.1/fo/*',
- 'docbook-xsl-1.76.1/highlighting/*',
- 'docbook-xsl-1.76.1/html/*',
- 'docbook-xsl-1.76.1/htmlhelp/*',
- 'docbook-xsl-1.76.1/images/*',
- 'docbook-xsl-1.76.1/images/callouts/*',
- 'docbook-xsl-1.76.1/images/colorsvg/*',
- 'docbook-xsl-1.76.1/javahelp/*',
- 'docbook-xsl-1.76.1/lib/*',
- 'docbook-xsl-1.76.1/manpages/*',
- 'docbook-xsl-1.76.1/params/*',
- 'docbook-xsl-1.76.1/profiling/*',
- 'docbook-xsl-1.76.1/roundtrip/*',
- 'docbook-xsl-1.76.1/slides/browser/*',
- 'docbook-xsl-1.76.1/slides/fo/*',
- 'docbook-xsl-1.76.1/slides/graphics/*',
- 'docbook-xsl-1.76.1/slides/graphics/active/*',
- 'docbook-xsl-1.76.1/slides/graphics/inactive/*',
- 'docbook-xsl-1.76.1/slides/graphics/toc/*',
- 'docbook-xsl-1.76.1/slides/html/*',
- 'docbook-xsl-1.76.1/slides/htmlhelp/*',
- 'docbook-xsl-1.76.1/slides/keynote/*',
- 'docbook-xsl-1.76.1/slides/keynote/xsltsl/*',
- 'docbook-xsl-1.76.1/slides/svg/*',
- 'docbook-xsl-1.76.1/slides/xhtml/*',
- 'docbook-xsl-1.76.1/template/*',
- 'docbook-xsl-1.76.1/tests/*',
- 'docbook-xsl-1.76.1/tools/bin/*',
- 'docbook-xsl-1.76.1/tools/make/*',
- 'docbook-xsl-1.76.1/webhelp/*',
- 'docbook-xsl-1.76.1/webhelp/docs/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/css/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/*',
- 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/images/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/search/*',
- 'docbook-xsl-1.76.1/webhelp/docs/content/search/stemmers/*',
- 'docbook-xsl-1.76.1/webhelp/docsrc/*',
- 'docbook-xsl-1.76.1/webhelp/template/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/css/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/*',
- 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/images/*',
- 'docbook-xsl-1.76.1/webhelp/template/content/search/*',
- 'docbook-xsl-1.76.1/webhelp/template/content/search/stemmers/*',
- 'docbook-xsl-1.76.1/webhelp/xsl/*',
- 'docbook-xsl-1.76.1/website/*',
- 'docbook-xsl-1.76.1/xhtml/*',
- 'docbook-xsl-1.76.1/xhtml-1_1/*',
- 'utils/*']},
- 'data_files' : [('man/man1', man_pages)],
- 'scripts' : scripts,
- 'cmdclass' : {'install' : install,
- 'install_lib' : install_lib,
- 'install_data' : install_data,
- 'install_scripts' : install_scripts,
- 'build_scripts' : build_scripts}
+ 'name': "scons",
+ 'version': Version,
+ 'description': description,
+ 'long_description': long_description,
+ 'author': 'Steven Knight',
+ 'author_email': 'knight@baldmt.com',
+ 'url': "http://www.scons.org/",
+ 'packages': ["SCons",
+ "SCons.compat",
+ "SCons.Node",
+ "SCons.Options",
+ "SCons.Platform",
+ "SCons.Scanner",
+ "SCons.Script",
+ "SCons.Tool",
+ "SCons.Tool.docbook",
+ "SCons.Tool.MSCommon",
+ "SCons.Tool.packaging",
+ "SCons.Variables",
+ ],
+ 'package_dir': {'': 'engine',
+ 'SCons.Tool.docbook': 'engine/SCons/Tool/docbook'},
+ 'package_data': {'SCons.Tool.docbook': ['docbook-xsl-1.76.1/*',
+ 'docbook-xsl-1.76.1/common/*',
+ 'docbook-xsl-1.76.1/docsrc/*',
+ 'docbook-xsl-1.76.1/eclipse/*',
+ 'docbook-xsl-1.76.1/epub/*',
+ 'docbook-xsl-1.76.1/epub/bin/*',
+ 'docbook-xsl-1.76.1/epub/bin/lib/*',
+ 'docbook-xsl-1.76.1/epub/bin/xslt/*',
+ 'docbook-xsl-1.76.1/extensions/*',
+ 'docbook-xsl-1.76.1/fo/*',
+ 'docbook-xsl-1.76.1/highlighting/*',
+ 'docbook-xsl-1.76.1/html/*',
+ 'docbook-xsl-1.76.1/htmlhelp/*',
+ 'docbook-xsl-1.76.1/images/*',
+ 'docbook-xsl-1.76.1/images/callouts/*',
+ 'docbook-xsl-1.76.1/images/colorsvg/*',
+ 'docbook-xsl-1.76.1/javahelp/*',
+ 'docbook-xsl-1.76.1/lib/*',
+ 'docbook-xsl-1.76.1/manpages/*',
+ 'docbook-xsl-1.76.1/params/*',
+ 'docbook-xsl-1.76.1/profiling/*',
+ 'docbook-xsl-1.76.1/roundtrip/*',
+ 'docbook-xsl-1.76.1/slides/browser/*',
+ 'docbook-xsl-1.76.1/slides/fo/*',
+ 'docbook-xsl-1.76.1/slides/graphics/*',
+ 'docbook-xsl-1.76.1/slides/graphics/active/*',
+ 'docbook-xsl-1.76.1/slides/graphics/inactive/*',
+ 'docbook-xsl-1.76.1/slides/graphics/toc/*',
+ 'docbook-xsl-1.76.1/slides/html/*',
+ 'docbook-xsl-1.76.1/slides/htmlhelp/*',
+ 'docbook-xsl-1.76.1/slides/keynote/*',
+ 'docbook-xsl-1.76.1/slides/keynote/xsltsl/*',
+ 'docbook-xsl-1.76.1/slides/svg/*',
+ 'docbook-xsl-1.76.1/slides/xhtml/*',
+ 'docbook-xsl-1.76.1/template/*',
+ 'docbook-xsl-1.76.1/tests/*',
+ 'docbook-xsl-1.76.1/tools/bin/*',
+ 'docbook-xsl-1.76.1/tools/make/*',
+ 'docbook-xsl-1.76.1/webhelp/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/css/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/images/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/theme-redmond/images/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/common/jquery/treeview/images/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/content/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/content/search/*',
+ 'docbook-xsl-1.76.1/webhelp/docs/content/search/stemmers/*',
+ 'docbook-xsl-1.76.1/webhelp/docsrc/*',
+ 'docbook-xsl-1.76.1/webhelp/template/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/css/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/images/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/jquery/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/jquery/theme-redmond/images/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/*',
+ 'docbook-xsl-1.76.1/webhelp/template/common/jquery/treeview/images/*',
+ 'docbook-xsl-1.76.1/webhelp/template/content/search/*',
+ 'docbook-xsl-1.76.1/webhelp/template/content/search/stemmers/*',
+ 'docbook-xsl-1.76.1/webhelp/xsl/*',
+ 'docbook-xsl-1.76.1/website/*',
+ 'docbook-xsl-1.76.1/xhtml/*',
+ 'docbook-xsl-1.76.1/xhtml-1_1/*',
+ 'utils/*']},
+ 'data_files': [('man/man1', man_pages)],
+ 'scripts': scripts,
+ 'cmdclass': {'install': install,
+ 'install_lib': install_lib,
+ 'install_data': install_data,
+ 'install_scripts': install_scripts,
+ 'build_scripts': build_scripts}
}
distutils.core.setup(**arguments)
diff --git a/test/toolpath/relative_import/image/SConstruct b/test/toolpath/relative_import/image/SConstruct
new file mode 100644
index 0000000..6156929
--- /dev/null
+++ b/test/toolpath/relative_import/image/SConstruct
@@ -0,0 +1,10 @@
+env = Environment(tools=['TestTool1', 'TestTool1.TestTool1_2'], toolpath=['tools'])
+
+# Test a relative import within the root of the tools directory
+print("env['TestTool1'] =", env.get('TestTool1'))
+print("env['TestTool1_1'] =", env.get('TestTool1_1'))
+
+# Test a relative import within a sub dir
+print("env['TestTool1_2'] =", env.get('TestTool1_2'))
+print("env['TestTool1_2_1'] =", env.get('TestTool1_2_1'))
+print("env['TestTool1_2_2'] =", env.get('TestTool1_2_2'))
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py
new file mode 100644
index 0000000..4c9a7bc
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_1.py
@@ -0,0 +1,4 @@
+def generate(env):
+ env['TestTool1_1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py
new file mode 100644
index 0000000..e65f8cd
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_1.py
@@ -0,0 +1,4 @@
+def generate(env):
+ env['TestTool1_2_1'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py
new file mode 100644
index 0000000..463baee
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/__init__.py
@@ -0,0 +1,4 @@
+def generate(env):
+ env['TestTool1_2_2'] = 1
+def exists(env):
+ return 1
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/sconstest.skip b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/TestTool1_2_2/sconstest.skip
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py
new file mode 100644
index 0000000..8bd698f
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/__init__.py
@@ -0,0 +1,11 @@
+from . import TestTool1_2_1
+from . import TestTool1_2_2
+
+def generate(env):
+ env['TestTool1_2'] = 1
+ TestTool1_2_1.generate(env)
+ TestTool1_2_2.generate(env)
+def exists(env):
+ TestTool1_2_1.exists(env)
+ TestTool1_2_2.exists(env)
+ return 1
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/sconstest.skip b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/TestTool1_2/sconstest.skip
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/__init__.py b/test/toolpath/relative_import/image/tools/TestTool1/__init__.py
new file mode 100644
index 0000000..d5510d2
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/__init__.py
@@ -0,0 +1,9 @@
+from . import TestTool1_1
+
+def generate(env):
+ env['TestTool1'] = 1
+ # Include another tool within the same directory
+ TestTool1_1.generate(env)
+def exists(env):
+ TestTool1_1.exists(env)
+ return 1
diff --git a/test/toolpath/relative_import/image/tools/TestTool1/sconstest.skip b/test/toolpath/relative_import/image/tools/TestTool1/sconstest.skip
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/test/toolpath/relative_import/image/tools/TestTool1/sconstest.skip
diff --git a/test/toolpath/relative_import/relative_import.py b/test/toolpath/relative_import/relative_import.py
new file mode 100644
index 0000000..8fa2f62
--- /dev/null
+++ b/test/toolpath/relative_import/relative_import.py
@@ -0,0 +1,53 @@
+#!/usr/bin/env python
+#
+# __COPYRIGHT__
+#
+# 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__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__"
+
+import os.path
+import TestSCons
+
+test = TestSCons.TestSCons()
+
+test.dir_fixture('image')
+
+test.run(arguments = '.', stdout = """\
+scons: Reading SConscript files ...
+env['TestTool1'] = 1
+env['TestTool1_1'] = 1
+env['TestTool1_2'] = 1
+env['TestTool1_2_1'] = 1
+env['TestTool1_2_2'] = 1
+scons: done reading SConscript files.
+scons: Building targets ...
+scons: `.' is up to date.
+scons: done building targets.
+""")
+
+test.pass_test()
+
+# Local Variables:
+# tab-width:4
+# indent-tabs-mode:nil
+# End:
+# vim: set expandtab tabstop=4 shiftwidth=4: