Skip to content

Commit

Permalink
Merge pull request #80 from Jayy001/Eeems-patch-1
Browse files Browse the repository at this point in the history
Fix macOS and windows builds
  • Loading branch information
Eeems authored May 25, 2024
2 parents 5c5b511 + a405645 commit 7b2c89a
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 27 deletions.
24 changes: 16 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
mv .ccache "$nuitka_cache/ccache"
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'pip'
Expand All @@ -69,7 +69,7 @@ jobs:
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- name: Upload Compilation Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: runner.debug == '1'
with:
name: ${{ matrix.os }}-compilation-report
Expand All @@ -86,10 +86,18 @@ jobs:
env:
nuitka_cache: ${{ github.workspace }}/.nuitka
- name: Upload executable
uses: actions/upload-artifact@v3
if: matrix.os != 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: dist
path: dist/codexctl.bin
if-no-files-found: error
- name: Upload executable
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: dist/codexctl.exe
if-no-files-found: error
device:
name: Build for remarkable
Expand Down Expand Up @@ -126,17 +134,17 @@ jobs:
source /opt/lib/nuitka/bin/activate
./github-make-executable.sh
- name: Upload Compilation Report
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: runner.debug == '1'
with:
name: ${{ matrix.os }}-compilation-report
path: compilation-report.xml
if-no-files-found: warn
- name: Upload executable
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: remarkable
path: dist
path: dist/codexctl.bin
if-no-files-found: error
test_device:
name: Test for reMarkable ${{ matrix.fw_version }}
Expand All @@ -146,7 +154,7 @@ jobs:
matrix:
fw_version: ['2.15.1', '3.3.2', '3.9.3']
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
path: artifacts
name: remarkable
Expand Down
32 changes: 16 additions & 16 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,24 @@ test: $(VENV_BIN_ACTIVATE) .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed
fi
mkdir -p .venv/mnt
. $(VENV_BIN_ACTIVATE); \
python -m codexctl mount --out .venv/mnt ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"
mountpoint .venv/mnt
umount -ql .venv/mnt
. $(VENV_BIN_ACTIVATE); \
python -m codexctl extract --out ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"
echo "${IMG_SHA} .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" | sha256sum --check
rm -f ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img"
if [[ "linux" == "$$(python -c 'import sys;print(sys.platform)')" ]]; then \
python -m codexctl mount --out .venv/mnt ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"; \
mountpoint .venv/mnt; \
umount -ql .venv/mnt; \
python -m codexctl extract --out ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"; \
echo "${IMG_SHA} .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" | sha256sum --check; \
rm -f ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img"; \
fi

test-executable: .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed
dist/codexctl.* extract --out ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"
echo "${IMG_SHA} .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" | sha256sum --check
rm -f ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img"
. $(VENV_BIN_ACTIVATE); \
if [[ "linux" == "$$(python -c 'import sys;print(sys.platform)')" ]]; then \
dist/codexctl.* extract --out ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.signed"; \
echo "${IMG_SHA} .venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img" | sha256sum --check; \
rm -f ".venv/${FW_VERSION}_reMarkable2-${FW_DATA}.img"; \
else \
dist/codexctl.* list; \
fi

clean:
@echo "[info] Cleaning"
Expand All @@ -63,12 +69,6 @@ executable: $(VENV_BIN_ACTIVATE)
. $(VENV_BIN_ACTIVATE); \
NUITKA_CACHE_DIR="$(realpath .)/.nuitka" \
python -m nuitka \
--enable-plugin=pylint-warnings \
--enable-plugin=upx \
--include-package=google \
--warn-implicit-exceptions \
--onefile \
--lto=yes \
--assume-yes-for-downloads \
--remove-output \
--output-dir=dist \
Expand Down
9 changes: 9 additions & 0 deletions codexctl.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
# nuitka-project: --enable-plugin=pylint-warnings

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1703: Will always raise exception: "TypeError(type() takes no keyword arguments)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1708: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1712: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1714: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1796: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1797: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for remarkable

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/lib/pyenv/versions/3.11.7/lib/python3.11/enum.py:1798: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1718: Will always raise exception: "TypeError(type() takes no keyword arguments)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1723: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1727: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1729: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1811: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1812: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for ubuntu-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /opt/hostedtoolcache/Python/3.11.9/x64/lib/python3.11/enum.py:1813: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1718: Will always raise exception: "TypeError(type() takes no keyword arguments)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1723: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1727: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1729: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1811: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1812: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\enum.py:1813: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Unusual:WARNING: C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\platform.py:844: Will always raise exception: "AttributeError(cannot import name 'uname' from <ModuleName 'os'>)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for windows-latest

Nuitka Warning

Nuitka-Plugins:WARNING: upx: No UPX binary found, please use '--upx-binary' option to specify it.

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1718: Will always raise exception: "TypeError(type() takes no keyword arguments)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1723: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1727: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1729: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1811: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1812: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Unusual:WARNING: /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/enum.py:1813: Will always raise exception: "UnboundLocalError(cannot access local variable 'enum_class' where it is not associated with a value)"

Check warning on line 1 in codexctl.py

View workflow job for this annotation

GitHub Actions / Build for macos-latest

Nuitka Warning

Nuitka-Plugins:WARNING: upx: No UPX binary found, please use '--upx-binary' option to specify it.
# nuitka-project: --enable-plugin=upx
# nuitka-project: --warn-implicit-exceptions
# nuitka-project: --onefile
# nuitka-project: --lto=yes
# nuitka-project-if: {OS} in ("Linux"):
# nuitka-project: --include-package=google
# nuitka-project: --noinclude-unittest-mode=allow

from codexctl import main

if __name__ == "__main__":
Expand Down
10 changes: 7 additions & 3 deletions github-make-executable.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
#!/bin/bash
set +e

make executable test-executable 2>&1 \
make executable 2>&1 \
| while read -r line; do
IFS=$'\n' read -r -a lines <<< "$line"
if [[ "$line" == 'Nuitka'*':ERROR:'* ]]; then
if [[ "$line" == 'Nuitka'*':ERROR:'* ]] || [[ "$line" == 'FATAL:'* ]] || [[ "$line" == 'make: *** ['*'] Error'* ]] ; then
printf '::error file=codexctl.py,title=Nuitka Error::%s\n' "${lines[@]}"
elif [[ "$line" == 'Nuitka'*':WARNING:'* ]]; then
printf '::warning file=codexctl.py,title=Nuitka Warning::%s\n' "${lines[@]}"
elif [[ "$line" == 'Nuitka:INFO:'* ]] || [[ "$line" == '[info]'* ]]; then
echo "$line"
else
printf '::debug::%s\n' "${lines[@]}"
echo "::debug::$line"
fi
done
if ! make test-executable; then
printf '::error file=codexctl.bin,title=Test Error::Sanity test failed\n'
exit 1
fi

0 comments on commit 7b2c89a

Please sign in to comment.