Skip to content

Commit

Permalink
chore: move script into justfile
Browse files Browse the repository at this point in the history
  • Loading branch information
rumpelsepp committed Jan 22, 2025
1 parent 2b0193a commit 2a3fedc
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 56 deletions.
43 changes: 39 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,56 @@ run-test-matrix:
done

run-test-pytest:
python -m pytest -v --cov={{justfile_directory()}} --cov-report html tests/pytest
python -m pytest -v --cov={{ justfile_directory() }} --cov-report html tests/pytest

run-test-bats:
./tests/bats/run_bats.sh

gen-constants: && fmt
./scripts/gen_constants.py > src/gallia/transports/_can_constants.py
#!/usr/bin/env python
import socket

TEMPLATE = f"""# This file has been autogenerated by `just gen-constants`.
# !! DO NOT CHANGE MANUALLY !!
import struct
CANFD_MTU = 72
CAN_MTU = 16
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/can.h
CAN_HEADER_FMT = struct.Struct("=IBB2x")
CANFD_BRS = 0x01
CANFD_ESI = 0x02
CAN_EFF_FLAG = {socket.CAN_EFF_FLAG}
CAN_ERR_FLAG = {socket.CAN_ERR_FLAG}
CAN_RTR_FLAG = {socket.CAN_RTR_FLAG}
CAN_EFF_MASK = {socket.CAN_EFF_MASK}
CAN_INV_FILTER = 0x20000000 # TODO: Add to CPython
CAN_SFF_MASK = {socket.CAN_SFF_MASK}
CAN_RAW = {socket.CAN_RAW}
CAN_RAW_FD_FRAMES = {socket.CAN_RAW_FD_FRAMES}
CAN_RAW_FILTER = {socket.CAN_RAW_FILTER}
CAN_RAW_JOIN_FILTERS = {socket.CAN_RAW_JOIN_FILTERS}
SOL_CAN_RAW = {socket.SOL_CAN_RAW}
"""

with open("src/gallia/transports/_can_constants.py", "w") as f:
f.write(TEMPLATE)

release increment:
cz bump --increment {{increment}}
cz bump --increment {{ increment }}
git push --follow-tags
gh release create "v$(cz version -p)"

pre-release increment premode:
cz bump --increment {{increment}} --prerelease {{premode}}
cz bump --increment {{ increment }} --prerelease {{ premode }}
git push --follow-tags
gh release create --prerelease "v$(cz version -p)"

Expand Down
52 changes: 0 additions & 52 deletions scripts/gen_constants.py

This file was deleted.

0 comments on commit 2a3fedc

Please sign in to comment.