|  | @@ -1,9 +1,21 @@
 | 
	
		
			
				|  |  |  import sys, os
 | 
	
		
			
				|  |  |  from setuptools import setup
 | 
	
		
			
				|  |  | +from pathlib import Path
 | 
	
		
			
				|  |  | +import re
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  |  dependencies = ['Pillow']
 | 
	
		
			
				|  |  |  
 | 
	
		
			
				|  |  | -if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'):
 | 
	
		
			
				|  |  | +def is_raspberry_pi():
 | 
	
		
			
				|  |  | +    # https://raspberrypi.stackexchange.com/a/139704/540
 | 
	
		
			
				|  |  | +    CPUINFO_PATH = Path("/proc/cpuinfo")
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +    if not CPUINFO_PATH.exists():
 | 
	
		
			
				|  |  | +        return False
 | 
	
		
			
				|  |  | +    with open(CPUINFO_PATH) as f:
 | 
	
		
			
				|  |  | +        cpuinfo = f.read()
 | 
	
		
			
				|  |  | +    return re.search(r"^Model\s*:\s*Raspberry Pi", cpuinfo, flags=re.M) is not None
 | 
	
		
			
				|  |  | +
 | 
	
		
			
				|  |  | +if is_raspberry_pi():
 | 
	
		
			
				|  |  |      dependencies += ['RPi.GPIO', 'spidev']
 | 
	
		
			
				|  |  |  elif os.path.exists('/sys/bus/platform/drivers/gpio-x3'):
 | 
	
		
			
				|  |  |      dependencies += ['Hobot.GPIO', 'spidev']
 |