Skip to content

Upgrade jerry-debugger client to use python3 #4825

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

Conversation

repasics
Copy link
Contributor

Also upgrade pylint to use python3.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi [email protected]

@rerobika rerobika requested a review from galpeter November 15, 2021 13:34
@rerobika rerobika added the debugger Related to the debugger label Nov 15, 2021
Copy link
Contributor

@galpeter galpeter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

General question: do we want to remove full python2 support?

@@ -104,7 +104,7 @@ def do_next(self, args):
if res_type == result.END:
self.quit = True
return
elif res_type == result.TEXT:
if res_type == result.TEXT:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to change elif to if? This applies to most of the cases.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pylint does not accepts elif here becasue of return in previous if statement:

************* Module jerry_client
jerry-debugger/jerry_client.py:104:20: R1705: Unnecessary "elif" after "return" (no-else-return)

@@ -279,7 +279,6 @@ def main():

protocol = Socket(address)
elif args.protocol == "serial":
from jerry_client_serial import Serial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we really need to move this out of here? If so, we always expect that a user will install the serial package even if they will only use the socket based communication.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved import to top level because of pylint.

************* Module jerry_client
jerry-debugger/jerry_client.py:281:8: C0415: Import outside toplevel (jerry_client_serial) (import-outside-toplevel)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can move back the import there and disable pylint on that row.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was only error locally so I reverted this.

breakpoint = JerryBreakpoint(_line, offset, self)
self.lines[_line] = breakpoint
self.offsets[offset] = breakpoint
br_point = JerryBreakpoint(_line, offset, self)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need to rename the "breakpoint" variable? This also applies to other places.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename is needed because breakopoint is a built-in.

************* Module jerry_client_main
jerry-debugger/jerry_client_main.py:215:12: W0622: Redefining built-in 'breakpoint' (redefined-builtin)

@@ -398,13 +402,13 @@ def delete(self, args):
return "Error: Breakpoint index expected\n" \
"Delete the given breakpoint, use 'delete all|active|pending' " \
"to clear all the given breakpoints\n "
elif args in ['all', 'pending', 'active']:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change the "elif" to "if" ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a return above.

@@ -888,7 +891,7 @@ def _parse_source(self, data):
logging.error("Syntax error found")
return ""

elif buffer_type in [JERRY_DEBUGGER_SOURCE_CODE, JERRY_DEBUGGER_SOURCE_CODE_END]:
if buffer_type in [JERRY_DEBUGGER_SOURCE_CODE, JERRY_DEBUGGER_SOURCE_CODE_END]:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why change elif to if?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Comment on lines 986 to 987
for function in list(new_function_list.values()):
for line, br_point in list(function.lines.items()):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the list calls?

Comment on lines 997 to 1002
for src in list(new_function_list.values()):
if (src.source_name == br_point.source_name or
src.source_name.endswith("/" + br_point.source_name) or
src.source_name.endswith("\\" + br_point.source_name)):
source_lines = len(src.source)
break
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need the list call here?

@repasics repasics force-pushed the jerry-debugger-python2to3 branch 2 times, most recently from ad99e49 to 69c41a5 Compare November 16, 2021 12:53
@repasics
Copy link
Contributor Author

Updated the PR. 2to3 app changed the parenthesis, next function and list call.
I reverted the parenthesis- and 'next' function change, but had to keep 2 of list calls to avoid runtime errors.

Also upgrade pylint to use python3.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi [email protected]
@repasics repasics force-pushed the jerry-debugger-python2to3 branch from 69c41a5 to 809a83e Compare December 8, 2021 11:37
@repasics repasics requested a review from rerobika December 8, 2021 12:53
@LaszloLango LaszloLango added this to the Release 3.0.0 milestone Nov 12, 2024
@lygstate
Copy link
Contributor

this can be closed, python3 is already supported?

@robertsipka
Copy link
Contributor

I've just closed this PR due to python3 is already supported.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Related to the debugger
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants