Skip to content

Upgrade jerry-debugger client to use python3#4825

Closed
repasics wants to merge 1 commit into
jerryscript-project:masterfrom
repasics:jerry-debugger-python2to3
Closed

Upgrade jerry-debugger client to use python3#4825
repasics wants to merge 1 commit into
jerryscript-project:masterfrom
repasics:jerry-debugger-python2to3

Conversation

@repasics

Copy link
Copy Markdown
Contributor

Also upgrade pylint to use python3.

JerryScript-DCO-1.0-Signed-off-by: Csaba Repasi repasics@inf.u-szeged.hu

@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

@galpeter galpeter left a comment

Copy link
Copy Markdown
Contributor

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?

self.quit = True
return
elif res_type == result.TEXT:
if res_type == result.TEXT:

Copy link
Copy Markdown
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
Copy Markdown
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)


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

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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.

Comment thread jerry-debugger/jerry_client_tcp.py Outdated
Comment thread tools/runners/test262-harness.py
breakpoint = JerryBreakpoint(_line, offset, self)
self.lines[_line] = breakpoint
self.offsets[offset] = breakpoint
br_point = JerryBreakpoint(_line, offset, self)

Copy link
Copy Markdown
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
Copy Markdown
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)

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
Copy Markdown
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
Copy Markdown
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.

Comment thread jerry-debugger/jerry_client_main.py Outdated
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto.

Comment thread jerry-debugger/jerry_client_main.py Outdated
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
Copy Markdown
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 thread jerry-debugger/jerry_client_main.py Outdated
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
Copy Markdown
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
Copy Markdown
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 repasics@inf.u-szeged.hu
@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
Copy Markdown
Contributor

this can be closed, python3 is already supported?

@robertsipka

Copy link
Copy Markdown
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