-
-
Notifications
You must be signed in to change notification settings - Fork 331
Fix issue causing scanners to receive incorrect paths #3494
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
grossag
wants to merge
12
commits into
SCons:master
Choose a base branch
from
grossag:topic/grossag/wrongabspath
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
2be6753
Add test showing the wrong absolute path
grossag 7a1f87a
Make test cross-platform by using a forward slash in env['PYPATH']
grossag 3847b1a
Fix sider failure
grossag 3e98ff7
Try a possible fix
grossag 256ad36
Merge branch 'master' into topic/grossag/wrongabspath
grossag ed3d04e
Modify CHANGES.txt and apply preferred fix
grossag 01278f3
Merge branch 'topic/grossag/wrongabspath' of https://github.com/gross…
grossag 6486d0e
resolve conflicts merging with main, and fix a few formatting and pyt…
bdbaddog 4d694d6
Merge pull request #3 from bdbaddog/grossag-topic/grossag/wrongabspath
grossag a311401
Merge branch 'master' into topic/grossag/wrongabspath
bdbaddog aa5a368
Merge branch 'master' into topic/grossag/wrongabspath
bdbaddog 5e7f135
Merge branch 'master' into topic/grossag/wrongabspath
bdbaddog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import os | ||
import sys | ||
import SCons.Scanner | ||
|
||
sdk_root = None | ||
|
||
def verify_paths(node, env, scanpaths, arg): | ||
"""Verifies that the paths provided are as expected.""" | ||
global sdk_root | ||
sdk_root_subdir = os.path.join(sdk_root, 'sdk_subdir') | ||
if len(scanpaths) != 2: | ||
raise Exception('Expected two entries in scanpaths') | ||
if scanpaths[0].abspath != sdk_root: | ||
raise Exception('Expected first scanpath=%s, got %s.' % | ||
(sdk_root, scanpaths[0].abspath)) | ||
if scanpaths[1].abspath != sdk_root_subdir: | ||
raise Exception('Expected second scanpath=%s, got %s.' % | ||
(sdk_root_subdir, scanpaths[1].abspath)) | ||
return [] | ||
|
||
# Create a scanner that generates a path using the variables in env['PYPATH']. | ||
pyscan = Scanner(name='pythonfile', | ||
function=verify_paths, | ||
argument=None, | ||
path_function=SCons.Scanner.FindPathDirs('PYPATH'), | ||
skeys=['.py']) | ||
|
||
# Create a builder that uses that scanner. | ||
b = Builder(action='$PYTHON $SOURCE', source_scanner=pyscan) | ||
|
||
env = Environment(BUILDERS={'DummyPythonBuilder': b}) | ||
|
||
# Now set some variables that are needed by the scanner and/or the SConscript. | ||
env.Replace( | ||
PYTHON=sys.executable, | ||
PYPATH=['$SDKROOT', '$SDKROOT/sdk_subdir'], | ||
SDKROOT=env.Dir('sdk'), | ||
) | ||
sdk_root = env['SDKROOT'].abspath | ||
|
||
Export('env') | ||
SConscript('subdir/SConscript', exports='env') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Import('env') | ||
env.DummyPythonBuilder(target=['foo'], source=['empty.py']) |
Empty file.
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/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__" | ||
|
||
""" | ||
This test verifies that a scanner retrieves the correct paths when | ||
path_function is set to SCons.Scanner.FindPathDirs(some_var) and env[some_var] | ||
contains paths relative to the SConstruct root. | ||
""" | ||
|
||
import TestSCons | ||
|
||
test = TestSCons.TestSCons() | ||
|
||
test.dir_fixture('fixture') | ||
test.run() | ||
|
||
test.pass_test() | ||
|
||
# Local Variables: | ||
# tab-width:4 | ||
# indent-tabs-mode:nil | ||
# End: | ||
# vim: set expandtab tabstop=4 shiftwidth=4: |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.