|
1 | 1 | #!/usr/bin/env python |
2 | 2 | # -*- coding: utf-8 -*- |
3 | 3 |
|
4 | | -import re |
5 | | -import os |
6 | | -import sys |
7 | | -from io import open |
8 | | -from setuptools import setup, find_packages |
| 4 | +import setuptools |
9 | 5 |
|
10 | | - |
11 | | -def read_file(fpath): |
12 | | - with open(fpath, encoding='utf-8') as r: |
13 | | - return r.read() |
14 | | - |
15 | | - |
16 | | -def find_version(*file_paths): |
17 | | - fpath = os.path.join(os.path.dirname(__file__), *file_paths) |
18 | | - version_file = read_file(fpath) |
19 | | - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", |
20 | | - version_file, re.M) |
21 | | - if version_match: |
22 | | - return version_match.group(1) |
23 | | - |
24 | | - err_msg = 'Unable to find version string in {}'.format(fpath) |
25 | | - raise RuntimeError(err_msg) |
26 | | - |
27 | | - |
28 | | -README = read_file('README.rst') |
29 | | -CONTRIB = read_file('CONTRIBUTING.rst') |
30 | | -CHANGES = read_file('CHANGES.rst') |
31 | | -version = find_version('luma', 'oled', '__init__.py') |
32 | | -project_url = 'https://github.com/rm-hull/luma.oled' |
33 | | - |
34 | | -needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv) |
35 | | -pytest_runner = ['pytest-runner'] if needs_pytest else [] |
36 | | -test_deps = [ |
37 | | - 'pytest', |
38 | | - 'pytest-cov', |
39 | | - 'pytest-timeout' |
40 | | -] |
41 | | - |
42 | | -setup( |
43 | | - name="luma.oled", |
44 | | - version=version, |
45 | | - author="Richard Hull", |
46 | | - author_email="richard.hull@destructuring-bind.org", |
47 | | - description=("A small library to drive an OLED device with either " |
48 | | - "SSD1306, SSD1309, SSD1322, SSD1325, SSD1327, SSD1331, " |
49 | | - "SSD1351, SSD1362, SH1106 or WS0010 chipset"), |
50 | | - long_description="\n\n".join([README, CONTRIB, CHANGES]), |
51 | | - long_description_content_type="text/x-rst", |
52 | | - python_requires='>=3.6, <4', |
53 | | - license="MIT", |
54 | | - keywords=("raspberry pi rpi oled display screen " |
55 | | - "rgb monochrome greyscale color " |
56 | | - "ssd1306 ssd1309 ssd1322 ssd1325 ssd1327 ssd1331 ssd1351 sh1106 " |
57 | | - "ws0010 WEH001602A WEG010016A " |
58 | | - "spi i2c parallel 6800 pcf8574 "), |
59 | | - |
60 | | - url=project_url, |
61 | | - download_url=project_url + "/tarball/" + version, |
62 | | - project_urls={ |
63 | | - 'Documentation': 'https://luma-oled.readthedocs.io', |
64 | | - 'Source': project_url, |
65 | | - 'Issue Tracker': project_url + '/issues', |
66 | | - }, |
67 | | - packages=find_packages(), |
68 | | - namespace_packages=["luma"], |
69 | | - zip_safe=False, |
70 | | - install_requires=["luma.core>=2.0.0"], |
71 | | - setup_requires=pytest_runner, |
72 | | - tests_require=test_deps, |
73 | | - extras_require={ |
74 | | - 'docs': [ |
75 | | - 'sphinx >= 1.5.1' |
76 | | - ], |
77 | | - 'qa': [ |
78 | | - 'rstcheck', |
79 | | - 'flake8' |
80 | | - ], |
81 | | - 'test': test_deps |
82 | | - }, |
83 | | - classifiers=[ |
84 | | - "License :: OSI Approved :: MIT License", |
85 | | - "Development Status :: 5 - Production/Stable", |
86 | | - "Intended Audience :: Education", |
87 | | - "Intended Audience :: Developers", |
88 | | - "Topic :: Education", |
89 | | - "Topic :: System :: Hardware", |
90 | | - "Programming Language :: Python :: 3", |
91 | | - "Programming Language :: Python :: 3.6", |
92 | | - "Programming Language :: Python :: 3.7", |
93 | | - "Programming Language :: Python :: 3.8", |
94 | | - "Programming Language :: Python :: 3.9" |
95 | | - ] |
96 | | -) |
| 6 | +if __name__ == "__main__": |
| 7 | + setuptools.setup() |
0 commit comments