Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Conversation

omajid
Copy link
Member

@omajid omajid commented Aug 24, 2020

This is a combined fix from 3 different PRs and one additional fix for 2.1:

The 2.1-specific fix is that python3 is is only used as a fallback, in case all other python program names dont work.

As for the original PRs, they perform these changes:

build.sh and build.cmd contain logic to identify a working version of python to use. System.Private.CoreLib ignores that and directly invokes'python', which may not work, or even execute a different program. Fix that.

The windows build scripts try finding python in order of python3, python2 and then python. The unix build scripts dont. They just try python2 variants and then fail. This change makes brings them closer together by letting users build using only python3.

Use the same logic in CMakeLists.txt that's used in build.sh/build.cmd to lookup python.

This is a combined fix from 3 different PRs and one additional fix for
2.1:

- dotnet#19043
- dotnet#19356
- dotnet#22145

The 2.1-specific fix is that python is is only used as a fallback, in
case all other python program names dont work.

As for the original PRs, they perform these changes:

build.sh and build.cmd contain logic to identify a working version of
python to use. System.Private.CoreLib ignores that and directly invokes
'python', which may not work, or even execute a different program. Fix
that.

The windows build scripts try finding python in order of python3,
python2 and then python. The unix build scripts dont. They just try
python2 variants and then fail. This change makes brings them closer
together by letting users build using only python3.

Use the same logic in CMakeLists.txt that's used in build.sh/build.cmd
to lookup python.
@omajid
Copy link
Member Author

omajid commented Aug 24, 2020

@dseefeld This is the set of fixes I use for building .NET Core 2.1 (source-build) on RHEL 8. I have tweaked it a bit so python3 is used as a last resort. The original patches are here: 1 2 3

@Anipik
Copy link

Anipik commented Sep 18, 2020

@jkoritzinsky @tommcdon @hoyosjs can you please review this one ?

Copy link
Member

@hoyosjs hoyosjs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silvioguiso has already done a 2.1 build with Python 3, so I expect no major exceptions from any script between a Python 2 and Python 3 break.

fyi: @sywhang

@Anipik Anipik merged commit 5ab6634 into dotnet:release/2.1 Sep 18, 2020
<CMakeDefinitionSaveFile>$(IntermediateOutputPath)..\cmake.definitions</CMakeDefinitionSaveFile>
</PropertyGroup>
<Exec Command="python $(MSBuildThisFileDirectory)..\scripts\check-definitions.py &quot;$(CMakeDefinitionSaveFile)&quot; &quot;$(DefineConstants)&quot; &quot;$(IgnoreDefineConstants)&quot; " />
<Exec Command="&quot;$(PYTHON)&quot; $(MSBuildThisFileDirectory)..\scripts\check-definitions.py &quot;$(CMakeDefinitionSaveFile)&quot; &quot;$(DefineConstants)&quot; &quot;$(IgnoreDefineConstants)&quot; " />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silvioguiso this is the line that broke stuff. Now that python is an env var and not a literal you need to do this everywhere else it gets called, OR make it conditional based using MSbuild conditions.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes. Sorry about that.

Should I revert the entire patch or should I go for targeted fixes?

If you want me to go for more targeted fixes, is there some way I can access logs that show where this PR breaks things?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We fixed this in this PR, no need to revert.
#28102

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants