"""Offline Eclipse platform, EPL license & release timeline verifier for Ch01 (tutorial)."""
import json
from datetime import date
VERSION = "CPython 3.12.14 offline Eclipse platform/metadata verifier (desktop Eclipse SWT GUI absent)"
def check(name, summary, expected, actual):
return {
"name": name,
"summary": summary,
"expected": expected,
"actual": actual,
"passed": actual == expected,
}
def parse_osgi_manifest(raw_text):
headers = {}
for line in raw_text.strip().splitlines():
if ":" in line:
k, v = line.split(":", 1)
headers[k.strip()] = v.strip()
return headers
def main():
cases = []
# Case 1: Eclipse platform metadata, multi-language support & EPL license
platform_info = {
"open_source": True,
"base_runtime": "Java",
"license_short": "EPL",
"license_full": "Eclipse Public License",
"steward": "Eclipse Foundation",
"default_java_plugin_set": "JDT",
"supported_languages": ["Java", "C", "C++", "PHP", "Ruby"],
}
cases.append(
check(
"eclipse_platform_and_epl_metadata",
"Verify Eclipse open-source Java platform attributes, EPL license metadata, and multi-language plugin support",
{
"open_source": True,
"base_runtime": "Java",
"license_short": "EPL",
"supports_multi_language": True,
"has_jdt": True,
},
{
"open_source": platform_info["open_source"],
"base_runtime": platform_info["base_runtime"],
"license_short": platform_info["license_short"],
"supports_multi_language": len(platform_info["supported_languages"]) >= 5,
"has_jdt": platform_info["default_java_plugin_set"] == "JDT",
},
)
)
# Case 2: Simultaneous release train Callisto (3.2) through Photon (4.8)
releases = [
("Callisto", "3.2", (2006, 6, 26), None, None),
("Europa", "3.3", (2007, 6, 27), (2007, 9, 28), (2008, 2, 29)),
("Ganymede", "3.4", (2008, 6, 25), (2008, 9, 24), (2009, 2, 25)),
("Galileo", "3.5", (2009, 6, 24), (2009, 9, 25), (2010, 2, 26)),
("Helios", "3.6", (2010, 6, 23), (2010, 9, 24), (2011, 2, 25)),
("Indigo", "3.7", (2011, 6, 22), (2011, 9, 23), (2012, 2, 24)),
("Juno", "3.8及4.2", (2012, 6, 27), (2012, 9, 28), (2013, 3, 1)),
("Kepler", "4.3", (2013, 6, 26), (2013, 9, 27), (2014, 2, 28)),
("Luna", "4.4", (2014, 6, 25), (2014, 9, 25), None),
("Mars", "4.5", (2015, 6, 24), None, None),
("Neon", "4.6", (2016, 6, 22), None, None),
("Oxygen", "4.7", (2017, 6, 28), None, None),
("Photon", "4.8", (2018, 6, 1), None, None),
]
all_june_main = all(r[2][1] == 6 for r in releases)
sr1_count = sum(1 for r in releases if r[3] is not None)
sr2_count = sum(1 for r in releases if r[4] is not None)
leap_day_ok = date(*releases[1][4]).isoformat() == "2008-02-29"
cases.append(
check(
"simultaneous_release_table_timeline",
"Verify the 13 Eclipse annual simultaneous releases from Callisto (3.2) to Photon (4.8)",
{
"release_count": 13,
"first_codename": "Callisto",
"last_codename": "Photon",
"all_june_main": True,
"sr1_count": 8,
"sr2_count": 7,
"europa_sr2_leap_day": True,
},
{
"release_count": len(releases),
"first_codename": releases[0][0],
"last_codename": releases[-1][0],
"all_june_main": all_june_main,
"sr1_count": sr1_count,
"sr2_count": sr2_count,
"europa_sr2_leap_day": leap_day_ok,
},
)
)
# Case 3: Post-Neon quarterly update release cadence (June main, Sept .1, Dec .2, Mar .3)
neon_cycle = [
("Neon.0", 6),
("Neon.1", 9),
("Neon.2", 12),
("Neon.3", 3),
]
cases.append(
check(
"neon_quarterly_update_cadence",
"Verify post-Neon release update cadence across June main and Sept/Dec/Mar quarterly updates",
{"update_months": [6, 9, 12, 3], "quarterly_interval_months": 3},
{
"update_months": [m for _, m in neon_cycle],
"quarterly_interval_months": (neon_cycle[1][1] - neon_cycle[0][1]) % 12,
},
)
)
# Case 4: Parse OSGi Eclipse plugin bundle manifest
manifest_raw = """
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipse Java Development Tools Core
Bundle-SymbolicName: org.eclipse.jdt.core;singleton:=true
Bundle-Version: 3.12.3
Bundle-Vendor: Eclipse.org
Bundle-License: EPL-1.0
"""
headers = parse_osgi_manifest(manifest_raw)
symbolic_id = headers["Bundle-SymbolicName"].split(";")[0]
cases.append(
check(
"eclipse_bundle_manifest_parse",
"Parse Eclipse OSGi bundle MANIFEST.MF headers for JDT plugin identity and EPL license",
{
"symbolic_id": "org.eclipse.jdt.core",
"license": "EPL-1.0",
"manifest_version": "2",
},
{
"symbolic_id": symbolic_id,
"license": headers["Bundle-License"],
"manifest_version": headers["Bundle-ManifestVersion"],
},
)
)
print(json.dumps({"version": VERSION, "cases": cases}, ensure_ascii=False, indent=2))
if __name__ == "__main__":
main()
本例需在 Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。 中运行,请复制源码、保存文件或下载工程包后在本地执行验证。
运行说明与环境独立工程
运行环境:Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。
入口文件:projects/eclipse-tutorial-lab/explore-tutorial.py
本地运行步骤快速上手
- 点击上方“保存源码”保存为
explore-tutorial.py,或下载右侧课程工程包。 - 确认本地已准备 Windows x64、CPython 3.12.14、Playwright 与本地浏览器/标准库。。
- 按对应章节命令执行,结合正文核对实际输出。
附件与关联工程包下载
课程关联工程包(登记关联35章) · 含当前章节或实例 · mbskycom202612a2259.zip
课程关联工程包(登记关联1章) · 含当前章节或实例 · mbskycom202612a2291.zip