2 # -*- coding: utf-8 -*-
4 # Note: To use the 'upload' functionality of this file, you must:
10 from shutil import rmtree
12 from setuptools import find_packages, setup, Command
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'
23 # What packages are required for this module to be executed?
24 with open('requirements.txt') as f:
25 requirements = f.read().splitlines()
27 here = os.path.abspath(os.path.dirname(__file__))
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()
34 # Load the package's __version__.py module as a dictionary.
37 # with open(os.path.join(here, NAME, '__version__.py')) as f:
38 with open(os.path.join(here, 'src', '__version__.py')) as f:
41 about['__version__'] = VERSION
44 class UploadCommand(Command):
45 """Support setup.py upload."""
47 description = 'Build and publish the package.'
52 """Prints things in bold."""
53 print('\033[1m{0}\033[0m'.format(s))
55 def initialize_options(self):
58 def finalize_options(self):
63 self.status('Removing previous builds…')
64 rmtree(os.path.join(here, 'dist'))
68 self.status('Building Source and Wheel (universal) distribution…')
69 os.system('{0} setup.py sdist bdist_wheel --universal'.format(sys.executable))
71 self.status('Uploading the package to PyPi via Twine…')
72 os.system('twine upload dist/*')
74 self.status('Pushing git tags…')
75 os.system('git tag v{0}'.format(about['__version__']))
76 os.system('git push --tags')
81 # Where the magic happens:
84 version=about['__version__'],
85 description=DESCRIPTION,
86 long_description=long_description,
87 long_description_content_type='text/x-rst',
90 python_requires=REQUIRES_PYTHON,
92 package_dir={'': 'src'},
93 #packages=find_packages(exclude=('tests',)),
96 'adafruit_blinka.agnostic',
97 'adafruit_blinka.board',
98 'adafruit_blinka.microcontroller',
99 'adafruit_blinka.microcontroller.esp8266',
100 'adafruit_blinka.microcontroller.stm32',
103 # If your package is a single module, use this instead of 'packages':
104 py_modules=['bitbangio', 'board', 'busio', 'digitalio'],
106 # 'console_scripts': ['mycli=mymodule:cli'],
108 install_requires=requirements,
109 include_package_data=True,
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',
120 # $ setup.py publish support.
122 'upload': UploadCommand,