Refactoring & install with pyproject.toml #1
@@ -1,5 +1,6 @@
 | 
			
		||||
import configparser
 | 
			
		||||
import os
 | 
			
		||||
import sys
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
class Conf(object):
 | 
			
		||||
@@ -14,7 +15,10 @@ class Conf(object):
 | 
			
		||||
        if filename:
 | 
			
		||||
            filenames.append(filename)
 | 
			
		||||
        if not force_filename:
 | 
			
		||||
            if os.path.isfile(f'{os.environ.get("HOME")}/etc/userconfig2.conf'):
 | 
			
		||||
                filenames.append(f'{os.environ.get("HOME")}/etc/userconfig2.conf')
 | 
			
		||||
            if os.path.isfile(f'{sys.prefix}/etc/userconfig2.conf'):
 | 
			
		||||
                filenames.append(f'{sys.prefix}/etc/userconfig2.conf')
 | 
			
		||||
        ret = self.set_filenames(filenames)
 | 
			
		||||
        if not ret:
 | 
			
		||||
            raise ValueError(f'Cannot open either configuration file: {",".join(filenames)}')
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user