hydrabus / hydrafw

HydraBus HydraFW official firmware for open source multi-tool for anyone interested in learning/developping/debugging/hacking/Penetration Testing for basic or advanced embedded hardware
https://hydrabus.com/hydrabus-1-0-specifications
Apache License 2.0
362 stars 92 forks source link

Build System: Convert Python scripts to `python3` #138

Closed jbglaw closed 1 year ago

jbglaw commented 1 year ago

Change Makefile to invoke the Python scripts using the python3 interpreter, as well as using the 2to3 suggested changes to the scripts. Please note that the s/long/int/ change is not taken, as the python3-git module has a "long" option (for a git describe binding) which is obviously not an integer type but requests the long listing format...

Baldanos commented 1 year ago

These scripts work on python2 and python3. Dropping support for python2 should not be a problem, as long as it doesn't break the build process on Windows.

The changes on the print statements are useless though.

I'll do some build tests on Windows. In the meantime, can you update the PR so the useless parenthesis are removed from the changes ?

bvernoux commented 1 year ago

I have nothing to add same remark as @Baldanos I could test on Windows when the changes will be done (remove useless parenthesis which are not required)

bvernoux commented 1 year ago

For information replacing python by python3 does not work on Windows with Python3.9 or more as the executable is python.exe and there is no any alias to python3 by default (so it is not found) So we shall check (or cancel that modification) to be sure it is compatible with Windows Python3 from https://www.python.org/downloads/windows/

jbglaw commented 1 year ago

For information replacing python by python3 does not work on Windows with Python3.9 or more as the executable is python.exe and there is no any alias to python3 by default (so it is not found) So we shall check (or cancel that modification) to be sure it is compatible with Windows Python3 from https://www.python.org/downloads/windows/

  • The only things which can be done is changing #!/usr/bin/env python2 by #!/usr/bin/env python3 in different python scripts

That doesn't really make a difference: This project calls the Python scripts explicitely with an interpreter from Makefile. So the shellbang isn't used at all. (Which is, actually, quite the correct thing to do!) So for practical purposes, Makefile could possibly check for python3 and use python as a fallback.

jbglaw commented 1 year ago

These scripts work on python2 and python3. Dropping support for python2 should not be a problem, as long as it doesn't break the build process on Windows.

The changes on the print statements are useless though.

I'll do some build tests on Windows. In the meantime, can you update the PR so the useless parenthesis are removed from the changes ?

Done.