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

[Build] Support windows in resolve_buck.py #4856

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

python3kgae
Copy link
Contributor

Add Windows support to BUCK_PLATFORM_MAP.
Also use urllib.request.urlretrieve directly to work around PermissionError on Windows.

For #4661

Copy link

pytorch-bot bot commented Aug 23, 2024

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/4856

Note: Links to docs will display an error until the docs builds have been completed.

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 23, 2024
print(f"Downloading buck2 from {buck2_archive_url}...", file=sys.stderr)
urllib.request.urlretrieve(buck2_archive_url, archive_file.name)
archive_file, _ = urllib.request.urlretrieve(buck2_archive_url)
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 change is based on posit-dev/py-shiny#287

It works around PermissionError on Windows.
This happens because urlretrieve is trying to open an already-open temporary file by name, which isn't permitted on Windows. It's basically the same as

from tempfile import NamedTemporaryFile

with NamedTemporaryFile() as tmp:
    open(tmp.name, "wb")

@digantdesai digantdesai added module: build Related to buck2 and cmake build triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module labels Aug 23, 2024
@python3kgae
Copy link
Contributor Author

Gentle ping.

@python3kgae
Copy link
Contributor Author

Don't have access to add more reviewer myself :(
Hope someone could see this.

@kirklandsign
@dbort
@tarun292
@dvorjackz

Add Windows support to BUCK_PLATFORM_MAP.
Also use urllib.request.urlretrieve directly to work around PermissionError on Windows.

For pytorch#4661
@python3kgae
Copy link
Contributor Author

Rebased and gentle ping again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. module: build Related to buck2 and cmake build triaged This issue has been looked at a team member, and triaged and prioritized into an appropriate module
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants