mirror of
				https://github.com/ets-labs/python-dependency-injector.git
				synced 2025-11-04 09:57:37 +03:00 
			
		
		
		
	Return env interpolation on Python 2 to support pypy 2
This commit is contained in:
		
							parent
							
								
									ecc2b585a0
								
							
						
					
					
						commit
						881764dc56
					
				| 
						 | 
				
			
			@ -52,6 +52,7 @@ if yaml:
 | 
			
		|||
    yaml.add_constructor('!path', yaml_env_marker_constructor)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if sys.version_info[0] == 3:
 | 
			
		||||
    class EnvInterpolation(iniconfigparser.BasicInterpolation):
 | 
			
		||||
        """Interpolation which expands environment variables in values."""
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -63,6 +64,19 @@ def _parse_ini_file(filepath):
 | 
			
		|||
        parser = iniconfigparser.ConfigParser(interpolation=EnvInterpolation())
 | 
			
		||||
        parser.read(filepath)
 | 
			
		||||
        return parser
 | 
			
		||||
else:
 | 
			
		||||
    import StringIO
 | 
			
		||||
 | 
			
		||||
    def _parse_ini_file(filepath):
 | 
			
		||||
        parser = iniconfigparser.ConfigParser()
 | 
			
		||||
        try:
 | 
			
		||||
            with open(filepath) as config_file:
 | 
			
		||||
                config_string = os.path.expandvars(config_file.read())
 | 
			
		||||
        except IOError:
 | 
			
		||||
            return parser
 | 
			
		||||
        else:
 | 
			
		||||
            parser.readfp(StringIO.StringIO(config_string))
 | 
			
		||||
            return parser
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
cdef class Provider:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue
	
	Block a user