Check SONiC dependencies before installation.#13850
Merged
xumia merged 13 commits intosonic-net:masterfrom Mar 2, 2023
Merged
Conversation
5bfa7bb to
050a6a3
Compare
xumia
approved these changes
Feb 27, 2023
qiluo-msft
reviewed
Feb 27, 2023
| 'sonic-yang-mgmt>=1.0', | ||
| 'sonic-yang-models>=1.0' | ||
| ] | ||
| sonic_dependencies += ['sonic-yang-mgmt', 'sonic-yang-models'] |
Collaborator
Contributor
Author
There was a problem hiding this comment.
We can't generate from dependencies. Something like swsssdk didn't have prefix sonic-*.
Collaborator
There was a problem hiding this comment.
sonic_dependencies could be ground truth, including the package names and version comparison.
- install_requires could take the package names and version comparison. No need to repeat each package.
- get_distribution check could take the package names, and fetch local versions, and compare with expected condition.
qiluo-msft
reviewed
Feb 27, 2023
| try: | ||
| pkg_resources.get_distribution(package) | ||
| except pkg_resources.DistributionNotFound: | ||
| print(package+" is not found!") |
Collaborator
Contributor
Author
There was a problem hiding this comment.
It should be used by python2 and python3.
we can't use print. Use sys.stderr.write instead.
Collaborator
There was a problem hiding this comment.
you can use print(msg, file=sys.stderr)
Contributor
Author
There was a problem hiding this comment.
python2 doesn't support it.
qiluo-msft
reviewed
Feb 27, 2023
qiluo-msft
approved these changes
Mar 1, 2023
xumia
pushed a commit
to xumia/sonic-buildimage-1
that referenced
this pull request
Mar 10, 2023
Why I did it SONiC related packages shouldn't be intalled from Pypi. It is security compliance requirement. How I did it Check SONiC related packages when using setup.py. How to verify it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why I did it
SONiC related packages shouldn't be intalled from Pypi.
It is security compliance requirement.
How I did it
Check SONiC related packages when using setup.py.
How to verify it
Which release branch to backport (provide reason below if selected)
Description for the changelog
Ensure to add label/tag for the feature raised. example - PR#2174 under sonic-utilities repo. where, Generic Config and Update feature has been labelled as GCU.
Link to config_db schema for YANG module changes
A picture of a cute animal (not mandatory but encouraged)