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

Update commoncode #55

Merged
merged 2 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Changelog
=========

v33.0.0
--------

This is a major release with an API change.

- ``container_inspector.distro.parse_os_release`` and its tests have been moved
to ``commoncode.distro.parse_os_release``. container-inspector has been
updated to use ``commoncode.distro.parse_os_release``.


v32.0.1
--------

Expand All @@ -12,7 +22,7 @@ This is a minor release with bug fixes.
Thank you to AJ Arena @sig-aarena


v32.0.0
v32.0.0
--------

This is a minor release with bug fixes and an output change.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ chardet==5.0.0
charset-normalizer==2.1.0
click==8.1.3
colorama==0.4.5
commoncode==31.0.0b4
commoncode==31.2.1
construct==2.10.68
cryptography==37.0.4
debian-inspector==31.0.0b1
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ install_requires =
click >= 6.7, !=7.0, !=8.0.3
attrs >= 18.1, !=20.1.0
dockerfile_parse
commoncode >= 30.2.0
commoncode >= 31.2.1


[options.packages.find]
Expand Down
36 changes: 2 additions & 34 deletions src/container_inspector/distro.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@

import logging
import os
import shlex
from os import path

import attr
from commoncode.distro import parse_os_release

from container_inspector import rootfs


TRACE = False
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -471,39 +472,6 @@ def merge(self, other_distro):
return type(self)(**existing)


def parse_os_release(location):
"""
Return a mapping built from an os-release-like file at `location`.

See https://www.linux.org/docs/man5/os-release.html

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="16.04.6 LTS (Xenial Xerus)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 16.04.6 LTS"
VERSION_ID="16.04"
HOME_URL="http://www.ubuntu.com/"
SUPPORT_URL="http://help.ubuntu.com/"
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
VERSION_CODENAME=xenial
UBUNTU_CODENAME=xenial

Note the /etc/lsb-release file has the same format, but different tags.
"""
with open(location) as osrl:
lines = (line.strip() for line in osrl)
lines = (
line.partition('=') for line in lines
if line and not line.startswith('#')
)
return {
key.strip(): ''.join(shlex.split(value))
for key, _, value in lines
}


def get_debian_details():
"""
See /etc/dpkg/origins/ for Debian distro.
Expand Down

This file was deleted.

11 changes: 0 additions & 11 deletions tests/data/distro/os-release/amazon/amazon-2.txt-expected.json

This file was deleted.

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions tests/data/distro/os-release/antergos/antergos.txt-expected.json

This file was deleted.

13 changes: 0 additions & 13 deletions tests/data/distro/os-release/arch/arch-arm-new.txt-expected.json

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/distro/os-release/arch/arch-arm.txt-expected.json

This file was deleted.

9 changes: 0 additions & 9 deletions tests/data/distro/os-release/arch/arch-mini.txt-expected.json

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/distro/os-release/arch/arch.txt-expected.json

This file was deleted.

12 changes: 0 additions & 12 deletions tests/data/distro/os-release/artix/artix.txt-expected.json

This file was deleted.

16 changes: 0 additions & 16 deletions tests/data/distro/os-release/centos/centos-7.txt-expected.json

This file was deleted.

This file was deleted.

12 changes: 0 additions & 12 deletions tests/data/distro/os-release/clearos/clearos-7.txt-expected.json

This file was deleted.

This file was deleted.

This file was deleted.

11 changes: 0 additions & 11 deletions tests/data/distro/os-release/cumulus/cumulus-3.7.txt-expected.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/data/distro/os-release/debian/debian-10.txt-expected.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/data/distro/os-release/debian/debian-11.txt-expected.json

This file was deleted.

11 changes: 0 additions & 11 deletions tests/data/distro/os-release/debian/debian-7.txt-expected.json

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/distro/os-release/debian/debian-8.txt-expected.json

This file was deleted.

10 changes: 0 additions & 10 deletions tests/data/distro/os-release/debian/debian-9.txt-expected.json

This file was deleted.

This file was deleted.

This file was deleted.

Loading
Loading