summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xsrc/CHANGES.txt2
-rw-r--r--src/engine/SCons/Tool/__init__.py25
-rw-r--r--src/engine/SCons/Tool/swig.py3
3 files changed, 18 insertions, 12 deletions
diff --git a/src/CHANGES.txt b/src/CHANGES.txt
index 84a8056..d07b4ad 100755
--- a/src/CHANGES.txt
+++ b/src/CHANGES.txt
@@ -13,6 +13,8 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
- Use importlib to dynamically load tool and platform modules instead of imp module
- sconsign: default to .sconsign.dblite if no filename is specified.
Be more informative in case of unsupported pickle protocol (py2 only).
+ - Fix issue #3336 - on Windows, paths were being added to PATH even if
+ tools were not found in those paths.
From John Doe:
diff --git a/src/engine/SCons/Tool/__init__.py b/src/engine/SCons/Tool/__init__.py
index 8fbd587..152e186 100644
--- a/src/engine/SCons/Tool/__init__.py
+++ b/src/engine/SCons/Tool/__init__.py
@@ -1318,28 +1318,31 @@ def tool_list(platform, env):
def find_program_path(env, key_program, default_paths=[]):
"""
- Find the location of key_program and then return the path it was located at.
- Checking the default install locations.
- Mainly for windows where tools aren't all installed in /usr/bin,etc
- :param env: Current Environment()
- :param key_program: Program we're using to locate the directory to add to PATH.
+ Find the location of a tool using various means.
+
+ Mainly for windows where tools aren't all installed in /usr/bin, etc.
+
+ :param env: Current Construction Environment.
+ :param key_program: Tool to locate.
+ :param default_paths: List of additional paths this tool might be found in.
"""
# First search in the SCons path
path = env.WhereIs(key_program)
- if (path):
+ if path:
return path
- # then the OS path:
+
+ # Then in the OS path
path = SCons.Util.WhereIs(key_program)
- if (path):
+ if path:
return path
- # If that doesn't work try default location for mingw
+ # Finally, add the defaults and check again. Do not change
+ # ['ENV']['PATH'] permananetly, the caller can do that if needed.
save_path = env['ENV']['PATH']
for p in default_paths:
env.AppendENVPath('PATH', p)
path = env.WhereIs(key_program)
- if not path:
- env['ENV']['PATH'] = save_path
+ env['ENV']['PATH'] = save_path
return path
# Local Variables:
diff --git a/src/engine/SCons/Tool/swig.py b/src/engine/SCons/Tool/swig.py
index c6abefb..6ed9d82 100644
--- a/src/engine/SCons/Tool/swig.py
+++ b/src/engine/SCons/Tool/swig.py
@@ -184,9 +184,10 @@ def generate(env):
from SCons.Platform.mingw import MINGW_DEFAULT_PATHS
from SCons.Platform.cygwin import CYGWIN_DEFAULT_PATHS
+ from SCons.Platform.win32 import CHOCO_DEFAULT_PATH
if sys.platform == 'win32':
- swig = SCons.Tool.find_program_path(env, 'swig', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS + [r'C:\ProgramData\chocolatey\bin'] )
+ swig = SCons.Tool.find_program_path(env, 'swig', default_paths=MINGW_DEFAULT_PATHS + CYGWIN_DEFAULT_PATHS + CHOCO_DEFAULT_PATH)
if swig:
swig_bin_dir = os.path.dirname(swig)
env.AppendENVPath('PATH', swig_bin_dir)