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

yarn: Universal utility for Yarn version detection #701

Merged
merged 6 commits into from
Oct 24, 2024

Conversation

a-ovchinnikov
Copy link
Collaborator

This commit unifies handling of version info for Yarn and Yarn Classic package managers.

Resolves: #660

Maintainers will complete the following section

  • Commit messages are descriptive enough
  • Code coverage from testing does not decrease and new code is covered
  • Docs updated (if applicable)
  • Docs links in the code are still valid (if docs were updated)

Note: if the contribution is external (not from an organization member), the CI
pipeline will not run automatically. After verifying that the CI is safe to run:

Copy link
Member

@eskultety eskultety left a comment

Choose a reason for hiding this comment

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

Nitpicks only, quick respin will do!

cachi2/core/package_managers/yarn/utils.py Outdated Show resolved Hide resolved
cachi2/core/package_managers/yarn/utils.py Outdated Show resolved Hide resolved
cachi2/core/package_managers/yarn/utils.py Outdated Show resolved Hide resolved
cachi2/core/package_managers/yarn/main.py Show resolved Hide resolved
Copy link
Member

@eskultety eskultety left a comment

Choose a reason for hiding this comment

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

ACK with the tiny adjustments.

cachi2/core/package_managers/yarn/main.py Show resolved Hide resolved
@@ -118,7 +118,7 @@ def _configure_yarn_version(project: Project) -> None:
yarn_path_version = get_semver_from_yarn_path(project.yarn_rc.yarn_path)
package_manager_version = get_semver_from_package_manager(project.package_json.package_manager)

if not yarn_path_version and not package_manager_version:
if yarn_path_version is None and package_manager_version is None:
Copy link
Member

Choose a reason for hiding this comment

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

Unrelated PEP correctness check update --> separate commit.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok. Done.

The function will be made into a shared utility and used to
refactor yarn_classic in future commits.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
And making Yarn PM use it.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
This change makes yarn-classic reuse version extraction code
from yarn.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
This change introduces VersionRange class to simplify
checks for version belonging to a range of versions.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
Now Version is checked against VersionsRange object.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
This commit makes Yarn PM a bit more PEP8 compliant by
replacing two implied None checks with explicit ones.

Signed-off-by: Alexey Ovchinnikov <[email protected]>
@a-ovchinnikov a-ovchinnikov added this pull request to the merge queue Oct 24, 2024
Merged via the queue into containerbuildsystem:main with commit 5ad6baf Oct 24, 2024
16 checks passed
@a-ovchinnikov a-ovchinnikov deleted the issue660 branch October 24, 2024 14:10
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.

Yarn 1.x: Unify yarn version detection with Yarn v2+
4 participants