Skip to content

Commit

Permalink
Final
Browse files Browse the repository at this point in the history
  • Loading branch information
Jayy001 committed Dec 7, 2024
1 parent 8d148c8 commit e94541b
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.os }}
path: dist/codexctl.bin
path: dist/codexctl
if-no-files-found: error
- name: Upload executable
if: matrix.os == 'windows-latest'
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: remarkable
path: dist/codexctl.bin
path: dist/codexctl
if-no-files-found: error
test_device:
name: Test for reMarkable ${{ matrix.fw_version }}
Expand All @@ -176,8 +176,8 @@ jobs:
path: artifacts
fw_version: ${{ matrix.fw_version }}
run: |
chmod +x ./codexctl.bin
./codexctl.bin download --hardware rm2 --out /tmp toltec
chmod +x ./codexctl
./codexctl download --hardware rm2 --out /tmp toltec
release:
name: Release
needs: [remote,device,test_device]
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ else
ifeq ($(VENV_BIN_ACTIVATE),)
VENV_BIN_ACTIVATE := .venv/bin/activate
endif
CODEXCTL_BIN := codexctl.bin
CODEXCTL_BIN := codexctl
endif

OBJ := $(wildcard codexctl/**)
Expand Down
2 changes: 1 addition & 1 deletion builds/github-make-executable.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,6 @@ make executable 2>&1 \
done

if ! make test-executable; then
printf '::error file=codexctl.bin,title=Test Error::Sanity test failed\n'
printf '::error file=codexctl,title=Test Error::Sanity test failed\n'
exit 1
fi
34 changes: 22 additions & 12 deletions codexctl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,11 @@ def call_func(self, function: str, args: dict) -> None:

version = args.get("version", None)

if version == "latest":
version = self.updater.get_latest_version(remarkable_version)
elif version == "toltec":
version = self.updater.get_toltec_version(remarkable_version)
if remarkable_version:
if version == "latest":
version = self.updater.get_latest_version(remarkable_version)
elif version == "toltec":
version = self.updater.get_toltec_version(remarkable_version)

### Download functionalities
if function == "list":
Expand Down Expand Up @@ -189,6 +190,11 @@ def call_func(self, function: str, args: dict) -> None:
authentication=args["password"],
)

if version == "latest":
version = self.updater.get_latest_version(remarkable.hardware)
elif version == "toltec":
version = self.updater.get_toltec_version(remarkable.hardware)

if function == "status":
beta, prev, current, version_id = remarkable.get_device_status()
print(
Expand Down Expand Up @@ -247,15 +253,19 @@ def call_func(self, function: str, args: dict) -> None:

#############################################################

update_file_requires_new_engine = False
device_version_uses_new_engine = False

if not update_file_requires_new_engine:
if not os.path.exists("updates"):
os.mkdir("updates")
if update_file:
shutil.move(update_file, "updates")
update_file = get_available_version(version)
made_update_folder = True # Delete at end
if update_file: # Check if file exists
if not (os.path.dirname(os.path.abspath(update_file)) == os.path.abspath("updates")):
if not os.path.exists("updates"):
os.mkdir("updates")
shutil.move(update_file, "updates")
update_file = get_available_version(version)
made_update_folder = True # Delete at end

# If version was a valid location file, update_file will be the location.
# If version was a valid location file, update_file will be the location else it'll be a version number

if not update_file:
temp_path = tempfile.mkdtemp()
Expand Down Expand Up @@ -340,7 +350,7 @@ def main() -> None:
download.add_argument("version", help="Version to download")
download.add_argument("--out", "-o", help="Folder to download to", default=None)
download.add_argument(
"--hardware", "--h", help="Hardware to download for", required=True
"--hardware", "-hd", help="Hardware to download for", required=True
)

### Backup subcommand
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "codexctl"
version = "0.3.0"
version = "0.4.0"
description = "Automated update managment for the ReMarkable tablet"
authors = ["Jayy001 <[email protected]>"]
license = "GPLv3"
Expand Down

0 comments on commit e94541b

Please sign in to comment.