Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ build:
tools:
python: "3"

sphinx:
configuration: docs/conf.py

python:
install:
- requirements: docs/requirements.txt
Expand Down
8 changes: 7 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,15 @@ Introduction

Reduced version of the decimal library for CircuitPython

Important Note
==============
From version 1.0.9 through 1.0.12, this package was incorrectly published on pypi under the name
`circuitpython-jepler-udecimal <https://pypi.org/project/circuitpython-jepler-udecimal/>`_.
The correct package name is
`jepler-circuitpython-udecimal <https://pypi.org/project/jepler-circuitpython-udecimal/>`_.

Dependencies
=============
============
This library depends on:

* `Adafruit CircuitPython <https://github.com/adafruit/circuitpython>`_
Expand Down
64 changes: 45 additions & 19 deletions build.sh
Original file line number Diff line number Diff line change
@@ -1,54 +1,80 @@
#!/bin/bash
set -eo pipefail

in_section=false
if [ "${CI}" -eq "true" ]; then
start_section () {
if $in_section; then end_section; fi
echo "::group::$*"
export in_section=true
}
end_section () {
echo "::endgroup::$*"
in_section=false
}
else
start_section () {
if $in_section; then end_section; fi
echo "=== $*"
export in_section=true
}
end_section () {
echo
in_section=false
}
fi

repo_name=`git config remote.origin.url | sed -e 's,^.*/,,;s/\.git$//' | tr A-Z_ a-z-`
echo "=== Building package: $repo_name"
echo "*** Building package: $repo_name"

echo "=== Create and set up virtual environment"
start_section "Create and set up virtual environment"
[ -d .venv ] || python3 -m venv .env
. .env/bin/activate
echo "=== Install requirements"
start_section "Install requirements"
pip3 install wheel
pip3 install -r requirements_dev.txt
echo "=== Run pre-commit"
pip3 install -r optional_requirements.txt
start_section "Run pre-commit"
pre-commit run --all-files

echo "=== Clone and build circuitpython unix port"
start_section "Clone and build circuitpython unix port"
[ -e circuitpython/py/py.mk ] || git clone --shallow-since=2021-07-01 https://github.com/adafruit/circuitpython
[ -e circuitpython/lib/libffi/autogen.sh ] || (cd circuitpython && git submodule update --init lib/libffi lib/axtls lib/berkeley-db-1.xx tools/huffman lib/uzlib extmod/ulab)
[ -x circuitpython/ports/unix/micropython ] || (
make -C circuitpython/mpy-cross -j$(nproc)
make -C circuitpython/ports/unix -j$(nproc) deplibs
make -C circuitpython/ports/unix -j$(nproc) deplibs submodules
make -C circuitpython/ports/unix -j$(nproc) DEBUG=1 STRIP=:
)

echo "=== Run tests"
start_section "Run tests"
python -m jepler_udecimal.test

run-tests () {
env MICROPYPATH=. PYTHONPATH=. MICROPY_MICROPYTHON=circuitpython/ports/unix/micropython circuitpython/tests/run-tests.py "$@"
run_tests () {
env MICROPYPATH="`readlink -f .`" PYTHONPATH="`readlink -f .`" MICROPY_MICROPYTHON=circuitpython/ports/unix/build-standard/micropython circuitpython/tests/run-tests.py --keep-path "$@"
}

run-tests --clean-failures
if ! run-tests -d examples; then
run-tests --print-failures
run_tests --clean-failures
if ! run_tests -d examples; then
run_tests --print-failures
exit 1
fi

PYTHONPATH=. python examples/test_udecimal.py > test_udecimal.exp
echo "=== Build CircuitPython bundle"
start_section "Build CircuitPython bundle"
circuitpython-build-bundles --package_folder_prefix jepler --filename_prefix $repo_name --library_location .

echo "=== Build docs"
start_section "Build docs"
rm -rf docs/_build
(cd docs && sphinx-build -E -W -b html . _build/html)

echo "=== Build pypi files"
python setup.py sdist
python setup.py bdist_wheel --universal
start_section "Build pypi files"
python -m build

echo "=== Check pypi files"
start_section "Check pypi files"
twine check dist/*
end_section

echo "=== Success"

# SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks
#
# SPDX-License-Identifier: MIT
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"sphinx.ext.intersphinx",
"sphinx.ext.napoleon",
"sphinx.ext.todo",
"sphinx_rtd_theme",
]

autoapi_keep_files = True
Expand Down Expand Up @@ -107,7 +108,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
on_rtd = os.environ.get("READTHEDOCS", None) == "True"
html_theme = "sphinx_rtd_theme"

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@

sphinx>=4.0.0
sphinx-autoapi
sphinx-rtd-theme
1 change: 1 addition & 0 deletions optional_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# SPDX-FileCopyrightText: Copyright (c) 2020 jepler for Unpythonic Networks
#
# SPDX-License-Identifier: MIT
build
pre-commit
recommonmark==0.6.0
sphinx
Expand Down