-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Port to Python 3. #132
base: master
Are you sure you want to change the base?
Port to Python 3. #132
Conversation
Used the 2to3 tool. Several division operations were manually edited, these may be incorrect. `libtcodpy.py` is not used and has been removed. Key repeat functions were removed as they're not supported.
Python 3 does not allow comparing int with None.
I need this so that my editor doesn't try to replace all the tabs with spaces.
Partial fixes for the keypad and shift key.
It might be better to rename all the uses of this import instead, but this way was a smaller change.
This function was not being called, causing a crash when dialogs are accessed later.
The rounds attribute is a list of bullets, so this function should be comparing the length of these lists instead of using a number. This logs a ton of errors, but these errors seem to be correct based on the debugging of this method. It looks like clips are spawned without bullets in them.
You can now build a distribution using the following command: `pyinstaller build.spec`
This is really cool! A few people have taken a stab at this but ran into issues. I really appreciate the work. Once I get some time to dive into it I'll see what I can do to get it merged. And yes, this version was abandoned right after the last commit (2014?) I made some minor fixes later on for whatever reason, probably to get it running for a demo. I did a rewrite in C a few years ago, but that was for a commercial release that had its production halted. I'll get to this merge eventually, maybe within a week or so. Thanks again! |
I was hesitant to mark this as ready since it felt like there was probably more I could do. The key repeat changes affected movement but I'm not sure how I should adjust it. I might also add automated builds using GitHub Actions which is something I can do easily. There are also graphical issues with the UI where it looks like the UI background isn't being cleared.
I've spent a lot of time writing code that supports both versions of Python 2/3 and helping others port code to Python 3. I used the 2to3 tool. After that I ran into issues I recognized as Python's new division handling. You have to go though each use of division and decide if the result is supposed to be a float or integer. Most things related to chunk handling need floor division. Cases where you'd need to cast to float before division are now converted to float automatically. I then had minor issues with importing. The star importing of the |
Change git describe to use any tag.
Earlier versions had visual regressions. The version must be 12.3.2 or later.
Here are some test builds I have so far. There's an Ubuntu build too, but it's slightly too big to attach. |
Currently Linux requires cffi to be installed before installing other libraries.
This new version should fix the cffi issue, so it no longer needs to be preinstalled. Disabled fail-fast so that partially failing jobs won't prevent all distributions from being built.
I often hear about this game but I don't think there's been a binary release anywhere. I wanted to look at it but would rather not reinstall Python 2.7. I have experience with updating older Python code.
I've ported the sources to Python 3 and updated the code to use the newer versions of python-tcod. The current program seems to be full of regressions but I can't always tell if they are from porting the code or from the master branch itself compared to the latest tagged commit. There were some cases where I needed to fix issues unrelated to the port to get the game running.
Updates to libtcod mean an update to SDL2 so key repeat behavior is affected. This code uses a lot of division which has changed behavior in Python 3. I can't be sure that division is correct until type hinting is added.
This update allows distributing releases via PyInstaller. You no longer need to manually handle DLL files and can more easily run the game on Mac or Linux.
I'm under the impression that this project is abandoned. Are there any updates on that?