浏览代码

Detect platform

missionfloyd 4 年之前
父节点
当前提交
8bb4c14351
共有 1 个文件被更改,包括 9 次插入6 次删除
  1. 9 6
      RaspberryPi_JetsonNano/python/setup.py

+ 9 - 6
RaspberryPi_JetsonNano/python/setup.py

@@ -1,16 +1,19 @@
 import sys
 import sys
 from setuptools import setup
 from setuptools import setup
+
+dependencies = ['Pillow', 'numpy']
+
+if os.path.exists('/sys/bus/platform/drivers/gpiomem-bcm2835'):
+    dependencies.extend(['RPi.GPIO', 'spidev'])
+else:
+    dependencies.extend(['Jetson.GPIO', 'smbus'])
+
 setup(
 setup(
     name='waveshare-epd',
     name='waveshare-epd',
     description='Waveshare e-Paper Display',
     description='Waveshare e-Paper Display',
     author='Waveshare',
     author='Waveshare',
     package_dir={'': 'lib'},
     package_dir={'': 'lib'},
     packages=['waveshare_epd'],
     packages=['waveshare_epd'],
-    install_requires=[
-        'RPi.GPIO',
-        'spidev',
-        'Pillow',
-        'numpy'
-    ],
+    install_requires=dependencies,
 )
 )