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:
		
				
					committed by
					
						
						Daniel Wagner
					
				
			
			
				
	
			
			
			
						parent
						
							b10b59e330
						
					
				
				
					commit
					3fccd1ad3e
				
			@@ -24,28 +24,6 @@
 | 
				
			|||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					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
 | 
					from .repos import Repo
 | 
				
			||||||
 | 
					
 | 
				
			||||||
__license__ = 'MIT'
 | 
					__license__ = 'MIT'
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,28 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import logging
 | 
					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
 | 
					# pylint: disable=too-many-instance-attributes
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user