[edk2-devel] [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation

Rebecca Cran posted 4 patches 11 months, 4 weeks ago
Failed in applying to current master (apply log)
BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
BaseTools/Tests/PythonTest.py                |  22 +++-
BaseTools/toolsetup.bat                      | 119 ++++++++------------
edksetup.bat                                 |   1 +
4 files changed, 69 insertions(+), 75 deletions(-)
[edk2-devel] [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation
Posted by Rebecca Cran 11 months, 4 weeks ago
There are remnants of Python 2 support in BaseTools/toolsetup.bat that it's
probably time to remove since we only support Python 3.6 and newer these days.
So, remove the variables that enable Python3 support and simplify the batch
script. I've also seen errors where after running edksetup.bat the build
command isn't available because PYTHONPATH wasn't being set, so fix that
when the Pip BaseTools are being used.

At the same time, let's add a check that we meet the minimum version
requirement so we don't end up failing with an obscure error.

Building BaseTools causes a warning about threading.currentThread being
deprecated, so update code in NmakeSubdirs.py to switch to
threading.current_thread.

There needs to be further work, because if PYTHON_COMMAND isn't specified then
it defaults to "py -3", where py is C:\Windows\py.exe, which doesn't work if
you're using a virtualenv since it installs python.exe and pythonw.exe in
venv\Scripts. toolsetup.bat therefore fails to detect the Pip BaseTools and
uses the in-source Basetools.

GitHub PR: https://github.com/tianocore/edk2/pull/4302
GitHub branch: https://github.com/bcran/edk2/tree/py3

Changes between v1 and v2
=========================

- Require Python 3.6 or newer: 3.6 was when PEP 526 was added, which we use.
- Fix Tests/RunTests.py on Windows.

Rebecca Cran (4):
  BaseTools: Remove Python2/Python3 detection from toolset.bat
  BaseTools: use threading.current_thread in NmakeSubdirs.py
  edksetup.bat: if toolsetup.bat fails, just exit
  BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver

 BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
 BaseTools/Tests/PythonTest.py                |  22 +++-
 BaseTools/toolsetup.bat                      | 119 ++++++++------------
 edksetup.bat                                 |   1 +
 4 files changed, 69 insertions(+), 75 deletions(-)

-- 
2.40.0.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104204): https://edk2.groups.io/g/devel/message/104204
Mute This Topic: https://groups.io/mt/98730531/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
[edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation
Posted by gaoliming via groups.io 11 months, 4 weeks ago
Rebecca:
  This change is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.
cn>
  
  But, I see edksetup.sh also has python2 check. I think the same clean up
can be done in edksetup.sh.

Thanks
Liming
> -----邮件原件-----
> 发件人: Rebecca Cran <rebecca@bsdio.com>
> 发送时间: 2023年5月7日 3:31
> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Leif
> Lindholm <quic_llindhol@quicinc.com>; Michael D Kinney
> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> Bob Feng <bob.c.feng@intel.com>; Yuwei Chen <yuwei.chen@intel.com>
> 抄送: Rebecca Cran <rebecca@bsdio.com>
> 主题: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows
> environment setup and BaseTools C compilation
> 
> There are remnants of Python 2 support in BaseTools/toolsetup.bat that
it's
> probably time to remove since we only support Python 3.6 and newer these
> days.
> So, remove the variables that enable Python3 support and simplify the
batch
> script. I've also seen errors where after running edksetup.bat the build
> command isn't available because PYTHONPATH wasn't being set, so fix that
> when the Pip BaseTools are being used.
> 
> At the same time, let's add a check that we meet the minimum version
> requirement so we don't end up failing with an obscure error.
> 
> Building BaseTools causes a warning about threading.currentThread being
> deprecated, so update code in NmakeSubdirs.py to switch to
> threading.current_thread.
> 
> There needs to be further work, because if PYTHON_COMMAND isn't
> specified then
> it defaults to "py -3", where py is C:\Windows\py.exe, which doesn't work
if
> you're using a virtualenv since it installs python.exe and pythonw.exe in
> venv\Scripts. toolsetup.bat therefore fails to detect the Pip BaseTools
and
> uses the in-source Basetools.
> 
> GitHub PR: https://github.com/tianocore/edk2/pull/4302
> GitHub branch: https://github.com/bcran/edk2/tree/py3
> 
> Changes between v1 and v2
> =========================
> 
> - Require Python 3.6 or newer: 3.6 was when PEP 526 was added, which we
> use.
> - Fix Tests/RunTests.py on Windows.
> 
> Rebecca Cran (4):
>   BaseTools: Remove Python2/Python3 detection from toolset.bat
>   BaseTools: use threading.current_thread in NmakeSubdirs.py
>   edksetup.bat: if toolsetup.bat fails, just exit
>   BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver
> 
>  BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
>  BaseTools/Tests/PythonTest.py                |  22 +++-
>  BaseTools/toolsetup.bat                      | 119
> ++++++++------------
>  edksetup.bat                                 |   1 +
>  4 files changed, 69 insertions(+), 75 deletions(-)
> 
> --
> 2.40.0.windows.1





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104233): https://edk2.groups.io/g/devel/message/104233
Mute This Topic: https://groups.io/mt/98753269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation
Posted by Rebecca Cran 11 months, 4 weeks ago
I’ve removed the python 2 checks from edksetup.sh in the patch “Remove bashisms from edksetup.sh and BaseTools/BuildEnv” that I sent out a few days ago.

Rebecca

On Sun, May 7, 2023, at 7:30 PM, gaoliming via groups.io wrote:
> Rebecca:
>   This change is good to me. Reviewed-by: Liming Gao <gaoliming@byosoft.com.
> cn>
>  
>   But, I see edksetup.sh also has python2 check. I think the same clean up
> can be done in edksetup.sh.
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: Rebecca Cran <rebecca@bsdio.com>
>> 发送时间: 2023年5月7日 3:31
>> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Leif
>> Lindholm <quic_llindhol@quicinc.com>; Michael D Kinney
>> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
>> Bob Feng <bob.c.feng@intel.com>; Yuwei Chen <yuwei.chen@intel.com>
>> 抄送: Rebecca Cran <rebecca@bsdio.com>
>> 主题: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows
>> environment setup and BaseTools C compilation
>> 
>> There are remnants of Python 2 support in BaseTools/toolsetup.bat that
> it's
>> probably time to remove since we only support Python 3.6 and newer these
>> days.
>> So, remove the variables that enable Python3 support and simplify the
> batch
>> script. I've also seen errors where after running edksetup.bat the build
>> command isn't available because PYTHONPATH wasn't being set, so fix that
>> when the Pip BaseTools are being used.
>> 
>> At the same time, let's add a check that we meet the minimum version
>> requirement so we don't end up failing with an obscure error.
>> 
>> Building BaseTools causes a warning about threading.currentThread being
>> deprecated, so update code in NmakeSubdirs.py to switch to
>> threading.current_thread.
>> 
>> There needs to be further work, because if PYTHON_COMMAND isn't
>> specified then
>> it defaults to "py -3", where py is C:\Windows\py.exe, which doesn't work
> if
>> you're using a virtualenv since it installs python.exe and pythonw.exe in
>> venv\Scripts. toolsetup.bat therefore fails to detect the Pip BaseTools
> and
>> uses the in-source Basetools.
>> 
>> GitHub PR: https://github.com/tianocore/edk2/pull/4302
>> GitHub branch: https://github.com/bcran/edk2/tree/py3
>> 
>> Changes between v1 and v2
>> =========================
>> 
>> - Require Python 3.6 or newer: 3.6 was when PEP 526 was added, which we
>> use.
>> - Fix Tests/RunTests.py on Windows.
>> 
>> Rebecca Cran (4):
>>   BaseTools: Remove Python2/Python3 detection from toolset.bat
>>   BaseTools: use threading.current_thread in NmakeSubdirs.py
>>   edksetup.bat: if toolsetup.bat fails, just exit
>>   BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver
>> 
>>  BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
>>  BaseTools/Tests/PythonTest.py                |  22 +++-
>>  BaseTools/toolsetup.bat                      | 119
>> ++++++++------------
>>  edksetup.bat                                 |   1 +
>>  4 files changed, 69 insertions(+), 75 deletions(-)
>> 
>> --
>> 2.40.0.windows.1
>
>
>
>
>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104234): https://edk2.groups.io/g/devel/message/104234
Mute This Topic: https://groups.io/mt/98753269/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
回复: [edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation
Posted by gaoliming via groups.io 11 months, 4 weeks ago
Rebecca:
  I see this patch. It removes python2. But, it doesn't add python version check. Will you add this check in edksetup.sh?

Thanks
Liming
> -----邮件原件-----
> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Rebecca Cran
> 发送时间: 2023年5月8日 9:32
> 收件人: devel@edk2.groups.io; gaoliming <gaoliming@byosoft.com.cn>;
> Andrew Fish <afish@apple.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
> Kinney, Michael D <michael.d.kinney@intel.com>; 'Bob Feng'
> <bob.c.feng@intel.com>; 'Yuwei Chen' <yuwei.chen@intel.com>
> 主题: Re: [edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools:
> Improve Windows environment setup and BaseTools C compilation
> 
> I’ve removed the python 2 checks from edksetup.sh in the patch “Remove
> bashisms from edksetup.sh and BaseTools/BuildEnv” that I sent out a few
> days ago.
> 
> Rebecca
> 
> On Sun, May 7, 2023, at 7:30 PM, gaoliming via groups.io wrote:
> > Rebecca:
> >   This change is good to me. Reviewed-by: Liming Gao
> <gaoliming@byosoft.com.
> > cn>
> >
> >   But, I see edksetup.sh also has python2 check. I think the same clean up
> > can be done in edksetup.sh.
> >
> > Thanks
> > Liming
> >> -----邮件原件-----
> >> 发件人: Rebecca Cran <rebecca@bsdio.com>
> >> 发送时间: 2023年5月7日 3:31
> >> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Leif
> >> Lindholm <quic_llindhol@quicinc.com>; Michael D Kinney
> >> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
> >> Bob Feng <bob.c.feng@intel.com>; Yuwei Chen <yuwei.chen@intel.com>
> >> 抄送: Rebecca Cran <rebecca@bsdio.com>
> >> 主题: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows
> >> environment setup and BaseTools C compilation
> >>
> >> There are remnants of Python 2 support in BaseTools/toolsetup.bat that
> > it's
> >> probably time to remove since we only support Python 3.6 and newer
> these
> >> days.
> >> So, remove the variables that enable Python3 support and simplify the
> > batch
> >> script. I've also seen errors where after running edksetup.bat the build
> >> command isn't available because PYTHONPATH wasn't being set, so fix that
> >> when the Pip BaseTools are being used.
> >>
> >> At the same time, let's add a check that we meet the minimum version
> >> requirement so we don't end up failing with an obscure error.
> >>
> >> Building BaseTools causes a warning about threading.currentThread being
> >> deprecated, so update code in NmakeSubdirs.py to switch to
> >> threading.current_thread.
> >>
> >> There needs to be further work, because if PYTHON_COMMAND isn't
> >> specified then
> >> it defaults to "py -3", where py is C:\Windows\py.exe, which doesn't work
> > if
> >> you're using a virtualenv since it installs python.exe and pythonw.exe in
> >> venv\Scripts. toolsetup.bat therefore fails to detect the Pip BaseTools
> > and
> >> uses the in-source Basetools.
> >>
> >> GitHub PR: https://github.com/tianocore/edk2/pull/4302
> >> GitHub branch: https://github.com/bcran/edk2/tree/py3
> >>
> >> Changes between v1 and v2
> >> =========================
> >>
> >> - Require Python 3.6 or newer: 3.6 was when PEP 526 was added, which
> we
> >> use.
> >> - Fix Tests/RunTests.py on Windows.
> >>
> >> Rebecca Cran (4):
> >>   BaseTools: Remove Python2/Python3 detection from toolset.bat
> >>   BaseTools: use threading.current_thread in NmakeSubdirs.py
> >>   edksetup.bat: if toolsetup.bat fails, just exit
> >>   BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver
> >>
> >>  BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
> >>  BaseTools/Tests/PythonTest.py                |  22 +++-
> >>  BaseTools/toolsetup.bat                      | 119
> >> ++++++++------------
> >>  edksetup.bat                                 |   1 +
> >>  4 files changed, 69 insertions(+), 75 deletions(-)
> >>
> >> --
> >> 2.40.0.windows.1
> >
> >
> >
> >
> >
> >
> 
> 
> 
> 





-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104235): https://edk2.groups.io/g/devel/message/104235
Mute This Topic: https://groups.io/mt/98753454/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows environment setup and BaseTools C compilation
Posted by Rebecca Cran 11 months, 4 weeks ago
Oh that’s a good point. I also noticed that on Windows we don’t run the python test in BaseTools/Tests/RunTests.py.

I’ll get the current patches merged and work on adding the python version check on Linux and the python functionally tests on Windows.

On Sun, May 7, 2023, at 7:43 PM, gaoliming via groups.io wrote:
> Rebecca:
>   I see this patch. It removes python2. But, it doesn't add python 
> version check. Will you add this check in edksetup.sh?
>
> Thanks
> Liming
>> -----邮件原件-----
>> 发件人: devel@edk2.groups.io <devel@edk2.groups.io> 代表 Rebecca Cran
>> 发送时间: 2023年5月8日 9:32
>> 收件人: devel@edk2.groups.io; gaoliming <gaoliming@byosoft.com.cn>;
>> Andrew Fish <afish@apple.com>; Leif Lindholm <quic_llindhol@quicinc.com>;
>> Kinney, Michael D <michael.d.kinney@intel.com>; 'Bob Feng'
>> <bob.c.feng@intel.com>; 'Yuwei Chen' <yuwei.chen@intel.com>
>> 主题: Re: [edk2-devel] 回复: [PATCH v3 0/4] edksetup.bat, BaseTools:
>> Improve Windows environment setup and BaseTools C compilation
>> 
>> I’ve removed the python 2 checks from edksetup.sh in the patch “Remove
>> bashisms from edksetup.sh and BaseTools/BuildEnv” that I sent out a few
>> days ago.
>> 
>> Rebecca
>> 
>> On Sun, May 7, 2023, at 7:30 PM, gaoliming via groups.io wrote:
>> > Rebecca:
>> >   This change is good to me. Reviewed-by: Liming Gao
>> <gaoliming@byosoft.com.
>> > cn>
>> >
>> >   But, I see edksetup.sh also has python2 check. I think the same clean up
>> > can be done in edksetup.sh.
>> >
>> > Thanks
>> > Liming
>> >> -----邮件原件-----
>> >> 发件人: Rebecca Cran <rebecca@bsdio.com>
>> >> 发送时间: 2023年5月7日 3:31
>> >> 收件人: devel@edk2.groups.io; Andrew Fish <afish@apple.com>; Leif
>> >> Lindholm <quic_llindhol@quicinc.com>; Michael D Kinney
>> >> <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>;
>> >> Bob Feng <bob.c.feng@intel.com>; Yuwei Chen <yuwei.chen@intel.com>
>> >> 抄送: Rebecca Cran <rebecca@bsdio.com>
>> >> 主题: [PATCH v3 0/4] edksetup.bat, BaseTools: Improve Windows
>> >> environment setup and BaseTools C compilation
>> >>
>> >> There are remnants of Python 2 support in BaseTools/toolsetup.bat that
>> > it's
>> >> probably time to remove since we only support Python 3.6 and newer
>> these
>> >> days.
>> >> So, remove the variables that enable Python3 support and simplify the
>> > batch
>> >> script. I've also seen errors where after running edksetup.bat the build
>> >> command isn't available because PYTHONPATH wasn't being set, so fix that
>> >> when the Pip BaseTools are being used.
>> >>
>> >> At the same time, let's add a check that we meet the minimum version
>> >> requirement so we don't end up failing with an obscure error.
>> >>
>> >> Building BaseTools causes a warning about threading.currentThread being
>> >> deprecated, so update code in NmakeSubdirs.py to switch to
>> >> threading.current_thread.
>> >>
>> >> There needs to be further work, because if PYTHON_COMMAND isn't
>> >> specified then
>> >> it defaults to "py -3", where py is C:\Windows\py.exe, which doesn't work
>> > if
>> >> you're using a virtualenv since it installs python.exe and pythonw.exe in
>> >> venv\Scripts. toolsetup.bat therefore fails to detect the Pip BaseTools
>> > and
>> >> uses the in-source Basetools.
>> >>
>> >> GitHub PR: https://github.com/tianocore/edk2/pull/4302
>> >> GitHub branch: https://github.com/bcran/edk2/tree/py3
>> >>
>> >> Changes between v1 and v2
>> >> =========================
>> >>
>> >> - Require Python 3.6 or newer: 3.6 was when PEP 526 was added, which
>> we
>> >> use.
>> >> - Fix Tests/RunTests.py on Windows.
>> >>
>> >> Rebecca Cran (4):
>> >>   BaseTools: Remove Python2/Python3 detection from toolset.bat
>> >>   BaseTools: use threading.current_thread in NmakeSubdirs.py
>> >>   edksetup.bat: if toolsetup.bat fails, just exit
>> >>   BaseTools: Update toolsetup.bat and Tests/PythonTest.py to check ver
>> >>
>> >>  BaseTools/Source/C/Makefiles/NmakeSubdirs.py |   2 +-
>> >>  BaseTools/Tests/PythonTest.py                |  22 +++-
>> >>  BaseTools/toolsetup.bat                      | 119
>> >> ++++++++------------
>> >>  edksetup.bat                                 |   1 +
>> >>  4 files changed, 69 insertions(+), 75 deletions(-)
>> >>
>> >> --
>> >> 2.40.0.windows.1
>> >
>> >
>> >
>> >
>> >
>> >
>> 
>> 
>> 
>> 
>
>
>
>
>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#104236): https://edk2.groups.io/g/devel/message/104236
Mute This Topic: https://groups.io/mt/98753520/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-