Skip to content

Commit 8648b1e

Browse files
authored
Merge pull request #55 from nexB/update-commoncode
Update commoncode
2 parents c050ff2 + cf83ddb commit 8648b1e

File tree

202 files changed

+15
-2931
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

202 files changed

+15
-2931
lines changed

CHANGELOG.rst

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Changelog
22
=========
33

4+
v33.0.0
5+
--------
6+
7+
This is a major release with an API change.
8+
9+
- ``container_inspector.distro.parse_os_release`` and its tests have been moved
10+
to ``commoncode.distro.parse_os_release``. container-inspector has been
11+
updated to use ``commoncode.distro.parse_os_release``.
12+
13+
414
v32.0.1
515
--------
616

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

1424

15-
v32.0.0
25+
v32.0.0
1626
--------
1727

1828
This is a minor release with bug fixes and an output change.

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ chardet==5.0.0
99
charset-normalizer==2.1.0
1010
click==8.1.3
1111
colorama==0.4.5
12-
commoncode==31.0.0b4
12+
commoncode==31.2.1
1313
construct==2.10.68
1414
cryptography==37.0.4
1515
debian-inspector==31.0.0b1

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ install_requires =
6060
click >= 6.7, !=7.0, !=8.0.3
6161
attrs >= 18.1, !=20.1.0
6262
dockerfile_parse
63-
commoncode >= 30.2.0
63+
commoncode >= 31.2.1
6464

6565

6666
[options.packages.find]

src/container_inspector/distro.py

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@
88

99
import logging
1010
import os
11-
import shlex
1211
from os import path
1312

1413
import attr
14+
from commoncode.distro import parse_os_release
1515

1616
from container_inspector import rootfs
1717

18+
1819
TRACE = False
1920
logger = logging.getLogger(__name__)
2021

@@ -471,39 +472,6 @@ def merge(self, other_distro):
471472
return type(self)(**existing)
472473

473474

474-
def parse_os_release(location):
475-
"""
476-
Return a mapping built from an os-release-like file at `location`.
477-
478-
See https://www.linux.org/docs/man5/os-release.html
479-
480-
$ cat /etc/os-release
481-
NAME="Ubuntu"
482-
VERSION="16.04.6 LTS (Xenial Xerus)"
483-
ID=ubuntu
484-
ID_LIKE=debian
485-
PRETTY_NAME="Ubuntu 16.04.6 LTS"
486-
VERSION_ID="16.04"
487-
HOME_URL="http://www.ubuntu.com/"
488-
SUPPORT_URL="http://help.ubuntu.com/"
489-
BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/"
490-
VERSION_CODENAME=xenial
491-
UBUNTU_CODENAME=xenial
492-
493-
Note the /etc/lsb-release file has the same format, but different tags.
494-
"""
495-
with open(location) as osrl:
496-
lines = (line.strip() for line in osrl)
497-
lines = (
498-
line.partition('=') for line in lines
499-
if line and not line.startswith('#')
500-
)
501-
return {
502-
key.strip(): ''.join(shlex.split(value))
503-
for key, _, value in lines
504-
}
505-
506-
507475
def get_debian_details():
508476
"""
509477
See /etc/dpkg/origins/ for Debian distro.

tests/data/distro/os-release/alpine/alpine-3.8.txt-expected.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

tests/data/distro/os-release/amazon/amazon-2.txt-expected.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/data/distro/os-release/amazon/amazon-2018.03.txt-expected.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/data/distro/os-release/amazon/amzon-2016.09.txt-expected.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/data/distro/os-release/antergos/antergos.txt-expected.json

Lines changed: 0 additions & 12 deletions
This file was deleted.

tests/data/distro/os-release/arch/arch-arm-new.txt-expected.json

Lines changed: 0 additions & 13 deletions
This file was deleted.

0 commit comments

Comments
 (0)