Hello SeaBIOS developers,
I'm using SeaBIOS together with Coreboot and it works very well. Thank you for your great work!
The compilation of coreboot is done on a system where /usr/bin/python refers to python3. This makes scripts in the Python2 dialect fail with a syntax error.
Since afaik Ubuntu will use Python 3 as default in the next release a bigger number of people will be affected by this when compiling coreboot.
According to PEP-394 (http://www.python.org/dev/peps/pep-0394/) systems are supposed to have a "python2" command which refers to Python 2. This is the case on the systems I've tested. (Note: I have not tested many enterprise distributions.)
I *think* it should be safe to make the usage of python2 explicit and I've attached a patch to do so. The patch should be trivial, but please tell me if you require any adjustments. I will be happy to do them.
Should you have reservations over this patch due to some older systems possibly not having "python2", I might also try to make the scripts compatible with both Python 2 and Python 3.
Regards,
Johannes
P.S. Please be so kind as to CC me in any responses as I'm not subscribed to the list.
On Sun, Jan 05, 2014 at 03:33:20PM +0100, Johannes Krampf wrote:
Hello SeaBIOS developers,
I'm using SeaBIOS together with Coreboot and it works very well. Thank you for your great work!
The compilation of coreboot is done on a system where /usr/bin/python refers to python3. This makes scripts in the Python2 dialect fail with a syntax error.
Thanks. Although the change you propose is possible, it will break those older systems that don't have a python2 alias. I think it's probably better to just make the scripts compatible with both python2 and python3.
-Kevin
Hello SeaBIOS developers,
I've created a new patch which allows me to build SeaBIOS successfully with both Python 2 and Python 3. (Tested with qemu)
Aside from print statements/functions, str/bytes and integer division for Python 2/3 compatibility, I also did some small changes (removing semicolons) to the acpi_* files to reduce the noise from pylint output.
I was careful not to break the code, but I could not test the readserial script lacking the necessary hardware and would appreciate if someone else could give it a try.
All of my changes should work with Python 2.4 and newer (version in RHEL 5, the oldest supported version). If you require compatibility with older Python versions, please tell me and I will revise the patch.
- Johannes
P.S. Please CC me in answers as I'm not subscribed to the list.
On Sun, Jan 12, 2014 at 11:51:01AM +0100, Johannes Krampf wrote:
Hello SeaBIOS developers,
I've created a new patch which allows me to build SeaBIOS successfully with both Python 2 and Python 3. (Tested with qemu)
Thanks. I broke up your patches to make them easier to discuss (see attached). Can you provide a "Signed-off-by" for them?
Aside from print statements/functions, str/bytes and integer division for Python 2/3 compatibility, I also did some small changes (removing semicolons) to the acpi_* files to reduce the noise from pylint output.
I'm uncomfortable with the as_bytes/as_str change. I wonder if there is a way to avoid all the conversions by changing all the symbols to strings up front, or by just reading/writing the files in ascii mode instead of binary mode.
I was careful not to break the code, but I could not test the readserial script lacking the necessary hardware and would appreciate if someone else could give it a try.
All of my changes should work with Python 2.4 and newer (version in RHEL 5, the oldest supported version). If you require compatibility with older Python versions, please tell me and I will revise the patch.
-Kevin
Hello,
here you go. Sorry it took me so long to get back to you, I had to extend my git knowledge first and do some reading of the man pages for git-am and git-format-patch. And thanks for splitting the patch, I should have done so myself.
Regarding the bytes/string change: Some things are simply binary data (i.e. null padding) and there is not much which could be done differently. If we did not care about older distributions, then using a bytes literal (b"\0") instead of my as_bytes-replacement (as_bytes("\0")) would be nicer, but is only available starting with Python 2.6.
All the object dump parsing code in checkrom.py and layoutrom.py should only deal with ASCII input. Changing this to strings would probably slim down the patch considerably since most other changes which transform literals to bytes are caused by reading bytes and comparing them with these literals.
I'll take a look at this and send you a revised patch for the string/bytes change. The first 4 patches seem fine to me.
- Johannes
On 01/12/2014 05:49 PM, Kevin O'Connor wrote:
On Sun, Jan 12, 2014 at 11:51:01AM +0100, Johannes Krampf wrote:
Hello SeaBIOS developers,
I've created a new patch which allows me to build SeaBIOS successfully with both Python 2 and Python 3. (Tested with qemu)
Thanks. I broke up your patches to make them easier to discuss (see attached). Can you provide a "Signed-off-by" for them?
Aside from print statements/functions, str/bytes and integer division for Python 2/3 compatibility, I also did some small changes (removing semicolons) to the acpi_* files to reduce the noise from pylint output.
I'm uncomfortable with the as_bytes/as_str change. I wonder if there is a way to avoid all the conversions by changing all the symbols to strings up front, or by just reading/writing the files in ascii mode instead of binary mode.
I was careful not to break the code, but I could not test the readserial script lacking the necessary hardware and would appreciate if someone else could give it a try.
All of my changes should work with Python 2.4 and newer (version in RHEL 5, the oldest supported version). If you require compatibility with older Python versions, please tell me and I will revise the patch.
-Kevin
On 01/18/2014 11:45 AM, Johannes Krampf wrote:
I'll take a look at this and send you a revised patch for the string/bytes change. The first 4 patches seem fine to me.
Here's the revised patch. I tested building SeaBIOS with both Python 2 and Python 3 and the resulting bios images booted fine using qemu.
I still could not test the readserial script and would appreciate if someone else could make sure it works.
- Johannes
On Sun, Jan 19, 2014 at 04:07:22PM +0100, Johannes Krampf wrote:
On 01/18/2014 11:45 AM, Johannes Krampf wrote:
I'll take a look at this and send you a revised patch for the string/bytes change. The first 4 patches seem fine to me.
Here's the revised patch. I tested building SeaBIOS with both Python 2 and Python 3 and the resulting bios images booted fine using qemu.
Thanks. I have committed this patch series.
I still could not test the readserial script and would appreciate if someone else could make sure it works.
readserial works fine for me with python2. It does not appear there is a python3 version of the pyserial package so I can't test that part.
-Kevin
On 01/20/2014 06:47 PM, Kevin O'Connor wrote:
Thanks. I have committed this patch series.
Great! I'm looking forward to building Coreboot without thinking about the default Python version on my computer.
readserial works fine for me with python2. It does not appear there is a python3 version of the pyserial package so I can't test that part.
According to the pypi page [1] pyserial is compatible with Python 2.4 to 3.4. and they have a Windows installer for Python 3. I would appreciate if you or someone else could find the time to test.
- Johannes