-
-
Notifications
You must be signed in to change notification settings - Fork 349
Fix for vcpkg run time issue in windows runner #4717
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
Changes from 4 commits
7467042
39b4937
7ba488e
063ba57
700190c
9ee4e50
096fc51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -342,6 +342,18 @@ def normalize_env(env, keys, force: bool=False): | |
| if sys32_wbem_dir not in normenv['PATH']: | ||
| normenv['PATH'] = normenv['PATH'] + os.pathsep + sys32_wbem_dir | ||
|
|
||
| # ProgramFiles for PowerShell 7 Path and PSModulePath | ||
| progfiles_dir = os.environ.get("ProgramFiles") | ||
| if not progfiles_dir: | ||
| sysroot_drive, _ = os.path.splitdrive(sys32_dir) | ||
| sysroot_path = sysroot_drive + os.sep | ||
| progfiles_dir = os.path.join(sysroot_path, "Program Files") | ||
|
|
||
| # Powershell 7 | ||
| progfiles_ps_dir = os.path.join(progfiles_dir, "PowerShell", "7") | ||
| if progfiles_ps_dir not in normenv["PATH"]: | ||
| normenv["PATH"] = normenv["PATH"] + os.pathsep + progfiles_ps_dir | ||
|
|
||
| # Without Powershell in PATH, an internal call to a telemetry | ||
| # function (starting with a VS2019 update) can fail | ||
| # Note can also set VSCMD_SKIP_SENDTELEMETRY to avoid this. | ||
|
|
@@ -353,48 +365,53 @@ def normalize_env(env, keys, force: bool=False): | |
| return normenv | ||
|
|
||
|
|
||
| # TODO: Hard-coded list of the variables that (may) need to be | ||
| # imported from os.environ[] for the chain of development batch | ||
| # files to execute correctly. One call to vcvars*.bat may | ||
| # end up running a dozen or more scripts, changes not only with | ||
| # each release but with what is installed at the time. We think | ||
| # in modern installations most are set along the way and don't | ||
| # need to be picked from the env, but include these for safety's sake. | ||
| # Any VSCMD variables definitely are picked from the env and | ||
| # control execution in interesting ways. | ||
| # Note these really should be unified - either controlled by vs.py, | ||
| # or synced with the the common_tools_var # settings in vs.py. | ||
| _VS_VC_VARS = [ | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think you can remove the
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is an indicator that it shouldn't necessarily be modified. I don't feel strongly either way. We should probably add a debug logging statement for each of the keys retrieved from the list in
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pushed change removing the |
||
| 'COMSPEC', # path to "shell" | ||
| 'OS', # name of OS family: Windows_NT or undefined (95/98/ME) | ||
| 'VS170COMNTOOLS', # path to common tools for given version | ||
| 'VS160COMNTOOLS', | ||
| 'VS150COMNTOOLS', | ||
| 'VS140COMNTOOLS', | ||
| 'VS120COMNTOOLS', | ||
| 'VS110COMNTOOLS', | ||
| 'VS100COMNTOOLS', | ||
| 'VS90COMNTOOLS', | ||
| 'VS80COMNTOOLS', | ||
| 'VS71COMNTOOLS', | ||
| 'VSCOMNTOOLS', | ||
| 'MSDevDir', | ||
| 'VSCMD_DEBUG', # enable logging and other debug aids | ||
| 'VSCMD_SKIP_SENDTELEMETRY', | ||
| 'windir', # windows directory (SystemRoot not available in 95/98/ME) | ||
| 'VCPKG_DISABLE_METRICS', | ||
| 'VCPKG_ROOT', | ||
| ] | ||
|
|
||
| def get_output(vcbat, args=None, env=None, skip_sendtelemetry=False): | ||
| """Parse the output of given bat file, with given args.""" | ||
|
|
||
| if env is None: | ||
| # Create a blank environment, for use in launching the tools | ||
| env = SCons.Environment.Environment(tools=[]) | ||
|
|
||
| # TODO: Hard-coded list of the variables that (may) need to be | ||
| # imported from os.environ[] for the chain of development batch | ||
| # files to execute correctly. One call to vcvars*.bat may | ||
| # end up running a dozen or more scripts, changes not only with | ||
| # each release but with what is installed at the time. We think | ||
| # in modern installations most are set along the way and don't | ||
| # need to be picked from the env, but include these for safety's sake. | ||
| # Any VSCMD variables definitely are picked from the env and | ||
| # control execution in interesting ways. | ||
| # Note these really should be unified - either controlled by vs.py, | ||
| # or synced with the the common_tools_var # settings in vs.py. | ||
| vs_vc_vars = [ | ||
| 'COMSPEC', # path to "shell" | ||
| 'OS', # name of OS family: Windows_NT or undefined (95/98/ME) | ||
| 'VS170COMNTOOLS', # path to common tools for given version | ||
| 'VS160COMNTOOLS', | ||
| 'VS150COMNTOOLS', | ||
| 'VS140COMNTOOLS', | ||
| 'VS120COMNTOOLS', | ||
| 'VS110COMNTOOLS', | ||
| 'VS100COMNTOOLS', | ||
| 'VS90COMNTOOLS', | ||
| 'VS80COMNTOOLS', | ||
| 'VS71COMNTOOLS', | ||
| 'VSCOMNTOOLS', | ||
| 'MSDevDir', | ||
| 'VSCMD_DEBUG', # enable logging and other debug aids | ||
| 'VSCMD_SKIP_SENDTELEMETRY', | ||
| 'windir', # windows directory (SystemRoot not available in 95/98/ME) | ||
| ] | ||
| env['ENV'] = normalize_env(env['ENV'], vs_vc_vars, force=False) | ||
| env['ENV'] = normalize_env(env['ENV'], _VS_VC_VARS, force=False) | ||
|
|
||
| if skip_sendtelemetry: | ||
| _force_vscmd_skip_sendtelemetry(env) | ||
|
|
||
| # debug("ENV=%r", env['ENV']) | ||
|
|
||
| if args: | ||
| debug("Calling '%s %s'", vcbat, args) | ||
| cmd_str = '"%s" %s & set' % (vcbat, args) | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.