-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stm_layout: Convert to an installable package; fix pylint/flake8 issues.
- Loading branch information
Showing
13 changed files
with
342 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
[flake8] | ||
ignore = E123, E126, E201, E203, E211, E221, E222, E225, E226, E227, E241, \ | ||
E741, W504 C901 | ||
exclude = .git,__pycache__,build,dist | ||
max-complexity = 20 | ||
max-line-length = 80 | ||
good-names = l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,131 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
pip-wheel-metadata/ | ||
share/python-wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.nox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
*.py,cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
db.sqlite3-journal | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# IPython | ||
profile_default/ | ||
ipython_config.py | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# pipenv | ||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. | ||
# However, in case of collaboration, if having platform-specific dependencies or dependencies | ||
# having no cross-platform support, pipenv may install dependencies that don't work, or not | ||
# install all needed dependencies. | ||
#Pipfile.lock | ||
|
||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow | ||
__pypackages__/ | ||
|
||
# Celery stuff | ||
celerybeat-schedule | ||
celerybeat.pid | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
.dmypy.json | ||
dmypy.json | ||
|
||
# Pyre type checker | ||
.pyre/ | ||
|
||
*.swp | ||
*.elf | ||
*.o | ||
*.d | ||
*.a | ||
*.map | ||
*.out | ||
*.pyc | ||
/build/ | ||
/bin/ | ||
/tests/ | ||
tags | ||
/.xml | ||
/modm_devices | ||
/modm-devices | ||
/tgcurses* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
[MESSAGES CONTROL] | ||
disable=bad-whitespace, | ||
missing-module-docstring, | ||
invalid-name, | ||
missing-function-docstring, | ||
too-many-arguments, | ||
missing-class-docstring, | ||
too-few-public-methods, | ||
too-many-instance-attributes, | ||
too-many-locals, | ||
too-many-statements, | ||
too-many-branches, | ||
protected-access, | ||
fixme, | ||
global-statement, | ||
broad-except, | ||
useless-super-delegation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Terry Greeniaus | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,45 @@ | ||
.PHONY: all | ||
all: tgcurses modm_devices | ||
MODULE := stm_layout | ||
MODULE_VERS := 0.1.0 | ||
MODULE_DEPS := \ | ||
setup.cfg \ | ||
setup.py \ | ||
stm_layout/*.py | ||
|
||
FLAKE_MODULES := stm_layout | ||
LINT_MODULES := stm_layout | ||
|
||
tgcurses: | ||
@git clone https://github.com/tgree/tgcurses tgcurses.git | ||
@ln -s tgcurses.git/tgcurses | ||
.PHONY: all | ||
all: $(MODULE) | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf dist *.egg-info build | ||
find . -name "*.pyc" | xargs rm | ||
find . -name __pycache__ | xargs rm -r | ||
|
||
modm-devices: | ||
@git clone -b feature/pinout https://github.com/salkinium/modm-devices | ||
.PHONY: test | ||
test: flake8 lint | ||
|
||
.PHONY: flake8 | ||
flake8: | ||
python3 -m flake8 $(FLAKE_MODULES) | ||
|
||
.xml: modm-devices | ||
@cd modm-devices/tools/generator && make init | ||
@cd modm-devices/tools/generator && make extract-stm32 | ||
@cd modm-devices/tools/generator && make generate-stm32 | ||
@touch .xml | ||
.PHONY: lint | ||
lint: | ||
pylint $(LINT_MODULES) | ||
|
||
.PHONY: $(MODULE) | ||
$(MODULE): dist/$(MODULE)-$(MODULE_VERS)-py3-none-any.whl | ||
|
||
modm_devices: modm-devices | ||
@ln -s modm-devices/modm_devices | ||
.PHONY: install | ||
install: $(MODULE) | ||
sudo pip3 uninstall -y $(MODULE) | ||
sudo pip3 install dist/$(MODULE)-$(MODULE_VERS)-py3-none-any.whl | ||
|
||
.PHONY: uninstall | ||
uninstall: | ||
sudo pip3 uninstall $(MODULE) | ||
|
||
clean: | ||
@rm -rf tgcurses modm-devices .xml 2>/dev/null or true | ||
dist/$(MODULE)-$(MODULE_VERS)-py3-none-any.whl: $(MODULE_DEPS) Makefile | ||
python3 setup.py --quiet sdist bdist_wheel | ||
python3 -m twine check $@ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
[metadata] | ||
name = stm_layout | ||
version = 0.1.0 | ||
author = Terry Greeniaus | ||
author_email = [email protected] | ||
description = Curses-based tool for configuring STM32 pins. | ||
long_description = file: README.rst | ||
long_description_content_type = text/x-rst | ||
keywords = stm32 modm-devices pin pinout | ||
url = https://github.com/tgree/stm_layout | ||
license = License :: OSI Approved :: MIT License | ||
classifiers = | ||
Operating System :: POSIX | ||
Programming Language :: Python :: 3 | ||
License :: OSI Approved :: MIT License | ||
|
||
[options] | ||
python_requires = >=3.6 | ||
packages = stm_layout | ||
install_requires = | ||
modm-devices | ||
tgcurses | ||
|
||
[options.entry_points] | ||
console_scripts = | ||
stm_layout = stm_layout.stm_layout:_main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import setuptools | ||
|
||
setuptools.setup() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
from . import chip_db | ||
from . import chip_stm | ||
|
||
|
||
__all__ = ['chip_db', | ||
'chip_stm', | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.