Skip to content
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

Ner build fixups #180

Merged
merged 6 commits into from
Oct 15, 2024
Merged

Ner build fixups #180

merged 6 commits into from
Oct 15, 2024

Conversation

jr1221
Copy link
Contributor

@jr1221 jr1221 commented Oct 14, 2024

Fixups for NER build. Mainly switch to WSL as it is closer to Linux. See accompanying Cerb PR.

@jr1221 jr1221 requested a review from dyldonahue October 14, 2024 23:44
@jr1221
Copy link
Contributor Author

jr1221 commented Oct 15, 2024

I coded this all in notepad lol python is funny.


command = []
#if args.docker:
# print("Dockerized openocd unsupported for gdb")
Copy link
Contributor

Choose a reason for hiding this comment

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

can we clean out unused code comments

print("Error: No ELF file found in ./build/")
sys.exit(1)

elf_file = os.path.basename(os.path.normpath(elf_files[0])) # Take the first ELF file found
Copy link
Contributor

Choose a reason for hiding this comment

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

whats this basename command for. I trust it works ig but i thought u could just directly do elf_files[0]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The filepath is different inside of docker.

if stderr_output:
print(stderr_output, file=sys.stderr)

process = subprocess.Popen(command, text=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

did we find a way to get this streaming to work without that while loop? i thought we added that explicitly to get some form of sreamed output

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just don't use PIPE. Everything apparently works as long as the code doesn't need to access the output.

Copy link
Contributor

Choose a reason for hiding this comment

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

Idk I tested before adding this and running flash showed nothing on output, but if u tested this then alright

@@ -294,6 +348,18 @@ def disconnect_usbip():
command = ["sudo", "usbip", "detach", "-p", "0"]
run_command(command, exit_on_fail=False)

def is_wsl(v: str = platform.uname().release) -> int:
"""
detects if Python is running in WSL
Copy link
Contributor

@dyldonahue dyldonahue Oct 15, 2024

Choose a reason for hiding this comment

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

there are better ways to detect WSL:

if platform.system() == "Linux" and "microsoft" in platform.uname().release.lower():

or

if 'WSL_DISTRO_NAME' in os.environ:
return 2 # WSL2

id rather us use one of these, seems cleaner than ur method

Copy link
Contributor

@dyldonahue dyldonahue left a comment

Choose a reason for hiding this comment

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

approving to get goign on a new PR which will address the only desired change here

@dyldonahue dyldonahue merged commit 357727f into main Oct 15, 2024
2 checks passed
@dyldonahue dyldonahue deleted the ner-build-fixups branch October 15, 2024 19:18
@dyldonahue dyldonahue restored the ner-build-fixups branch October 15, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants