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

Fix platform detection in case of FreeBSD in compat module. #756

Merged
merged 3 commits into from
Apr 16, 2019
Merged

Conversation

dwich
Copy link
Contributor

@dwich dwich commented Apr 11, 2019

Problem: For platform detection for Python >= 3.6 the distro package is used. For lower version of Python the built-in package platform is used.

distro.linux_distribution() is used to detect Linux
distro.version() is used to detecting FreeBSD

Method distro.version() should not be used because distro can be either distro itself or import platform as distro, therefore:

platform.version() and distro.version() return different values.
platform.version() returns 'FreeBSD 11.2-RELEASE-p9.....'
distro.version() returns '11.2'

Solution: Do not detect platform and version (in case of FreeBSD) using distro package, which is useful for linux but it's not necessary for FreeBSD.

@codecov
Copy link

codecov bot commented Apr 11, 2019

Codecov Report

Merging #756 into development will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@               Coverage Diff               @@
##           development     #756      +/-   ##
===============================================
- Coverage        97.76%   97.76%   -0.01%     
===============================================
  Files               62       62              
  Lines             4528     4527       -1     
  Branches           232      232              
===============================================
- Hits              4427     4426       -1     
  Misses              86       86              
  Partials            15       15
Impacted Files Coverage Δ
...-engine/google_compute_engine/tests/compat_test.py 84.09% <100%> (-0.7%) ⬇️
...gle-compute-engine/google_compute_engine/compat.py 76.71% <100%> (+0.32%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update f088f83...a3244e4. Read the comment docs.

Copy link
Contributor

@hopkiw hopkiw left a comment

Choose a reason for hiding this comment

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

Confirmed that there's no variance distro vs platform on supported Linux distributions and that we never expect/utilize version info for FreeBSD. Logic looks fine for current applications.

@illfelder
Copy link
Contributor

Thanks for the contribution! This looks good to me.

@illfelder illfelder merged commit 24bdbbd into GoogleCloudPlatform:development Apr 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants