-
Notifications
You must be signed in to change notification settings - Fork 19
refactor: Remove all usage of custom OSName class #203
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
base: mainline
Are you sure you want to change the base?
Conversation
4fd4ffc to
667c001
Compare
f4c4767 to
8afeab6
Compare
8afeab6 to
2046441
Compare
* Instead of the custom OSName, use Python idioms. This will be easier
to understand for Python developers and tooling that is processing the
code.
1. For Windows: os.name == "nt"
2. For POSIX: os.name != "nt"
3. For MacOS: sys.platform == "darwin"
4. For a human-readable OS description: platform.platform()
* Comments '# pragma: is-windows' were unclear, it required
investigation to learn that this is a coverage directive. Rename the
directive to '# pragma: skip-coverage-windows'
Signed-off-by: Mark <[email protected]>
2046441 to
dcae681
Compare
|
| self._source_path_format: str = source_path_format | ||
|
|
||
| destination_os = destination_os.upper() | ||
| if destination_os not in ("WINDOWS", "POSIX"): |
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.
do we need to temporarily accept "Linux"/"Macos" as well (whatever the previous values were)? otherwise, previous rules may now raise ValueErrors
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.
Both of those should map to POSIX, you're right that it was doing something different before. I'll do a quick survey of the deadline-cloud-for-* projects to get a sense of usage, likely we accept them as input and transform them into "POSIX".



What was the problem/requirement? (What/Why)
The library implements a custom OSName for checking which OS it's running on and
reporting in error messages. It also contains '#pragma is-windows' and similar comments
that a code reader will misinterpret.
What was the solution? (How)
What is the impact of this change?
The code is easier to work with and maintain because it follows Python idioms more closely.
How was this change tested?
Ran the unit test.
As a follow-up test, I ran the deadline-cloud-for-blender integration tests with this library (by running pytest directly in an environment including both instead of relying on hatch). See the related aws-deadline/deadline-cloud-for-blender#241 that I produced in the course of that.
Was this change documented?
No
Is this a breaking change?
No. The OSName class is still in the code, it is commented as deprecated, and the implementation no longer uses it.
Does this change impact security?
No
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.