Commit Graph
31 Commits
Author SHA1 Message Date
LeoVasanko c9ae37a03d Validate LF line endings in release builds
release / build-wheels (linux, bash) (push) Successful in 1m8s
release / build-wheels (windows, cmd) (push) Successful in 1m19s
release / build-wheels (macos, bash) (push) Successful in 1m20s
release / publish-pypi (push) Successful in 15s
Replaces the removed normalize_line_endings rewriter: release.py now
fails listing any text file containing CRLF instead of silently
rewriting it. .gitattributes (eol=lf) remains the preventive half.
2026-10-04 18:30:28 +00:00
LeoVasanko e29035f768 Release builds must not write tracked files; validate instead
release.py previously ran the code generator, 'ruff check --fix',
'ruff format', and line-ending normalization before building. Any drift
rewrote tracked files, dirtying the checkout and turning the release
into a dev version (the v0.10.6 PyPI 400). Generation and linting are
now validation-only:

- tools/generate.py gains a --check mode that reports stale generated
  files without writing (comparing Python content in ruff-formatted
  form, matching what write + format would produce)
- release.py runs generate --check, ruff check (no --fix), and
  ruff format --check, failing with remediation hints
- normalize_line_endings() is removed; .gitattributes keeps checkouts LF
2026-10-04 18:26:49 +00:00
LeoVasanko 3ff145a0f0 Fix release versioning: keep tree ruff-clean, fail fast on dirty tag builds
The tagged v0.10.6 CI build produced wheels versioned
0.10.7.dev0+g503ce8e49.d20261004: setup.py was not ruff-format-clean, so
release.py's own 'ruff format .' step rewrote it, dirtying the checkout
before setuptools_scm ran. PyPI then rejected the local version segment
with HTTP 400.

- ruff-format setup.py
- release.py: on a v*-tagged HEAD, fail before building if the version
  is not a clean release, printing the dirty files
- add .gitattributes (eol=lf) so Windows checkouts can't dirty the tree
  via normalize_line_endings either
2026-10-04 18:15:07 +00:00
LeoVasanko 503ce8e491 Fix FileStorage on Windows: open fd with O_BINARY, UTF-8 release logs
release / build-wheels (linux, bash) (push) Successful in 1m13s
release / build-wheels (windows, cmd) (push) Successful in 1m20s
release / build-wheels (macos, bash) (push) Successful in 1m26s
release / publish-pypi (push) Failing after 2s
os.open() on Windows defaults to O_TEXT, so the CRT translated \r\n in
binary ciphertext: writes grew, offsets shifted, reads came up short and
the RAF callbacks failed with EIO (probe/read/write depending on where
a 0x0A byte landed). Pass O_BINARY where it exists.

Also reconfigure stdout/stderr to UTF-8 in tools/release.py so the
✓/✗/⚠ summary lines don't crash on cp1252 Windows consoles.
2026-10-04 17:48:34 +00:00
LeoVasanko 9583a1f9a8 Fix cdef size_t size on Win64 (LLP64), require 64-bit builds
release / build-wheels (linux, bash) (push) Successful in 1m12s
release / build-wheels (windows, cmd) (push) Failing after 1m16s
release / build-wheels (macos, bash) (push) Successful in 1m21s
release / publish-pypi (push) Skipped
The generated cdef typedef'd size_t as unsigned long: 8 bytes on LP64
but only 4 on 64-bit Windows, where C's size_t is 8. cffi's import-time
struct layout verification then failed (aegis_raf_scratch.len: cdef
says 4, C compiler says 8). cffi pre-defines size_t/uint8_t with the
correct platform sizes, so don't typedef them.

Also hard-fail 32-bit build attempts in setup.py; 32-bit platforms are
no longer supported.
2026-10-04 17:32:52 +00:00
LeoVasanko b4404b42e6 Fix ruff 0.16 findings; bump dependency minimums to match
release / build-wheels (windows, cmd) (push) Failing after 11s
release / build-wheels (linux, bash) (push) Failing after 10s
release / build-wheels (macos, bash) (push) Failing after 11s
release / publish-pypi (push) Skipped
- pyproject [tool.ruff.lint]: ignore RUF022/RUF023 (deliberately grouped
  __all__/__slots__), SIM117, BLE001 (blind except is intentional at
  CFFI callback boundaries)
- Legit fixes: dict/tuple instead of typing.Dict/Tuple in generate.py,
  unquoted annotations in raf.py, Self return for __enter__ methods,
  explicit check=False on subprocess.run, collapsed nested ifs, sorted
  test imports, unused-unpacked-variable in test_raises
- Bump minimum versions to the synced toolchain: cffi 2.1.1, ruff
  0.16.10, pytest 9.1.1, auditwheel 6.8.2, setuptools 84.0.0,
  setuptools-scm 10.3.4 (project deps and build-system requires)
2026-10-04 16:24:40 +00:00
LeoVasanko 972c3053d9 Require Python 3.12+; drop PyPy and 3.10/3.11 wheel builds
- requires-python >= 3.12; abi3 limited API tag cp310 -> cp312
- util.Buffer now imported directly from collections.abc (no fallback)
- release.py: ABI3 wheel covers 3.12-3.15; PyPy wheels dropped (PyPy
  has no 3.12 support yet)
2026-10-04 05:42:22 +00:00
LeoVasanko 199dfe7bd9 generate.py: run ruff format on generated files
Running generate.py standalone previously rewrote _ciphers.py with
formatting that differed from the committed (ruff-formatted) style,
creating spurious diffs. release.py already ran ruff after generation;
now generate.py does too, so both entry points leave the tree in the
same state.
2026-10-04 05:41:14 +00:00
LeoVasanko e01d84a560 Add RAF (random-access encrypted file) support and aeg.random CSPRNG
Implement Python bindings for the libaegis 0.10.6 RAF API:

- Thin per-variant wrappers (raf_create/open/read/write/truncate/size/
  sync/close, merkle_rebuild/verify/commitment) generated from a template
  in tools/generate.py, with errno-mapped exceptions.
- aeg.raf: high-level file-like API (Raf, create/open/probe,
  derive_master_key) with pluggable Storage backends (FileStorage,
  BytesIOStorage) and Merkle tree integrity via a MerkleHasher protocol
  (SHA256MerkleHasher default), adapted from pyaegis (MIT).
- aeg.random: CSPRNG facility. Random produces AEGIS keystream seeded
  once from the OS, exposed per cipher module as cipher.random() and
  usable as the RAF RNG (as_raf_rng) or standalone RandomSource.
- Tests: roundtrip/random-access/seek/truncate/Merkle coverage for all
  six variants, pyaegis-style API checks, and a Merkle fuzz test.
2026-10-04 04:25:59 +00:00
LeoVasanko 0cb7faf698 Add Gitea release workflow: per-platform wheel builds, then publish to PyPI
Matrix job builds and tests wheels on linux/macos/windows (no Gitea
release, unlike mediahive); publish job uploads the merged dist/ to PyPI
only after all platforms succeed. release.py gains --no-upload for the
matrix jobs.
2026-10-04 02:54:30 +00:00
LeoVasanko a1bfeb2434 Build updated for upstream libaegis 0.9.0 simplified API with matching changes on Python side. Set lower MacOS build target (11.0). Build abi3 version for all supported Python versions, reducing the number of wheels. Other build cleanup. 2026-01-10 20:23:37 +00:00
LeoVasanko 4de66b6bc6 [packaging] Release script: Fix further problems with freethreaded wheels and a variable name overlap. 2025-12-31 22:30:28 +00:00
LeoVasanko 66338ef416 [packaging] Fix wheel curing for pypy-linux. 2025-12-31 21:59:37 +00:00
LeoVasanko 509898ac73 Make tool scripts executable. 2025-12-31 21:43:25 +00:00
LeoVasanko 67ec091bc5 Add aeg.cipher(alg) for loading modules by name in str. Added aeg.CIPHERS mapping of the nominal names to module names and Cipher for typing literals. 2025-12-31 21:38:30 +00:00
LeoVasanko 4977a7e79d Added free-threaded non-GIL Python and PyPy wheels, up to 3.15 now. 2025-12-31 21:24:56 +00:00
LeoVasanko d7acf7a315 [release script] Auditwheel only on Linux. 2025-12-23 19:38:59 +00:00
LeoVasanko 9294fba86d Make manylinux wheels. 2025-12-23 19:20:17 +00:00
LeoVasanko bd8b183e32 Project renamed to aeg, preparing for PyPI release. 2025-12-23 18:25:03 +00:00
LeoVasanko daba717ebb Add tools/release.py script for automatic release process. 2025-11-12 23:47:26 +00:00
LeoVasanko 5b74bcb683 Always generate LF line endings (even on broken OS). 2025-11-12 23:43:25 +00:00
LeoVasanko 56d304a82e Constants renamed and values extracted from C code rather than function call at runtime. Documentation update. 2025-11-09 03:43:01 +00:00
LeoVasanko 28ee0e1314 Combine the two generator scripts into one that also reads ALIGNMENT and RATE from C sources. 2025-11-09 01:20:15 +00:00
LeoVasanko d04c593766 Move the build_backend script to tools folder. 2025-11-07 22:26:03 +00:00
LeoVasanko 5c04940525 Include zig build in the build process. 2025-11-07 04:43:54 +00:00
LeoVasanko e644f1b2ca Switch from hatch to setuptools/CFFI build to produce wheels correctly. 2025-11-07 04:34:32 +00:00
LeoVasanko 302429b7a4 Add comments to generated files saying how they are generated. 2025-11-07 03:31:29 +00:00
LeoVasanko b83120187c Build cleanup, pathname reorganisation, cdef to repository (although generated with gen_cdef.py). 2025-11-07 03:23:30 +00:00
LeoVasanko 0ae8752666 Rename module to pyaegis, implement build with zig. 2025-11-06 21:34:15 +00:00
LeoVasanko c16e785203 Precise update output length calculation to allocate exactly sized buffers. 2025-11-06 19:45:15 +00:00
LeoVasanko 618d9e0967 Make key, nonce the first arguments (in this order), require kwargs past the initial few positional arguments. Add ALIGNMENT constant to each module. Add a script to generate all other modules from aegis256x4.py. 2025-11-05 08:26:47 +00:00