Files
serena/scripts/build_news_json.py
T
Dominik Jain 6707cd9b7e Introduce component-based licensing: Serena GPL-3.0-or-later, SolidLSP MIT
The repository is licensed per component. SolidLSP (src/solidlsp,
test/solidlsp, test/resources) remains MIT-licensed and independently
reusable; the Serena application (src/serena, src/interprompt, scripts,
test/serena, docs) is licensed under GPL-3.0-or-later starting with the v2
licensing transition. The change is not retroactive: all releases and
commits up to v1.7.0 / 74c38a65 (tag mit-final) remain available under MIT.

Since MIT is GPL-compatible, a distribution combining both (such as the
serena-agent package) is as a whole subject to GPL-3.0-or-later, while the
SolidLSP files themselves stay MIT and can be extracted and used separately
under MIT terms. The distribution metadata therefore declares
GPL-3.0-or-later, with both license texts shipped alongside it.

Serena originally began under the GPL (v2) and was switched to MIT in
May 2025 following community requests. We consider that change a mistake;
the substantial changes in v2 make this the appropriate time to revert it.
We want the best version of Serena to remain free.

Changes:
* LICENSE is now the licensing overview; canonical license texts live in
  LICENSES/ (MIT.txt is the previous LICENSE verbatim, GPL-3.0-or-later.txt
  is the unmodified FSF text)
* pyproject.toml declares the PEP 639 license expression
  "GPL-3.0-or-later" and bundles LICENSE and LICENSES/* as license files;
  the deprecated MIT classifier is dropped and flake.nix declares gpl3Plus;
  README has per-component license badges and a License section
* SPDX-License-Identifier headers in all Python sources under src/ and
  scripts/, added by the new idempotent scripts/add_spdx_headers.py, which
  gen_prompt_factory.py also uses to keep the header on the generated
  module; existing third-party notices are preserved
* CLA.md: Contributor License Agreement (contributor retains copyright;
  grants a perpetual, irrevocable license including relicensing under any
  terms, incl. proprietary/commercial; patent grant; authority
  representations), to be enforced repository-wide via cla-assistant.io
* CONTRIBUTING.md, PR template and a new docs page explain the licensing
  boundary and the CLA workflow
2026-09-14 21:33:18 +02:00

57 lines
1.7 KiB
Python

"""
Script to build a single JSON file from all individual news HTML files.
Usage:
uv run python scripts/build_news_json.py
This reads all .html files from the `news/` directory and creates
`news/news.json` containing a mapping of news IDs to HTML content strings.
"""
# SPDX-License-Identifier: GPL-3.0-or-later
import json
import os
import sys
from pathlib import Path
from serena.config.serena_config import SerenaPaths
def build_news_json() -> None:
news_dir = Path(SerenaPaths().news_dir)
if not news_dir.exists():
print(f"Error: News directory not found at {news_dir}", file=sys.stderr)
sys.exit(1)
news_files = sorted(news_dir.glob("*.html"))
if not news_files:
print("Warning: No HTML news files found in news/", file=sys.stderr)
news_data: dict[str, str] = {}
for news_file in news_files:
news_id = news_file.stem # e.g. "20260111"
html_content = news_file.read_text(encoding="utf-8").strip()
news_data[news_id] = html_content
print(f" Added news {news_id} ({len(html_content)} chars)")
output_file = news_dir / "news.json"
with open(output_file, "w", encoding="utf-8") as f:
json.dump(news_data, f, ensure_ascii=False, indent=2)
print(f"\nBuilt {output_file} with {len(news_data)} news entries.")
if __name__ == "__main__":
deploy = False
for arg in sys.argv[1:]:
if arg == "--deploy":
deploy = True
build_news_json()
if deploy:
user = os.getenv("HADES_USER")
assert user, "HADES_USER environment variable must be set to deploy news.json to Hades"
os.system(f"scp news/news.json {user}@hades:/var/www/html/oraios-software/serena_news.json")