Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade deps, remove unused, format #54

Merged
merged 1 commit into from
Sep 6, 2024
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
31 changes: 8 additions & 23 deletions requirements.build.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,10 @@
-r requirements.txt
build==0.6.0.post1
packaging==23.1
pep517==0.13.0
pyinstaller==6.3.0
black==23.7.0
certifi==2023.7.22
charset-normalizer==3.2.0
idna==3.4
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
mypy==1.7.1
build==1.2.1
pyinstaller==6.10.0
black==24.8.0
mypy==1.11.2
mypy-extensions==1.0.0
pylint==3.0.3
pyparsing==3.1.1
six==1.16.0
toml==0.10.2
tomli==2.0.1
types-python-dateutil==2.8.19.14
types-requests==2.31.0.2
typing-extensions==4.7.1
urllib3==2.0.4
websocket-client==1.6.1
wrapt==1.15.0
pylint==3.2.7
types-python-dateutil==2.9.0.20240906
types-requests==2.32.0.20240905
typing-extensions==4.12.2
9 changes: 3 additions & 6 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
docker==7.0.0
python-dateutil==2.8.2
pyelftools==0.30

# Pinned due to https://github.com/docker/docker-py/issues/3256
requests==2.31.0
docker==7.1.0
python-dateutil==2.9.0.post0
pyelftools==0.31
13 changes: 8 additions & 5 deletions tests/test_strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,14 @@ def test_strip(self) -> None:
dist_dir = path.join(tmp_dir, "dist")
shutil.copytree(src_dir, rec_dir)
replacements = {"flags=()": "flags=(nostrip)"}
with open(
path.join(src_dir, "package"), "rt", encoding="utf-8"
) as infile, open(
path.join(rec_dir, "package"), "wt", encoding="utf-8"
) as outfile:
with (
open(
path.join(src_dir, "package"), "rt", encoding="utf-8"
) as infile,
open(
path.join(rec_dir, "package"), "wt", encoding="utf-8"
) as outfile,
):
for line in infile:
for src, target in replacements.items():
line = line.replace(src, target)
Expand Down
4 changes: 2 additions & 2 deletions toltec/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ def _parse_func(lexer: shlex.shlex) -> Tuple[int, int]:
assert lexer.get_token() == "{"
brace_depth = 1

start_byte = lexer.instream.tell()
start_byte = lexer.instream.tell() # type: ignore

while brace_depth > 0:
token = lexer.get_token()
Expand All @@ -355,7 +355,7 @@ def _parse_func(lexer: shlex.shlex) -> Tuple[int, int]:
elif token == "}":
brace_depth -= 1

end_byte = lexer.instream.tell() - 1
end_byte = lexer.instream.tell() - 1 # type: ignore
return start_byte, end_byte


Expand Down
1 change: 1 addition & 0 deletions toltec/hooks/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Built in hooks
"""

__all__ = [
"patch_rm2fb",
"strip",
Expand Down
1 change: 1 addition & 0 deletions toltec/hooks/install_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
After the artifacts are packaged, this hook will look for known install-lib
methods and add them to scripts if found.
"""

import logging

from typing import Set, Iterable
Expand Down
1 change: 1 addition & 0 deletions toltec/hooks/patch_rm2fb.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
binaries. This behavior is only enabled if the recipe declares the
'patch_rm2fb' flag.
"""

import os
import logging
import shlex
Expand Down
1 change: 1 addition & 0 deletions toltec/hooks/reload_oxide_apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
/opt/etc/draft or /opt/usr/share/applications and adds reload-oxide-apps to
configure, postupgrade, and postremove
"""

import os
import logging

Expand Down
1 change: 1 addition & 0 deletions toltec/hooks/strip.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
hook looks for ELF-files in the build directory and strips them. This
behavior is disabled if the recipe declares the 'nostrip' flag.
"""

import os
import logging
import shlex
Expand Down
8 changes: 5 additions & 3 deletions toltec/ipk.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,11 @@ def write(
:param pkg_dir: directory containing the package tree to include in the
data sub-archive, leave empty to generate an empty data archive
"""
with BytesIO() as control, BytesIO() as data, _targz_open(
file, epoch
) as archive:
with (
BytesIO() as control,
BytesIO() as data,
_targz_open(file, epoch) as archive,
):
root_info = tarfile.TarInfo("./")
root_info.type = tarfile.DIRTYPE
archive.addfile(_clean_info(None, epoch, root_info))
Expand Down
7 changes: 4 additions & 3 deletions toltec/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@ def make_index(base_dir: str, _start: bool = True) -> None:
index_path = os.path.join(base_dir, "Packages")
index_gzip_path = os.path.join(base_dir, "Packages.gz")

with open(
index_path, "w", encoding=locale.getencoding()
) as index_file, gzip.open(index_gzip_path, "wt") as index_gzip_file:
with (
open(index_path, "w", encoding=locale.getencoding()) as index_file,
gzip.open(index_gzip_path, "wt") as index_gzip_file,
):
for entry in os.scandir(base_dir):
if entry.name in ("Packages", "Packages.gz"):
pass
Expand Down
8 changes: 5 additions & 3 deletions toltec/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,11 @@ def split(

def map_alpha(string: str, length: int) -> tuple[int, ...]:
return tuple(
_ALPHA_SORT_KEY.index(string[i])
if i in range(len(string))
else _ALPHA_SORT_KEY.index(None)
(
_ALPHA_SORT_KEY.index(string[i])
if i in range(len(string))
else _ALPHA_SORT_KEY.index(None)
)
for i in range(length)
)

Expand Down