Skip to content

Commit

Permalink
Merge pull request #9 from zuku/add-package-command
Browse files Browse the repository at this point in the history
Add package command
  • Loading branch information
zuku authored Apr 23, 2023
2 parents 938dca4 + 0dcc4cc commit 00ccc70
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ python_version = "3.11"
[scripts]
test = 'bash -c "export PYTHONPATH=\"./src:./tests:$PYTHONPATH\"; python -m unittest discover -v -s tests"'
build = './scripts/build.sh'
package = './scripts/package.sh'
20 changes: 20 additions & 0 deletions readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
font16seg

font16seg is a sixteen-segment font implementation for M5Stack devices using MicroPython.


How to use

Copy font16seg.mpy file to the directory listed in sys.path.
(Usually, same directory as your MicroPython file.)

Write following code then execute.

```
import font16seg

font16seg.text(0, 0, "FONT16SEG")
```

For more information, please visit the project page.
https://github.com/zuku/font16seg
54 changes: 54 additions & 0 deletions scripts/package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#!/bin/bash

which zip > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo "zip command does not exist." >&2
exit 2
fi

if [ ! -f "./dist/font16seg.py" ]; then
echo "./dist/font16seg.py does not exist." >&2
echo "run build first" >&2
exit 3
fi
if [ ! -f "./dist/font16seg.mpy" ]; then
echo "./dist/font16seg.mpy does not exist." >&2
echo "run build first" >&2
exit 4
fi

rm -f "./dist/package.zip"
rm -rf "./dist/tmp"
mkdir "./dist/tmp"

echo "./dist/font16seg.mpy -> ./dist/tmp/font16seg.mpy"
cp "./dist/font16seg.mpy" "./dist/tmp/"
echo "./dist/font16seg.py -> ./dist/tmp/font16seg.py"
cp "./dist/font16seg.py" "./dist/tmp/"
echo "./LICENSE -> ./dist/tmp/LICENSE"
cp "./LICENSE" "./dist/tmp/"
echo "./readme.txt -> ./dist/tmp/readme.txt"
cp "./readme.txt" "./dist/tmp/"
echo
echo "Create archive file"
cd "./dist/tmp"
zip "../package.zip" -r *
cd "../../"
rm -rf "./dist/tmp"

echo
if [ -f "./dist/package.zip" ]; then
FILE_SIZE=`stat -c "%s" ./dist/package.zip`
if [ $? -ne 0 ]; then
echo "stat failed" >&2
exit 5
fi
echo "Name: ./dist/package.zip"
echo "Size: ${FILE_SIZE}"
echo
else
echo "Failed" >&2
exit 6
fi

exit 0

0 comments on commit 00ccc70

Please sign in to comment.