From 2dc799a7a407066db3e5f49b099d41b0c5f5121b Mon Sep 17 00:00:00 2001 From: Phil Howard Date: Tue, 14 Aug 2018 09:30:42 +0000 Subject: [PATCH] Added BG tooling --- Makefile | 44 ++++++++++++++++++++++++++++++++++++++++++++ install.sh | 22 ++++++++++++++++++++++ uninstall.sh | 24 ++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 Makefile create mode 100755 install.sh create mode 100755 uninstall.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..ee7b766 --- /dev/null +++ b/Makefile @@ -0,0 +1,44 @@ +.PHONY: usage install uninstall +usage: + @echo "Usage: make , where target is one of:\n" + @echo "install: install the library locally from source" + @echo "uninstall: uninstall the local library" + @echo "python-readme: generate library/README.rst from README.md" + @echo "python-wheels: build python .whl files for distribution" + @echo "python-sdist: build python source distribution" + @echo "python-clean: clean python build and dist directories" + @echo "python-dist: build all python distribution files" + +install: + ./install.sh + +uninstall: + ./uninstall.sh + +python-readme: library/README.rst + +python-license: library/LICENSE.txt + +library/README.rst: README.md + pandoc --from=markdown --to=rst -o library/README.rst README.md + +library/LICENSE.txt: LICENSE + cp LICENSE library/LICENSE.txt + +python-wheels: python-readme python-license + cd library; python3 setup.py bdist_wheel + cd library; python setup.py bdist_wheel + +python-sdist: python-readme python-license + cd library; python setup.py sdist + +python-clean: + -rm -r library/dist + -rm -r library/build + -rm -r library/*.egg-info + +python-dist: python-clean python-wheels python-sdist + ls library/dist + +python-deploy: python-dist + twine upload library/dist/* diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..4321601 --- /dev/null +++ b/install.sh @@ -0,0 +1,22 @@ +#!/bin/bash + +printf "BME680 Python Library: Installer\n\n" + +if [ $(id -u) -ne 0 ]; then + printf "Script must be run as root. Try 'sudo ./install.sh'\n" + exit 1 +fi + +cd library + +printf "Installing for Python 2..\n" +python setup.py install + +if [ -f "/usr/bin/python3" ]; then + printf "Installing for Python 3..\n" + python3 setup.py install +fi + +cd .. + +printf "Done!\n" diff --git a/uninstall.sh b/uninstall.sh new file mode 100755 index 0000000..0231997 --- /dev/null +++ b/uninstall.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +PACKAGE="bme680" + +printf "BME680 Python Library: Uninstaller\n\n" + +if [ $(id -u) -ne 0 ]; then + printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n" + exit 1 +fi + +cd library + +printf "Unnstalling for Python 2..\n" +pip uninstall $PACKAGE + +if [ -f "/usr/bin/pip3" ]; then + printf "Uninstalling for Python 3..\n" + pip3 uninstall $PACKAGE +fi + +cd .. + +printf "Done!\n"