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

Feature/ppcvletoolchain #338

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
Open
Prev Previous commit
Next Next commit
Add script to download PPC VLE toolchain
rbs-jacob committed Jun 28, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit ef4a988af40b8960c426711bfadf492fcf9549bb
51 changes: 51 additions & 0 deletions ofrak_patch_maker/download_ppcvle.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import argparse
import os

from playwright.sync_api import sync_playwright


START_URL = "https://www.nxp.com/design/software/development-software/s32-design-studio-ide/s32-design-studio-for-power-architecture:S32DS-PA"
DOWNLOAD_PATH = "gcc-4.9.4-Ee200-eabivle-x86_64-linux-g2724867.zip"


def run(page, email, password) -> None:
print("Going to page")
page.goto()
page.get_by_role("listitem").filter(
has_text="Build Tools NXP Embedded GCC for Power Architecture"
).filter(has_text="Linux").get_by_role("link", name="Download", exact=True).click()

print("Signing in")
page.locator("#username").click()
page.keyboard.type(email)
page.locator("#password").click()
page.keyboard.type(password)
page.get_by_role("button", name="SIGN IN").click()

print("Accepting terms and conditions")
page.get_by_role("button", name="I Accept").click()

print("Waiting for download")
with page.expect_download() as download_info:
# Download begins when the page is loaded
pass
os.rename(download_info.value.path(), DOWNLOAD_PATH)

print(f"Complete! Saved to {DOWNLOAD_PATH}")


def main(args):
with sync_playwright() as playwright:
browser = playwright.chromium.launch(headless=True)
context = browser.new_context()
page = context.new_page()
run(page, args.email, args.password)
context.close()
browser.close()


if __name__ == "__main__":
argument_parser = argparse.ArgumentParser()
argument_parser.add_argument("email")
argument_parser.add_argument("password")
main(argument_parser.parse_args())