This is an archive of the discontinued Mercurial Phabricator instance.

pycompat: adding Linux detection and fixing Mac
ClosedPublic

Authored by rdamazio on Nov 5 2018, 10:54 PM.

Details

Summary

Python 3 recommends detecting OSs with the prefix of the platform, but we were
comparing the full string for macOS. We also didn't have Linux detection, which
is convenient for extensions to use (rather than have some OSs detected by hg
and some by the extension).

Reference:
https://docs.python.org/3/library/sys.html#sys.platform

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

rdamazio created this revision.Nov 5 2018, 10:54 PM
lothiraldan accepted this revision.Nov 6 2018, 4:21 AM
lothiraldan added a subscriber: lothiraldan.

LGTM and seems to be what psutil is doing also: https://github.com/giampaolo/psutil/blob/master/psutil/_common.py#L75

This revision was automatically updated to reflect the committed changes.