Skip to content

Commit

Permalink
Bump all requirements to latest (#32)
Browse files Browse the repository at this point in the history
* Bump certifi from 2021.5.30 to 2023.7.22

Bumps [certifi](https://github.com/certifi/python-certifi) from 2021.5.30 to 2023.7.22.
- [Commits](certifi/python-certifi@2021.05.30...2023.07.22)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update all requirements to latest

* Upgrade to python 3.11

* Drop 3.9 and 3.10 support

* Build standalone executable

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Nathaniel van Diepen <nathaniel.vandiepen@gmail.com>
  • Loading branch information
dependabot[bot] and Eeems authored Aug 17, 2023
1 parent 9e65790 commit 186c04b
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 92 deletions.
125 changes: 75 additions & 50 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,78 @@ name: checks
on: [push, pull_request]
permissions: read-all
jobs:
format:
name: Check formatting
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Check formatting
run: make format
lint:
name: Check for erroneous constructs
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Check for erroneous constructs
run: make lint
links:
name: Check Markdown links
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Check Markdown links
run: |
npm install -g markdown-link-check
make links
test:
name: Run tests
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Run tests
run: make test
format:
name: Check formatting
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Check formatting
run: make format
lint:
name: Check for erroneous constructs
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Check for erroneous constructs
run: make lint
links:
name: Check Markdown links
runs-on: ubuntu-20.04
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Check Markdown links
run: |
npm install -g markdown-link-check
make links
test:
name: Run tests
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
python: ['3.11']
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Run tests
run: make test
standalone:
name: Make Standalone
runs-on: ubuntu-20.04
needs: [format, lint, test]
steps:
- name: Checkout the Git repository
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
cache: 'pip'
- name: Building toltecmk
run: make standalone
- uses: actions/upload-artifact@v3
with:
name: toltecmk
path: toltecmk
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
.venv
__pycache__
dist
*.onefile-build
toltecmk
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ standalone: .venv/bin/activate
--enable-plugin=pylint-warnings \
--onefile --linux-onefile-icon=media/overview.svg \
--assume-yes-for-downloads \
-o toltecmk \
toltec

test: .venv/bin/activate
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pip install toltecmk
There are a few system requirements to use this tool:

* Linux-based operating system
* Python ⩾ 3.9
* Python ⩾ 3.11
* Docker

### Basic Usage
Expand Down
52 changes: 26 additions & 26 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
astroid==2.6.5
astroid==2.15.6
build==0.6.0.post1
certifi==2021.5.30
charset-normalizer==2.0.4
docker==5.0.0
idna==3.2
isort==5.9.3
lazy-object-proxy==1.6.0
mccabe==0.6.1
mypy==0.910
mypy-extensions==0.4.3
packaging==21.0
pep517==0.11.0
pyelftools==0.27
pylint==2.9.6
pyparsing==2.4.7
certifi==2023.7.22
charset-normalizer==3.2.0
docker==6.1.3
idna==3.4
isort==5.12.0
lazy-object-proxy==1.9.0
mccabe==0.7.0
mypy==1.5.1
mypy-extensions==1.0.0
packaging==23.1
pep517==0.13.0
pyelftools==0.29
pylint==2.17.5
pyparsing==3.1.1
python-dateutil==2.8.2
requests==2.26.0
requests==2.31.0
six==1.16.0
toml==0.10.2
tomli==1.2.1
types-python-dateutil==0.1.4
types-requests==2.25.1
typing-extensions==3.10.0.0
urllib3==1.26.6
websocket-client==1.1.0
wrapt==1.12.1
scons==4.2.0
nuitka==0.6.16.2
black==21.7b0
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
scons==4.5.2
nuitka==1.7.10
black==23.7.0
20 changes: 13 additions & 7 deletions toltec/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,8 @@ def get_declarations(src: str) -> Tuple[Variables, Functions]:
lexer = shlex.shlex(declarations, posix=True)
lexer.wordchars = lexer.wordchars + "-"

variables = {}
functions = {}
variables: Variables = {}
functions: Functions = {}

while True:
token = lexer.get_token()
Expand All @@ -134,6 +134,8 @@ def get_declarations(src: str) -> Tuple[Variables, Functions]:
break

next_token = lexer.get_token()
assert token is not None
assert next_token is not None

if token == "declare" and next_token[0] == "-":
lexer.push_token(next_token)
Expand Down Expand Up @@ -215,10 +217,10 @@ def _parse_indexed(lexer: shlex.shlex) -> IndexedArray:
break

assert token == "["
index = int(lexer.get_token())
index = int(lexer.get_token() or "")
assert lexer.get_token() == "]"
assert lexer.get_token() == "="
value = _parse_string(lexer.get_token())
value = _parse_string(lexer.get_token() or "")

# Grow the result array so that the index exists
if index >= len(result):
Expand All @@ -245,7 +247,7 @@ def _generate_indexed(array: IndexedArray) -> str:
def _parse_assoc(lexer: shlex.shlex) -> AssociativeArray:
"""Parse an associative Bash array."""
assert lexer.get_token() == "("
result = {}
result: AssociativeArray = {}

while True:
token = lexer.get_token()
Expand All @@ -256,9 +258,10 @@ def _parse_assoc(lexer: shlex.shlex) -> AssociativeArray:

assert token == "["
key = lexer.get_token()
assert key is not None
assert lexer.get_token() == "]"
assert lexer.get_token() == "="
value = _parse_string(lexer.get_token())
value = _parse_string(lexer.get_token() or "")

result[key] = value

Expand All @@ -280,6 +283,7 @@ def _generate_assoc(array: AssociativeArray) -> str:
def _parse_var(lexer: shlex.shlex) -> Tuple[str, Optional[Any]]:
"""Parse a variable declaration."""
flags_token = lexer.get_token()
assert flags_token is not None

if flags_token != "--":
var_flags = set(flags_token[1:])
Expand All @@ -289,14 +293,16 @@ def _parse_var(lexer: shlex.shlex) -> Tuple[str, Optional[Any]]:
var_name = lexer.get_token()
var_value: Optional[Any] = None
lookahead = lexer.get_token()
assert var_name is not None
assert lookahead is not None

if lookahead == "=":
if "a" in var_flags:
var_value = _parse_indexed(lexer)
elif "A" in var_flags:
var_value = _parse_assoc(lexer)
else:
var_value = _parse_string(lexer.get_token())
var_value = _parse_string(lexer.get_token() or "")
else:
lexer.push_token(lookahead)

Expand Down
4 changes: 2 additions & 2 deletions toltec/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ def _fetch_sources(
shutil.copy2(os.path.join(recipe.path, source.url), local_path)
else:
# Fetch source file from the network
req = requests.get(source.url)
req = requests.get(source.url, timeout=(3.05, 300))

if req.status_code != 200:
raise BuildError(
Expand All @@ -229,7 +229,7 @@ def _fetch_sources(

# Verify checksum
file_sha = util.file_sha256(local_path)
if source.checksum != "SKIP" and file_sha != source.checksum:
if source.checksum not in ("SKIP", file_sha):
raise BuildError(
f"Invalid checksum for source file {source.url}:\n"
f" expected {source.checksum}\n"
Expand Down
4 changes: 2 additions & 2 deletions toltec/recipe_parsers/bash.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ def parse(path: str) -> RecipeBundle:
:param path: path to the directory containing the recipe definition
:returns: loaded recipe
"""
with open(os.path.join(path, "package"), "r") as recipe:
with open(os.path.join(path, "package"), "r", encoding="UTF-8") as recipe:
result = {}
definition = recipe.read()
variables, functions = bash.get_declarations(definition)

for (arch, variables, functions) in _instantiate_arch(
for arch, variables, functions in _instantiate_arch(
path, variables, functions
):
result[arch] = _parse_recipe(path, variables, functions)
Expand Down
7 changes: 4 additions & 3 deletions toltec/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"""

import gzip
import locale
import logging
import os
import textwrap
Expand All @@ -30,9 +31,9 @@ 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") 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
1 change: 0 additions & 1 deletion toltec/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ class Hook(Protocol): # pylint:disable=too-few-public-methods
@staticmethod
def register(new_listener: HookListener) -> None:
"""Add a new listener to this hook."""
...

# Invoke all listeners for this hook
__call__: HookTrigger
Expand Down

0 comments on commit 186c04b

Please sign in to comment.