Move get_distro_id_base from config to context

This is where it is used, only.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
This commit is contained in:
Jan Kiszka 2018-08-24 19:17:57 +02:00 committed by Daniel Wagner
parent b10b59e330
commit 3fccd1ad3e
2 changed files with 22 additions and 23 deletions

View File

@ -24,28 +24,6 @@
"""
import os
try:
import distro
def get_distro_id_base():
"""
Returns a compatible distro id.
"""
return distro.like() or distro.id()
except ImportError:
import platform
def get_distro_id_base():
"""
Wrapper around platform.dist to simulate distro.id
platform.dist is deprecated and will be removed in python 3.7
Use the 'distro' package instead.
"""
# pylint: disable=deprecated-method
return platform.dist()[0]
from .repos import Repo
__license__ = 'MIT'

View File

@ -25,7 +25,28 @@
import os
import logging
from .config import Config, get_distro_id_base
from .config import Config
try:
import distro
def get_distro_id_base():
"""
Returns a compatible distro id.
"""
return distro.like() or distro.id()
except ImportError:
import platform
def get_distro_id_base():
"""
Wrapper around platform.dist to simulate distro.id
platform.dist is deprecated and will be removed in python 3.7
Use the 'distro' package instead.
"""
# pylint: disable=deprecated-method
return platform.dist()[0]
# pylint: disable=too-many-instance-attributes