Page MenuHomePhabricator

breakout: migrate to python3
AbandonedPublic

Authored by epriestley on Jan 11 2020, 9:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Nov 16, 1:41 PM
Unknown Object (File)
Tue, Nov 12, 5:33 AM
Unknown Object (File)
Thu, Nov 7, 7:52 PM
Unknown Object (File)
Oct 21 2024, 7:24 PM
Unknown Object (File)
Sep 9 2024, 6:56 PM
Unknown Object (File)
Aug 6 2024, 11:07 PM
Unknown Object (File)
Jul 31 2024, 1:18 AM
Unknown Object (File)
Jul 27 2024, 8:19 AM

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!