Page MenuHomePhabricator

breakout: migrate to python3
AbandonedPublic

Authored by epriestley on Jan 11 2020, 9:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mar 16 2024, 11:22 AM
Unknown Object (File)
Mar 10 2024, 8:48 AM
Unknown Object (File)
Mar 1 2024, 5:42 AM
Unknown Object (File)
Feb 21 2024, 2:07 PM
Unknown Object (File)
Feb 17 2024, 9:11 PM
Unknown Object (File)
Feb 15 2024, 10:53 PM
Unknown Object (File)
Feb 13 2024, 12:15 AM
Unknown Object (File)
Feb 3 2024, 11:29 PM

Details

Summary

python2 is now deprecated

note that breakout still works with python2

Test Plan

Ran "arc anoid"

Diff Detail

Repository
rARC Arcanist
Branch
dev/beber/python
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23716
Build 32608: arc lint + arc unit

Event Timeline

beber requested review of this revision.Jan 11 2020, 9:21 PM

This is almost certainly fine, but I don't actually have this bleeding-edge far-future version of Python installed on my stock Macbook (macOS Mojave):

$ arc anoid
env: python3: No such file or directory

If we use #!/usr/bin/env python as the shebang line (with no explicit version), how great a sin are we committing? It seems to work fine locally (i.e., int() and round() are valid-but-unnecessary in Python2).

If env python is too awful to bear, let's keep this change but put a which python3 test into arc anoid before invoking breakout.py so it exits with a more friendly error ("install cutting-edge python")?

This revision now requires changes to proceed.Jan 13 2020, 6:29 PM

It's possible (and common) to write code that is both valid Python 2 and 3, like in this case.

Whether python3 should be aliased to python now that Python 2 is EOL and Python 3 is the default has been exhaustively debated among various Linux distributions. On my Fedora workstation, /usr/bin/python is a symlink to python3. Same on Arch Linux. On RHEL 8, there is no plain python alias at all, only python2 and python3, same on latest Ubuntu (I think).

Amusingly, Python 2.7 and Python 3.7 result in different game layouts, possibly due to changes in the curses library:

image.png (681×1 px, 27 KB)
(Python 2)

image.png (677×1 px, 22 KB)
(Python 3)

If systems with no binary named python are reasonable to expect, and it sounds like they are, this is fine as-is. I've added you to Blessed Committers so you should be able to land this change yourself (check the project description for some guidance), or let me know if you run into issues. After this lands, I'll land a followup in arc anoid to test for a python3 and emit a friendlier error if it isn't present.

This revision is now accepted and ready to land.Jan 14 2020, 4:35 PM
epriestley edited reviewers, added: beber; removed: epriestley.
This revision now requires review to proceed.Feb 15 2020, 2:52 AM

I incorporated these changes into D21001. Thanks!