|
7 | 7 | pass
|
8 | 8 |
|
9 | 9 | from setuptools import setup, find_packages, Extension
|
| 10 | +import os |
10 | 11 | import sys
|
11 | 12 |
|
12 | 13 | import Adafruit_DHT.platform_detect as platform_detect
|
13 | 14 |
|
14 | 15 |
|
| 16 | +BINARY_COMMANDS = [ |
| 17 | + 'build_ext', |
| 18 | + 'build_clib', |
| 19 | + 'bdist', |
| 20 | + 'bdist_dumb', |
| 21 | + 'bdist_rpm', |
| 22 | + 'bdist_wininst', |
| 23 | + 'bdist_wheel', |
| 24 | + 'install' |
| 25 | +] |
| 26 | + |
| 27 | + |
| 28 | +def is_binary_install(): |
| 29 | + do_binary = [command for command in BINARY_COMMANDS if command in sys.argv] |
| 30 | + return len(do_binary) > 0 |
| 31 | + |
| 32 | + |
| 33 | +def read(fname): |
| 34 | + return open(os.path.join(os.path.dirname(__file__), fname)).read() |
| 35 | + |
15 | 36 | # Check if an explicit platform was chosen with a command line parameter.
|
16 | 37 | # Kind of hacky to manipulate the argument list before calling setup, but it's
|
17 | 38 | # the best simple option for adding optional config to the setup.
|
|
37 | 58 |
|
38 | 59 | # Pick the right extension to compile based on the platform.
|
39 | 60 | extensions = []
|
40 |
| -if platform == platform_detect.RASPBERRY_PI: |
| 61 | +if not is_binary_install(): |
| 62 | + print('Skipped loading platform-specific extensions for Adafruit_DHT (we are generating a cross-platform source distribution).') |
| 63 | +elif platform == platform_detect.RASPBERRY_PI: |
41 | 64 | # Get the Pi version (1 or 2)
|
42 | 65 | if pi_version is None:
|
43 | 66 | pi_version = platform_detect.pi_version()
|
|
87 | 110 | author = 'Tony DiCola',
|
88 | 111 | author_email = 'tdicola@adafruit.com',
|
89 | 112 | description = 'Library to get readings from the DHT11, DHT22, and AM2302 humidity and temperature sensors on a Raspberry Pi or Beaglebone Black.',
|
| 113 | + long_description = read('README.md'), |
90 | 114 | license = 'MIT',
|
91 | 115 | classifiers = classifiers,
|
92 | 116 | url = 'https://github.com/adafruit/Adafruit_Python_DHT/',
|
|
0 commit comments