Commit Graph

3 Commits

Author SHA1 Message Date
Jinguang Dong 638de6f4d3 refactor: improve code quality and integrate SPDX license conversion
- Update README_OSS.md with comprehensive documentation for new features
- Refactor generate_readme_opensource.py to integrate SPDX conversion
- Refactor spdx_license_matcher.py to use shared SPDXLicenseConverter
- Update test_validate_readme_opensource.py with better mock handling
- Add command-line arguments support to generate_readme_opensource.py
- Add SPDX license validation to generate_readme_opensource.py
- Improve error handling and logging across all modules

Changes:
- README_OSS.md: Add documentation for SPDX features, reference data generation,
  and complete usage examples with FAQ section
- generate_readme_opensource.py: Add argparse CLI, SPDX converter integration,
  license validation, and improved type hints
- spdx_license_matcher.py: Refactor to use shared SPDXLicenseConverter,
  add --column option, improve error handling, add summary output
- test_validate_readme_opensource.py: Fix test mock issues, add docstrings

Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2026-02-12 11:17:28 +08:00
Jinguang Dong 932a68b33e Add SPDX license standardization for reference data generation
- Add spdx_converter.py to convert license names to SPDX standard identifiers
- Add generate_reference_data.py to generate reference_data.json from README.OpenSource files
- Update data/spdx.json with latest SPDX license list (712 licenses)
- Update test/reference_data.json with SPDX-standardized license identifiers
- Add unit tests for SPDX converter (10 test methods, 28 subtests)
- Add Python project configuration files (pyproject.toml, requirements.txt)

Features:
- Converts license variants like "MIT License" -> "MIT", "GPL-2.0" -> "GPL-2.0-only"
- Handles WITH exception format (e.g., "Apache-2.0 WITH LLVM-exception")
- Supports multiple license separators (;, /, ,, or, OR)
- Validates all generated license identifiers against SPDX standard

All license identifiers in reference_data.json are now valid SPDX standard.

Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2026-02-10 18:03:16 +08:00
Jinguang Dong 1f5bbc0e14 Description:[feature] optimize readme opensource validate content
Bug: https://gitee.com/openharmony/developtools_integration_verification/issues/IAT8BB
Test: run validate_readme_opensource.py

Signed-off-by: Jinguang Dong <dongjinguang@huawei.com>
2024-09-24 11:48:48 +08:00