-
Notifications
You must be signed in to change notification settings - Fork 1
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
feat(pat-3825): discover dpm cloud token from session.json - Python #103
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few minor fixes requested, but LGTM
session_dir = os.path.join(root_dir, '.config', 'dpm', 'session.json') | ||
|
||
try: | ||
with open(session_dir, 'r') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: If none of the platforms match (unlikely), then session_dir
is undefined. So, define session_path = ''
before the if
block.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if there's a way we can declare (probably in Cargo.toml) that dpm
does not support anything other than some set of target triples that we provide. Alas, that doesn't seem to exist:
- Allow specifying a set of supported target platforms in Cargo.toml rust-lang/cargo#6179
- search/browse for crates that support a specific platform rust-lang/crates.io#3207
- https://doc.rust-lang.org/cargo/reference/manifest.html
Agree that this is a nit. In the docs leading up to the cargo install dpm
we'll be clear that we only support Windows, macOS, and Linux.
session_dir = os.path.join(root_dir, '.config', 'dpm', 'session.json') | ||
|
||
try: | ||
with open(session_dir, 'r') as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wondered if there's a way we can declare (probably in Cargo.toml) that dpm
does not support anything other than some set of target triples that we provide. Alas, that doesn't seem to exist:
- Allow specifying a set of supported target platforms in Cargo.toml rust-lang/cargo#6179
- search/browse for crates that support a specific platform rust-lang/crates.io#3207
- https://doc.rust-lang.org/cargo/reference/manifest.html
Agree that this is a nit. In the docs leading up to the cargo install dpm
we'll be clear that we only support Windows, macOS, and Linux.
Tested by printing results from getDpmAuthToken with sample
tech.patch.dpm/session.json
directory and no environment variable.