Bump distro from 1.7.0 to 1.8.0 (#1895)

* Bump distro from 1.7.0 to 1.8.0

Bumps [distro](https://github.com/python-distro/distro) from 1.7.0 to 1.8.0.
- [Release notes](https://github.com/python-distro/distro/releases)
- [Changelog](https://github.com/python-distro/distro/blob/master/CHANGELOG.md)
- [Commits](https://github.com/python-distro/distro/compare/v1.7.0...v1.8.0)

---
updated-dependencies:
- dependency-name: distro
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update distro==1.8.0

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2022-11-14 11:27:01 -08:00 committed by GitHub
parent 6b835226cd
commit b31d75aeee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 64 additions and 39 deletions

View file

@ -55,7 +55,7 @@ except ImportError:
# Python 3.7 # Python 3.7
TypedDict = dict TypedDict = dict
__version__ = "1.7.0" __version__ = "1.8.0"
class VersionDict(TypedDict): class VersionDict(TypedDict):
@ -122,6 +122,26 @@ _DISTRO_RELEASE_CONTENT_REVERSED_PATTERN = re.compile(
# Pattern for base file name of distro release file # Pattern for base file name of distro release file
_DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$") _DISTRO_RELEASE_BASENAME_PATTERN = re.compile(r"(\w+)[-_](release|version)$")
# Base file names to be looked up for if _UNIXCONFDIR is not readable.
_DISTRO_RELEASE_BASENAMES = [
"SuSE-release",
"arch-release",
"base-release",
"centos-release",
"fedora-release",
"gentoo-release",
"mageia-release",
"mandrake-release",
"mandriva-release",
"mandrivalinux-release",
"manjaro-release",
"oracle-release",
"redhat-release",
"rocky-release",
"sl-release",
"slackware-version",
]
# Base file names to be ignored when searching for distro release file # Base file names to be ignored when searching for distro release file
_DISTRO_RELEASE_IGNORE_BASENAMES = ( _DISTRO_RELEASE_IGNORE_BASENAMES = (
"debian_version", "debian_version",
@ -200,6 +220,7 @@ def id() -> str:
"opensuse" openSUSE "opensuse" openSUSE
"amzn" Amazon Linux "amzn" Amazon Linux
"arch" Arch Linux "arch" Arch Linux
"buildroot" Buildroot
"cloudlinux" CloudLinux OS "cloudlinux" CloudLinux OS
"exherbo" Exherbo Linux "exherbo" Exherbo Linux
"gentoo" GenToo Linux "gentoo" GenToo Linux
@ -221,6 +242,7 @@ def id() -> str:
"midnightbsd" MidnightBSD "midnightbsd" MidnightBSD
"rocky" Rocky Linux "rocky" Rocky Linux
"aix" AIX "aix" AIX
"guix" Guix System
============== ========================================= ============== =========================================
If you have a need to get distros for reliable IDs added into this set, If you have a need to get distros for reliable IDs added into this set,
@ -876,6 +898,9 @@ class LinuxDistribution:
if self.uname_attr("id").startswith("aix"): if self.uname_attr("id").startswith("aix"):
# On AIX platforms, prefer oslevel command output. # On AIX platforms, prefer oslevel command output.
versions.insert(0, self.oslevel_info()) versions.insert(0, self.oslevel_info())
elif self.id() == "debian" or "debian" in self.like().split():
# On Debian-like, add debian_version file content to candidates list.
versions.append(self._debian_version)
version = "" version = ""
if best: if best:
# This algorithm uses the last version in priority order that has # This algorithm uses the last version in priority order that has
@ -1186,6 +1211,16 @@ class LinuxDistribution:
return "" return ""
return self._to_str(stdout).strip() return self._to_str(stdout).strip()
@cached_property
def _debian_version(self) -> str:
try:
with open(
os.path.join(self.etc_dir, "debian_version"), encoding="ascii"
) as fp:
return fp.readline().rstrip()
except FileNotFoundError:
return ""
@staticmethod @staticmethod
def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]: def _parse_uname_content(lines: Sequence[str]) -> Dict[str, str]:
if not lines: if not lines:
@ -1228,14 +1263,14 @@ class LinuxDistribution:
# file), because we want to use what was specified as best as # file), because we want to use what was specified as best as
# possible. # possible.
match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
if "name" in distro_info and "cloudlinux" in distro_info["name"].lower():
distro_info["id"] = "cloudlinux"
elif match:
distro_info["id"] = match.group(1)
return distro_info
else: else:
try: try:
basenames = os.listdir(self.etc_dir) basenames = [
basename
for basename in os.listdir(self.etc_dir)
if basename not in _DISTRO_RELEASE_IGNORE_BASENAMES
and os.path.isfile(os.path.join(self.etc_dir, basename))
]
# We sort for repeatability in cases where there are multiple # We sort for repeatability in cases where there are multiple
# distro specific files; e.g. CentOS, Oracle, Enterprise all # distro specific files; e.g. CentOS, Oracle, Enterprise all
# containing `redhat-release` on top of their own. # containing `redhat-release` on top of their own.
@ -1245,39 +1280,29 @@ class LinuxDistribution:
# sure about the *-release files. Check common entries of # sure about the *-release files. Check common entries of
# /etc for information. If they turn out to not be there the # /etc for information. If they turn out to not be there the
# error is handled in `_parse_distro_release_file()`. # error is handled in `_parse_distro_release_file()`.
basenames = [ basenames = _DISTRO_RELEASE_BASENAMES
"SuSE-release",
"arch-release",
"base-release",
"centos-release",
"fedora-release",
"gentoo-release",
"mageia-release",
"mandrake-release",
"mandriva-release",
"mandrivalinux-release",
"manjaro-release",
"oracle-release",
"redhat-release",
"rocky-release",
"sl-release",
"slackware-version",
]
for basename in basenames: for basename in basenames:
if basename in _DISTRO_RELEASE_IGNORE_BASENAMES:
continue
match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename) match = _DISTRO_RELEASE_BASENAME_PATTERN.match(basename)
if match: if match is None:
filepath = os.path.join(self.etc_dir, basename) continue
distro_info = self._parse_distro_release_file(filepath) filepath = os.path.join(self.etc_dir, basename)
if "name" in distro_info: distro_info = self._parse_distro_release_file(filepath)
# The name is always present if the pattern matches # The name is always present if the pattern matches.
self.distro_release_file = filepath if "name" not in distro_info:
distro_info["id"] = match.group(1) continue
if "cloudlinux" in distro_info["name"].lower(): self.distro_release_file = filepath
distro_info["id"] = "cloudlinux" break
return distro_info else: # the loop didn't "break": no candidate.
return {} return {}
if match is not None:
distro_info["id"] = match.group(1)
# CloudLinux < 7: manually enrich info with proper id.
if "cloudlinux" in distro_info.get("name", "").lower():
distro_info["id"] = "cloudlinux"
return distro_info
def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]: def _parse_distro_release_file(self, filepath: str) -> Dict[str, str]:
""" """

View file

@ -10,7 +10,7 @@ certifi==2022.9.24
cheroot==8.6.0 cheroot==8.6.0
cherrypy==18.8.0 cherrypy==18.8.0
cloudinary==1.30.0 cloudinary==1.30.0
distro==1.7.0 distro==1.8.0
dnspython==2.2.1 dnspython==2.2.1
facebook-sdk==3.1.0 facebook-sdk==3.1.0
future==0.18.2 future==0.18.2