]> Repositories - Adafruit_Blinka-hackapet.git/blob - setup.py
Stop building bundles since its not needed on CircuitPython.
[Adafruit_Blinka-hackapet.git] / setup.py
1 #!/usr/bin/env python
2 # -*- coding: utf-8 -*-
3
4 # Note: To use the 'upload' functionality of this file, you must:
5 #   $ pip install twine
6
7 import io
8 import os
9 import sys
10 from shutil import rmtree
11
12 from setuptools import find_packages, setup, Command
13
14 # Package meta-data.
15 NAME = 'Adafruit-Blinka'
16 DESCRIPTION = 'CircuitPython APIs for non-CircuitPython versions of Python such as CPython on Linux and MicroPython.'
17 URL = 'https://github.com/adafruit/Adafruit_Blinka'
18 EMAIL = 'python@adafruit.com'
19 AUTHOR = 'Adafruit Industries'
20 REQUIRES_PYTHON = '>=3.6.0'
21 VERSION = None
22
23 # What packages are required for this module to be executed?
24 with open('requirements.txt') as f:
25     requirements = f.read().splitlines()
26
27 here = os.path.abspath(os.path.dirname(__file__))
28
29 # Import the README and use it as the long-description.
30 # Note: this will only work if 'README.md' is present in your MANIFEST.in file!
31 with io.open(os.path.join(here, 'README.rst'), encoding='utf-8') as f:
32     long_description = '\n' + f.read()
33
34 # Load the package's __version__.py module as a dictionary.
35 about = {}
36 if not VERSION:
37     # with open(os.path.join(here, NAME, '__version__.py')) as f:
38     with open(os.path.join(here, 'src', '__version__.py')) as f:
39         exec(f.read(), about)
40 else:
41     about['__version__'] = VERSION
42
43
44 class UploadCommand(Command):
45     """Support setup.py upload."""
46
47     description = 'Build and publish the package.'
48     user_options = []
49
50     @staticmethod
51     def status(s):
52         """Prints things in bold."""
53         print('\033[1m{0}\033[0m'.format(s))
54
55     def initialize_options(self):
56         pass
57
58     def finalize_options(self):
59         pass
60
61     def run(self):
62         try:
63             self.status('Removing previous builds…')
64             rmtree(os.path.join(here, 'dist'))
65         except OSError:
66             pass
67
68         self.status('Building Source and Wheel (universal) distribution…')
69         os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
70
71         self.status('Uploading the package to PyPi via Twine…')
72         os.system('twine upload dist/*')
73
74         self.status('Pushing git tags…')
75         os.system('git tag v{0}'.format(about['__version__']))
76         os.system('git push --tags')
77
78         sys.exit()
79
80
81 # Where the magic happens:
82 setup(
83     name=NAME,
84     version=about['__version__'],
85     description=DESCRIPTION,
86     long_description=long_description,
87     long_description_content_type='text/x-rst',
88     author=AUTHOR,
89     author_email=EMAIL,
90     python_requires=REQUIRES_PYTHON,
91     url=URL,
92     package_dir={'': 'src'},
93     #packages=find_packages(exclude=('tests',)),
94     packages=[
95         'adafruit_blinka',
96         'adafruit_blinka.agnostic',
97         'adafruit_blinka.board',
98         'adafruit_blinka.microcontroller',
99         'adafruit_blinka.microcontroller.esp8266',
100         'adafruit_blinka.microcontroller.stm32',
101         'microcontroller'
102     ],
103     # If your package is a single module, use this instead of 'packages':
104     py_modules=['bitbangio', 'board', 'busio', 'digitalio'],
105     # entry_points={
106     #     'console_scripts': ['mycli=mymodule:cli'],
107     # },
108     install_requires=requirements,
109     include_package_data=True,
110     license='MIT',
111     classifiers=[
112         # Trove classifiers
113         # Full list: https://pypi.python.org/pypi?%3Aaction=list_classifiers
114         'License :: OSI Approved :: MIT License',
115         'Programming Language :: Python',
116         'Programming Language :: Python :: 3',
117         'Programming Language :: Python :: 3.6',
118         'Programming Language :: Python :: Implementation :: MicroPython',
119     ],
120     # $ setup.py publish support.
121     cmdclass={
122         'upload': UploadCommand,
123     },
124 )