|
1 | | -#!/usr/bin/env python3 |
2 | | - |
3 | | -# vim: set et sw=4 sts=4 fileencoding=utf-8: |
4 | | -# |
5 | 1 | # Raspberry Pi Sense HAT Emulator library for the Raspberry Pi |
6 | | -# Copyright (c) 2016 Raspberry Pi Foundation <[email protected]> |
7 | | -# |
8 | | -# All Rights Reserved. |
9 | | - |
10 | | -"""An emulator for the Raspberry Pi Sense HAT.""" |
11 | | - |
12 | | -import os |
13 | | -import sys |
14 | | -from setuptools import setup, find_packages |
15 | | - |
16 | | -if sys.version_info[0] == 2: |
17 | | - if not sys.version_info >= (2, 7): |
18 | | - raise ValueError('This package requires Python 2.7 or newer') |
19 | | -elif sys.version_info[0] == 3: |
20 | | - if not sys.version_info >= (3, 2): |
21 | | - raise ValueError('This package requires Python 3.2 or newer') |
22 | | -else: |
23 | | - raise ValueError('Unrecognized major version of Python') |
24 | | - |
25 | | -HERE = os.path.abspath(os.path.dirname(__file__)) |
26 | | - |
27 | | -# Workaround <http://www.eby-sarna.com/pipermail/peak/2010-May/003357.html> |
28 | | -try: |
29 | | - import multiprocessing |
30 | | -except ImportError: |
31 | | - pass |
32 | | - |
33 | | -# Mock out dependency modules while installing |
34 | | -class Mock(object): |
35 | | - __all__ = [] |
36 | | - |
37 | | - def __init__(self, *args, **kw): |
38 | | - pass |
39 | | - |
40 | | - def __call__(self, *args, **kw): |
41 | | - return Mock() |
42 | | - |
43 | | - def __mul__(self, other): |
44 | | - return Mock() |
45 | | - |
46 | | - def __and__(self, other): |
47 | | - return Mock() |
48 | | - |
49 | | - def __bool__(self): |
50 | | - return False |
51 | | - |
52 | | - def __nonzero__(self): |
53 | | - return False |
54 | | - |
55 | | - @classmethod |
56 | | - def __getattr__(cls, name): |
57 | | - if name in ('__file__', '__path__'): |
58 | | - return '/dev/null' |
59 | | - else: |
60 | | - return Mock() |
61 | | - |
62 | | -def main(): |
63 | | - sys.modules['numpy'] = Mock() |
64 | | - sys.modules['RTIMU'] = Mock() |
65 | | - sys.modules['PIL'] = Mock() |
66 | | - import io |
67 | | - import sense_emu as app |
68 | | - with io.open(os.path.join(HERE, 'README.rst'), 'r') as readme: |
69 | | - setup( |
70 | | - name = app.__project__, |
71 | | - version = app.__version__, |
72 | | - description = app.__doc__, |
73 | | - long_description = readme.read(), |
74 | | - classifiers = app.__classifiers__, |
75 | | - author = app.__author__, |
76 | | - author_email = app.__author_email__, |
77 | | - url = app.__url__, |
78 | | - license = [ |
79 | | - c.rsplit('::', 1)[1].strip() |
80 | | - for c in app.__classifiers__ |
81 | | - if c.startswith('License ::') |
82 | | - ][0], |
83 | | - keywords = app.__keywords__, |
84 | | - packages = find_packages(), |
85 | | - include_package_data = True, |
86 | | - platforms = app.__platforms__, |
87 | | - install_requires = app.__requires__, |
88 | | - extras_require = app.__extra_requires__, |
89 | | - entry_points = app.__entry_points__, |
90 | | - ) |
91 | | - |
| 2 | +# Copyright (c) 2016-2021 Raspberry Pi Foundation <[email protected]> |
92 | 3 |
|
93 | | -if __name__ == '__main__': |
94 | | - main() |
| 4 | +from setuptools import setup |
95 | 5 |
|
| 6 | +setup() |
0 commit comments