public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Gao, Liming" <liming.gao@intel.com>
Cc: Gary Lin <glin@suse.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Subject: Re: [RFC] Edk2 BaseTools Python3 Migration Update
Date: Tue, 8 Jan 2019 17:25:31 +0100	[thread overview]
Message-ID: <dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com> (raw)
In-Reply-To: <4A89E2EF3DFEDB4C8BFDE51014F606A14E3A904F@SHSMSX152.ccr.corp.intel.com>

Hi Liming,

On 01/04/19 04:29, Gao, Liming wrote:
> Laszlo:
>   This issue has been fixed in edk2 master. I just cherry pick those
>   fixes from edk2 master to my Python3 branch
>   (https://github.com/lgao4/edk2/tree/Python3).

At commit 90d8b4834fd1 ("BaseTools: Reset FdsGlobalVariable",
2019-01-04):

(a) My regression tests using python-2.7.5-69.el7_5.x86_64 were all
successful (build and boot, plus S3 wherever applicable).

They covered IA32, IA32X64, and X64 OVMF, with/without SMM, and with
Fedora and some Windows guests. They also covered ArmVirtQemu on aarch64
KVM.


(b) For testing the Python3 enablement, I used a "RHEL8 Beta" virtual
machine. (The Python situation in RHEL8 is documented in the following
blog post:
<https://developers.redhat.com/blog/2018/11/14/python-in-rhel-8/>.)

My testing with Python3 failed. I did the following, in a clean checkout
of your repo/branch, and a clean shell environment:

# export PYTHON3_ENABLE=TRUE
# source edksetup.sh
# nice make -C "$EDK_TOOLS_PATH" -j3

The final output was:

> ======================================================================
> ERROR: testRandomDataCycles (TianoCompress.Tests)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "/root/liming/BaseTools/Tests/TianoCompress.py", line 66, in testRandomDataCycles
>     self.compressionTestCycle(data)
>   File "/root/liming/BaseTools/Tests/TianoCompress.py", line 39, in compressionTestCycle
>     self.WriteTmpFile('input', data)
>   File "/root/liming/BaseTools/Tests/TestTools.py", line 154, in WriteTmpFile
>     f.write(data)
>   File "/usr/lib64/python3.6/encodings/iso8859_2.py", line 19, in encode
>     return codecs.charmap_encode(input,self.errors,encoding_table)[0]
> UnicodeEncodeError: 'charmap' codec can't encode character '\xc0' in position 27: character maps to <undefined>
>
> ----------------------------------------------------------------------

(The backtrace mentions "iso8859_2.py" because I happen to use

  LC_CTYPE=hu_HU.ISO8859-2

in my locale settings.)

Either way, I think the issue is that an object ("data") is being
considered a string, rather than a byte array.


(c) To re-iterate my earlier request, would it be possible to set
PYTHON_COMMAND externally (in addition to PYTHON3_ENABLE=TRUE)? Because,
once we package a new version of edk2 for RHEL8, we'd like to set
PYTHON_COMMAND to "/usr/libexec/platform-python", and not to the
auto-detected "/usr/bin/python3'. (In fact, "/usr/bin/python3" could be
missing from the restricted package build environment.)

See the blog post I referenced above -- one of its takeaways is, "use
platform-python if you are writing system/admin code for RHEL 8". In
other words, when users build upstream edk2 on a RHEL8 machine, it's
fine if edk2 detects and uses /usr/bin/python3. However, when the edk2
package of the distro itself is built, it should be possible to direct
edk2 towards "/usr/libexec/platform-python".

Thank you,
Laszlo


  parent reply	other threads:[~2019-01-08 16:25 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-25  7:50 [RFC] Edk2 BaseTools Python3 Migration Update Gao, Liming
2018-12-26 21:16 ` Laszlo Ersek
     [not found] ` <20181228103951.GN4206@GaryWorkstation>
2018-12-29  6:07   ` Gao, Liming
2018-12-31  0:15     ` Laszlo Ersek
2019-01-02  1:52       ` Gao, Liming
2019-01-04  3:29       ` Gao, Liming
2019-01-07 19:04         ` Laszlo Ersek
2019-01-08 16:25         ` Laszlo Ersek [this message]
2019-01-02  9:26     ` Gary Lin
2019-01-07  8:39 ` Ni, Ruiyu
2019-01-07 13:41   ` Gao, Liming
2019-01-07 19:04     ` Laszlo Ersek
2019-01-08 14:22       ` Gao, Liming
2019-01-08 16:22         ` Carsey, Jaben
2019-01-08 17:25           ` Laszlo Ersek
2019-01-08 18:05             ` Carsey, Jaben
2019-01-09  0:43               ` Gao, Liming
2019-01-09 18:41                 ` Carsey, Jaben
2019-01-09 10:13               ` Laszlo Ersek
2019-01-08 17:22         ` Laszlo Ersek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dfc4af35-53e9-ab11-6582-1d0d8e9f2cde@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox