-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Python bindings: Fix editable install + Execute Python2.7 workflow tests #2044
base: dev
Are you sure you want to change the base?
Conversation
e722a42
to
feb9b53
Compare
Got a few comments on the changes made here, if that's OK:
print(f">>> X2 = {mu.reg_read(UC_ARM64_REG_X2):x}") into this: print(">>> X2 = {reg}".format(reg=hex(mu.reg_read(UC_ARM64_REG_X2)))) but instead, use this: print(">>> X2 = {:#x}".format(mu.reg_read(UC_ARM64_REG_X2))) That former is cumbersome and unreadable, while the latter still resembles the f-string it used to be and might be easier to change back when time comes.
|
Hi @elicn , thanks for the feedback! Yeah so it's quite confusing having both tests and regression tests, I agree. In fact, I asked about this to @wtdcode and it has to be properly integrated into current CI in the upcoming releases once he fixes some bugs. My point here together with the previous PRs that I created was that of at least make them pytest-runnable and be executed within the CI pipeline, right after the build in order to spot bugs/issues. Indeed this helped spot few more bugs that probably were there since some times. Regarding Python2 it's a best-effort thingy and if you check indeed, there is no actual changes beside PEP8 fixes, typos and removing of a python version check that is kinda a leftover from previous refactoring. The changes regarding tests are very dummy I admit, it was to let them run with Python2. I don't think they harm ehehe, but I do agree I can rewrite strings formatting as you suggested. |
@Antelox, my two key points here are:
|
Thanks for your efforts and input. I hope to clarify a bit here.
I agree with this point and we will remove python2 once pypi stops accepting the py2 wheels, which I assume should happen in the near future (?). The goal of this PR is not to "maintain the old and messy" python2 binding but to ensure our "best efforts", which is:
Current workflow changes just ensure that we don't upload broken wheels to pypi (not really maintenance, even not fixing failing tests) and this probably is the last change to py2 before removing py2 from current Furthermore, I will try to separate the whole py2 relic to a standalone folder
That's true and I will merge two tests together once I fix issues found by both of them, or we will always have falling CI. |
Yes I totally agree about Python2 next steps. Since it's a best-effort thingy, it can stay with no further changes then once pypi index starts to reject the upload of py2 wheels then we can totally remove it. However here there is no actual change in favor of py2 beside few strings formatter things in those tests scripts (which as already said they are not actual unittests but just scripts that can be executed to test it doesn't crash). Most of the changes you see are because of PyCharm analyzer while I executed to spot typos and had PEP8 fixed. Then removed the check about python version since it was pointless after the split @wtdcode did in the previous version and you also pointed this out in another PR (#2039 (comment)) I fully agree about having a single folder with tests and if you guys don't like or don't want to use any external testing interfaces, I'm fine to use the native unittest interface offered by python. My point here was just to be sure the re-tagged wheel produced for py2 it's not broken and since I had those scripts in python bindings folder handy I used them for this kind of test as well, and had to change string formatter to make py2 happy. In any case there is no need to revert any changes to make py3 happy, once we decide to remove py2, it's a matter of removing few lines from workflow and the If you all agree I would go ahead with this PR, then I will work on a new one to make workflow use the tests from regress folder and use just unittest interface without pytest (even though I don't see the problem with pytest, it's just a tool that helps write more customized tests but probably not really needed here). I guess the scripts in python bindings can be moved into regress and perhaps removed if they suppose to test the same things already present there.
A next-next step would be review all those regress and add asserts where missing. |
I'm probably the only user of the Python 2 Unicorn left now - I have an operating system that is implemented in Python 2, with Unicorn as the back end. Converting a whole OS from Python 2 to Python 3 is something of a challenge - largely in the handling of strings in Python 2 needing to be converted to bytes in Python 3, with conversions for the encoding rarely done - consequently it's not something I'm rushing to. So I appreciate that Python 2 keeps working for Unicorn. So I appreciate any and all work to make it possible to still run Unicorn with Python 2. |
@gerph, you are just delaying the inevitable, buddy (: |
Whilst that's true, every day is delaying the inevitability of death, so... let's not play down the decision to continue down the paths we choose to take before we get there :-) The fact of the matter is that replacing all the many byte operations within the OS with bytes specific operations, ensuring that everything works the same way, etc, etc, is a non-trivial amount of work. Work that doesn't need to be done - the system runs as it is, and is still as functional as it needs to be. There is an opportunity cost in moving to Python 3, which I have decided is something I don't wish to take. Experiments a year or so back showed that many operations were slower with Python 3 than with Python 2, and so speed isn't of benefit. The support for other packages might help, but then the packages support that the system needs is relatively stable, and can be updated easily. The deployment environment is either local or cloud based, so doesn't force an upgrade. More specifically, the support for Python 2 in Unicorn 2 has been ropey or broken in the last few releases - each official release has required special patching to make Unicorn 2 work in Python 2 - and haven't been great enough to force an update to Unicorn 2. So the additional facilities offered by Unicorn 2 are not currently a driving factor to upgrade to Python 3, either. I understand the situation with Python 2, and - as I said - I appreciate the work being done to keep Python 2 supported. My reinforcement that the work is appreciated, and that there are users who continue to use Python 2, was the intent of my comment. |
- Added missing `license` field in pyproject.toml file - Fixed editable mode install and some more code cleanup in setup.py - Refreshed README.md - Replaced f-string formatter in tests with `format` method in order to be py2-compatible - Fixed typos - PEP8 fixes
…n native arch runners only
- Use #x formatter to format hex values
6465675
to
3b16f68
Compare
Python bindings:
setup.py
license
field inpyproject.toml
fileREADME.md
format
method in order to be py2-compatibleGitHub Action: