WinPython 2.7.4.0 发行版技术解析:完整包清单、版本变更与 changelog 生成机制
WinPython 2.7.4.0 发行版技术解析:完整包清单、版本变更与 changelog 生成机制
WinPython 2.7.4.0 是该项目针对 Windows 平台发布的便携式 Python 科学计算发行版之一,其发行说明文档由两个互补文件构成:一份是完整的包清单(changelogs/WinPython-2.7.4.0.md),另一份是相对上一版 2.7.3.3 的变更记录(changelogs/WinPython-2.7.4.0_History.md)。本文以这两份文档为主体,完整继承其中的工具/Python 包清单与逐项版本变更,并结合当前仓库中 wppm 包管理器与构建脚本的源码,说明这类 changelog 与包索引是如何被解析、比对和重新生成的。读完本文,你可以掌握 WinPython 发行版的完整软件组成、2.7.4.0 相对前版的新增/升级/移除明细,以及发行说明文档背后的工具链原理。
发行版定位与文档构成
WinPython 的定位是"免安装、可随身携带"的 Windows Python 发行版,随包附带预编译的科学 Python 生态组件。仓库 README.rst 明确说明:WinPython 是面向 Windows 的 Python 便携发行版,而本仓库是 wppm(WinPython Package Manager)与构建工具链的源码仓库,而非发行版二进制本身。
2.7.4.0 这个版本号遵循 WinPython 的命名约定:2.7.4.0 表示所捆绑的 CPython 版本为 2.7.4,末位 0 是 release level(同 Python 小版本内的第几次重打包)。发行说明由两份文件组成:
- 主清单 changelogs/WinPython-2.7.4.0.md:声明 "The following packages are included in WinPython v2.7.4.0",分
Tools(独立工具)与Python packages(Python 软件包)两大节,以名称 || 版本 || 描述的表格形式逐一列出; - 变更史 changelogs/WinPython-2.7.4.0_History.md:声明 "The following changes were made to WinPython distribution since version 2.7.3.3",分
Internals(发行版内部机制)、Tools、Python packages(New / Upgraded / Removed)四部分,描述相对 2.7.3.3 的全部改动。
这种"完整快照 + 增量 diff"的双文件结构是整个 changelogs/ 目录的统一格式,也是仓库内比对工具能够自动工作的前提(见 wppm/diff.py 一节)。
内置工具(Tools)清单
2.7.4.0 内置了 4 个独立于 Python 解释器的工具,原文档逐条给出了名称、版本与用途说明,完整继承如下:
| 工具 | 版本 | 说明 |
|---|---|---|
| gettext | 0.14.4 | GNU gettext Win32 porting - the GNU translation tool(GNU 翻译工具的 Win32 移植,提供 pygettext 等实用工具,pygettext 为标准库模块) |
| SciTE | 3.2.3 | SCIntilla based Text Editor - Multilanguage, powerful and light-weight text editor(基于 Scintilla 的多语言轻量级文本编辑器) |
| TortoiseHg | 2.7.2 | Set of graphical tools and a shell extension for the Mercurial distributed revision control system(Mercurial 分布式版本控制系统的一套图形工具与 shell 扩展) |
| MinGW32 | 4.6.2 | (32-bit version only) Windows specific header files and import libraries, C/C++ and Fortran compilers(仅 32 位版提供;Windows 专用头文件与导入库,C/C++ 及 Fortran 编译器) |
需要注意两个限定条件:
- MinGW32 仅在 32 位发行版中提供(原文注明 "32-bit version only"),用于在没有完整 MSVC 环境时编译 C/Fortran 扩展;
- 这些工具对应发行包根目录下的独立子目录,与
python目录(Python 运行时)并列,构成 WinPython 典型的"工具目录 + Python 目录 + Scripts 启动器"的便携布局。
从当前仓库的构建源码看,这类工具目录是通过 winpython/make.py 中 WinPythonDistributionBuilder 的 tools_directories 参数从 winpython/portable/ 素材目录拷贝组装进最终发行包的;而发行版自身的"工具清单"在运行时则由 wppm/wppm.py 中 Distribution.get_package_index_data 调用的 utils.get_installed_tools 动态采集,再经 render_markdown_for_list 渲染为 ### Tools 小节。
Python 包完整清单
这是 2.7.4.0 文档的主体内容。原文档列出了 70 个 Python 包(含 1 个 Python 解释器本体),每个条目包含上游项目链接、精确版本号与一句话功能描述。为便于检索,下面按功能域分组完整列出,版本号与描述均忠实于原文档。
核心解释器与打包工具
| 包 | 版本 | 描述 |
|---|---|---|
| Python | 2.7.4 | Python programming language with standard library(Python 编程语言及标准库,本发行版的核心) |
| pip | 1.3.1 | A tool for installing and managing Python packages |
| distribute | 0.6.36 | Download, build, install, upgrade, and uninstall Python packages - easily |
| cx_Freeze | 4.3.1 | Deployment tool which converts Python scripts into stand-alone Windows executables(目标机器无需安装 Python 或其他库) |
| Cython | 0.19 | Cython is a language that makes writing C extensions for the Python language as easy as Python |
值得注意的历史细节:2.7.4.0 时期(2012 年前后),pip 1.3.1 与 distribute 0.6.36 并存于发行版——这是 setuptools/distribute 整合过渡期的典型快照;cx_Freeze 则体现了 WinPython"免安装"哲学的延伸:用户可以把脚本打成完全不依赖 Python 运行环境的独立 Windows 可执行文件。
科学计算与数值核心
| 包 | 版本 | 描述 |
|---|---|---|
| numpy-MKL | 1.7.1 | NumPy: multidimensional array processing for numbers, strings, records and objects (SciPy's core module)。注意这是捆绑 Intel MKL 的构建 |
| scipy | 0.12.0 | SciPy: Scientific Library for Python (advanced math, signal processing, optimization, statistics, ...) |
| pandas | 0.11.0 | Powerful data structures for data analysis, time series and statistics |
| numexpr | 2.1 | Fast evaluation of array expressions elementwise by using a vector-based virtual machine |
| scikit-learn | 0.13.1 | A set of Python modules for machine learning and data mining |
| scikit-image | 0.8.1 | Image processing toolbox for SciPy |
| sympy | 0.7.2 | Symbolic Mathematics Library |
| cvxopt | 1.1.5 | Convex optimization library |
| networkx | 1.7 | Python package for creating and manipulating graphs and networks |
| mahotas | 0.9.8 | Computer Vision library |
| PyWavelets | 0.2.2 | Wavelet transforms module |
| scikits.audiolab | 0.11.0 | Audio file I/O using NumPy arrays |
其中 numpy-MKL 1.7.1 是这一代 WinPython 的标志性组件:WinPython 曾长期提供基于 Intel Math Kernel Library 的 NumPy 构建以获得 BLAS/LAPACK 性能优势(仓库后续版本中也保留了 WinPythonblas-* 与 WinPythonmkl-* 等 flavor 的 changelog 文件,如 changelogs/WinPythonmkl-64bit-3.11.5.0.md)。
数据存储与 I/O
| 包 | 版本 | 描述 |
|---|---|---|
| h5py | 2.1.3 | General-purpose Python interface to HDF5 files(不同于 PyTables,h5py 直接访问完整的 HDF5 C 库) |
| tables | 3.0.0b1 | Package based on HDF5 library for managing hierarchical datasets (extremely large amounts of data) |
| pyhdf | 0.8.3 | Python interface to HDF4 files (Hierarchical Data Format version 4) |
| xlrd | 0.9.2 | Extract data from Microsoft Excel spreadsheet files |
| xlwt | 0.7.5 | Create spreadsheet files compatible with Microsoft Excel 97/2000/XP/2003 files, OpenOffice.org Calc, and Gnumeric |
| SQLAlchemy | 0.7.9 | SQL Toolkit and Object Relational Mapper |
| PyVISA | 1.3 | Control all kinds of measurement equipment through various busses (GPIB, RS232, USB) |
| PyVISA | 1.4 | Control all kinds of measurement equipment through various busses (GPIB, RS232, USB) |
| pyserial | 2.6 | Library encapsulating the access for the serial port |
| pydicom | 0.9.7 | Pure python package for working with DICOM files (medical imaging) |
| simplejson | 3.1.3 | Simple, fast, extensible JSON (JavaScript Object Notation) encoder/decoder |
HDF5 生态在此版本中完整覆盖:h5py(HDF5 直连)、tables 3.0.0b1(PyTables,层级大数据集管理)、pyhdf(HDF4),并配套下文提到的 ViTables 图形浏览器。tables 3.0.0b1 是 2.7.4.0 中唯一带 beta 后缀的组件(相对 2.7.3.3 的 2.4.0 是大幅升级)。原文档同时列出 PyVISA 1.3 与 1.4 两个版本条目,这是清单文档中少见的"双条目"现象,通常对应发行包内保留了新旧两版以便按需启用。
交互式环境与开发工具
| 包 | 版本 | 描述 |
|---|---|---|
| ipython | 0.13.2 | Enhanced Python shell |
| pyreadline | 2.0 | IPython needs this module to display color text in Windows command window |
| pyzmq | 13.1.0 | Lightweight and super-fast messaging based on ZeroMQ library (required for IPython Qt console) |
| tornado | 2.4.1 | Scalable, non-blocking web server and tools (required for IPython notebook) |
| spyder | 2.1.14dev4 | Scientific PYthon Development EnviRonment: designed for interactive computing and data visualisation with a simple and intuitive user interface |
| nose | 1.3.0 | nose is a discovery-based unittest extension (e.g. NumPy test module is using nose) |
| pylint | 0.26.0 | Logilab code analysis module: analyzes Python source code looking for bugs and signs of poor quality |
| logilab-astng | 0.24.1 | Rebuild a new abstract syntax tree from Python's ast (required for pylint) |
| logilab-common | 0.58.3 | Collection of low-level Python packages and modules used by Logilab projects (required for pylint) |
| Pygments | 1.6 | Generic syntax highlighter for general use in all kinds of software |
| psutil | 0.7.0 | Provides an interface for retrieving information on all running processes and system utilization (CPU, disk, memory, network) in a portable way |
这个组合勾勒出了 2012 年"交互式科学计算"的标准栈:Spyder 作为 IDE,IPython(0.13.2)提供增强 shell,IPython notebook 依赖 tornado 作为 web 后端、pyzmq 支撑 Qt console 的异步通信,pyreadline 则专门解决 Windows 控制台下的彩色输入问题——原文档对这三者的描述中都直接点明了依赖关系("required for IPython notebook / Qt console / Windows command window"),是理解当年组件间依赖链的一手材料。spyder 2.1.14dev4 的 dev4 后缀表明该发行版捆绑了 Spyder 的开发版构建。
GUI 框架与绘图
| 包 | 版本 | 描述 |
|---|---|---|
| PyQt | 4.9.6-1 | Cross-platform Application Framework: GUI, widgets, SQL, OpenGL, XML, Unicode... |
| PySide | 1.1.2 | Python binding of the cross-platform GUI toolkit Qt |
| PyQtdoc | 4.8.4 | PyQtdoc installs Qt documentation for PyQt4 |
| matplotlib | 1.2.1 | 2D plotting library (embeddable in GUIs created with PyQt) |
| PyQwt | 5.2.1 | 2D plotting library (set of Python bindings for the Qwt library featuring fast plotting) |
| guiqwt | 2.2.1 | Efficient curve/image plotting and other GUI tools for scientific data processing software development |
| formlayout | 1.0.9 | Module for creating form dialogs/widgets to edit various type of parameters without having to write any GUI code |
| guidata | 1.5.1 | Automatically generated graphical user interfaces for easy data set edition and display |
| PyOpenGL | 3.0.2 | Cross platform Python binding to OpenGL and related APIs |
| VPython | 5.74 | A free, open-source module for producing real-time 3D scenes with Python |
| VTK-Qt | 5.10.1 | Open-source software system for visualization, 3D graphics, volume rendering and image processing |
GUI 方面同时提供 PyQt 4.9.6-1 与 PySide 1.1.2 两套 Qt 绑定(其中 PySide 是 2.7.4.0 相对上一版新增的,见后文变更记录),绘图则覆盖三个层次:matplotlib(通用 2D 绘图,可嵌入 PyQt 界面)、PyQwt(基于 Qwt 的高速绘图绑定)、guiqwt(面向科学数据处理的高效曲线/图像绘制),另有 VPython 与 VTK-Qt 承担 3D/体渲染。formlayout 与 guidata 代表当年"零 GUI 代码生成界面"的流行思路。
图像处理、文档生成与系统工具
| 包 | 版本 | 描述 |
|---|---|---|
| Pillow | 2.0.0 | Python Imaging Library (fork) |
| egenix-mx-base | 3.2.5 | eGenix.com mx Base Distribution: mxDateTime, mxTextTools, mxProxy, mxBeeBase, mxURL, mxUID, mxStack, mxQueue and mxTools |
| docutils | 0.10 | Text processing system for processing plaintext documentation into useful formats, such as HTML or LaTeX (includes reStructuredText) |
| Jinja2 | 2.6 | Sandboxed template engine (provides a Django-like non-XML syntax and compiles templates into executable python code) |
| Sphinx | 1.1.3 | Tool for generating documentation which uses reStructuredText as its markup language |
| reportlab | 2.7 | The PDF generation library |
| rst2pdf | 0.93 | Tool for transforming reStructuredText to PDF using ReportLab |
| Scidoc | 1.7.1 | Scidoc installs scientific libraries documentation (NumPy, SciPy, ...) |
| ViTables | 2.1 | Graphical tool for browsing and editing files in both HDF5 and PyTables formats |
| pywin32 | 218 | Python library for Windows |
| winpython | 0.12 | WinPython distribution tools, including WPPM (package manager) |
这里包含两条值得注意的技术线索:
- Pillow 2.0.0 取代 PIL:Pillow 是 Python Imaging Library 的社区维护分支(fork),2.7.4.0 正是 WinPython 从官方 PIL 切换到 Pillow 的版本(见变更记录中 "Removed: PIL 1.1.7");
- 文档工具链自成一体:
docutils(reStructuredText 解析)+Sphinx(文档生成)+Jinja2(模板引擎)+reportlab/rst2pdf(PDF 输出)+Scidoc(NumPy/SciPy 官方文档安装包)共同构成"在离线便携环境中阅读与生成科学计算文档"的完整方案。
清单末行的 winpython 0.12 即发行版自举工具——发行包内自带的 winpython Python 包就是 WPPM 包管理器本身,与当前仓库 wppm/wppm.py 同源;2.7.4.0 中它相对上一版从 0.10 升级到 0.12,升级内容正对应下文 "Internals" 一节所述的功能。
相对 2.7.3.3 的版本变更(History 文档)
changelogs/WinPython-2.7.4.0_History.md 记录了相对 2.7.3.3 的全部变更,分为 Internals、Tools 与 Python packages(New/Upgraded/Removed)三块。
Internals:发行版内部机制变更
这部分描述的是 winpython Python 包(含 WPPM、WPCP 即 WinPython Control Panel)以及发行版生成脚本(make.py 及其依赖)的改动,完整继承如下:
- utils 新增
set_env与get_env函数(原文注明 "will be useful to fix Issue 35"):为发行版提供环境变量读写能力; - 发行版注册(Register)增强:
- 右键上下文菜单新增 "Edit with Spyder" 条目(要求 Spyder 2.2+);
- 新增"注销"流程:WinPython Control Panel 的 "Advanced" 菜单新增 "Unregister distribution..." 条目;
- Issue 19:通过重命名/删除
settings目录来禁用 settings 文件夹(%HOME% 重定向); - WinPython Control Panel(Issue 29):移除了内嵌的 Python (Spyder) 控制台;
- Batch scripts:移除了各批处理脚本中不必要的
cd %WINPYDIR%(该语句已不再需要); - 修复
register_python.bat:跟进命令行选项变更(这些变更由提交 9a62581ae693 引入); - py3compat 修复:解决
winreg/_winreg在非 Windows 平台引发的ImportError。
这批改动勾勒出 2.7.4.0 工具链的三条主线:系统注册/注销机制趋于完备(注册时挂右键菜单,注销时干净移除)、便携性细节打磨(settings 目录即 %HOME% 重定向点的可禁用、批处理脚本精简)、跨平台代码卫生(py3compat 对 winreg 的平台判断修复)。其中 %WINPYDIR% 环境变量是 WinPython 便携布局的锚点:批处理脚本与 Scripts 启动器都依赖它定位发行包根目录。
当前仓库中,make.py 的发行版构建逻辑仍由 winpython/make.py 承担(WinPythonDistributionBuilder 负责按 build_number、release_level、flavor 等参数组装发行包),各构建周期的锁定清单则存放于 winpython/portable 下的 cycle_* 目录(如 cycle_2025_04/pylock.64-3_13_7_0dot.toml 与对应的 requir.*.txt),体现了从当年 make.py 时代延续至今的"锁定文件定义发行版组成"的工程实践。
Tools 变更
仅一项升级:
- TortoiseHg 2.6 → 2.7.2
Python 包:新增(New packages)
共 8 个新进入发行版的包:
| 包 | 版本 | 描述 |
|---|---|---|
| cvxopt | 1.1.5 | Convex optimization library |
| PySide | 1.1.2 | Python binding of the cross-platform GUI toolkit Qt |
| simplejson | 3.1.3 | Simple, fast, extensible JSON (JavaScript Object Notation) encoder/decoder |
| pip | 1.3.1 | A tool for installing and managing Python packages |
| networkx | 1.7 | Python package for creating and manipulating graphs and networks |
| mahotas | 0.9.8 | Computer Vision library |
| VPython | 5.74 | A free, open-source module for producing real-time 3D scenes with Python |
| Pillow | 2.0.0 | Python Imaging Library (fork) |
其中 pip 1.3.1 首次入包具有里程碑意义:此前 WinPython 主要依赖 WPPM 与 distribute/setuptools 管理包,pip 的加入意味着发行版开始拥抱 PyPI 生态的标准安装入口;Pillow 与 PySide 的加入则分别补齐了图像库的现代替代品与 Qt 绑定的双选项。
Python 包:升级(Upgraded packages)
共 26 项升级,原文逐条给出 "旧版本 → 新版本":
| 包 | 版本变化 | 描述 |
|---|---|---|
| Python | 2.7.3 → 2.7.4 | Python programming language with standard library(解释器本体升级,即本次发行版的主线) |
| numpy-MKL | 1.6.2 → 1.7.1 | NumPy: multidimensional array processing (SciPy's core module) |
| scipy | 0.11.0 → 0.12.0 | SciPy: Scientific Library for Python |
| pandas | 0.10.1 → 0.11.0 | Powerful data structures for data analysis, time series and statistics |
| matplotlib | 1.2.0 → 1.2.1 | 2D plotting library (embeddable in GUIs created with PyQt) |
| scikit-image | 0.7.2 → 0.8.1 | Image processing toolbox for SciPy |
| scikit-learn | 0.13 → 0.13.1 | A set of Python modules for machine learning and data mining |
| tables | 2.4.0 → 3.0.0b1 | Package based on HDF5 library for managing hierarchical datasets |
| h5py | 2.1.1 → 2.1.3 | General-purpose Python interface to HDF5 files |
| ipython | 0.13.1 → 0.13.2 | Enhanced Python shell |
| pyzmq | 2.2.0.1 → 13.1.0 | Lightweight and super-fast messaging based on ZeroMQ library (required for IPython Qt console) |
| pyreadline | 1.7.1 → 2.0 | IPython needs this module to display color text in Windows command window |
| spyder | 2.1.12 → 2.1.14dev4 | Scientific PYthon Development EnviRonment |
| Cython | 0.17.4 → 0.19 | makes writing C extensions for Python as easy as Python |
| numexpr | 2.0.1 → 2.1 | Fast evaluation of array expressions elementwise |
| distribute | 0.6.33 → 0.6.36 | Download, build, install, upgrade, and uninstall Python packages |
| PyVISA | 1.3 → 1.4 | Control measurement equipment through various busses (GPIB, RS232, USB) |
| reportlab | 2.6 → 2.7 | The PDF generation library |
| rst2pdf | 0.92 → 0.93 | Tool for transforming reStructuredText to PDF using ReportLab |
| Scidoc | 1.6.2.1 → 1.7.1 | Scidoc installs scientific libraries documentation (NumPy, SciPy, ...) |
| psutil | 0.6.1 → 0.7.0 | Interface for retrieving process and system utilization information |
| Pygments | 1.5 → 1.6 | Generic syntax highlighter |
| nose | 1.2.1 → 1.3.0 | discovery-based unittest extension |
| xlrd | 0.8.0 → 0.9.2 | Extract data from Microsoft Excel spreadsheet files |
| xlwt | 0.7.4 → 0.7.5 | Create Excel-compatible spreadsheet files |
| winpython | 0.10 → 0.12 | WinPython distribution tools, including WPPM (package manager) |
升级面覆盖了"解释器 + 数值核心 + 交互环境 + 文档工具"全部四个层面,其中幅度最大的两项值得单独说明:
- numpy-MKL 1.6.2 → 1.7.1 与 scipy 0.11.0 → 0.12.0:这是典型的"随 Python 2.7.4 同步刷新科学计算栈"的重打包,MKL 版 NumPy 保证与 CPython 2.7.4 ABI 匹配且保留 Intel 数学库加速;
- pyzmq 2.2.0.1 → 13.1.0:版本号跳变巨大(ZeroMQ 系上游在 2012 年完成了从 C 版 libzmq 到 cppzmq 的切换并重置了版本序列),这是当年 IPython 0.13 新内核架构(基于 ZeroMQ 的客户端-内核-前端通信模型)落地所依赖的关键升级,与 ipython、spyder、tornado 的升级共同构成"IPython notebook 时代"的基础设施更新。
Python 包:移除(Removed packages)
仅一项:
- PIL 1.1.7(Python Imaging Library - (basic) Image processing library)被移除,由新增的 Pillow 2.0.0 接替。由于 Pillow 保持了
from PIL import Image的导入路径兼容,这是一次对用户代码近乎透明的库替换,也是 Python 图像生态史上的标志性节点。
源码视角:changelog 与包索引的生成、比对机制
前面所有清单与变更记录并非纯手工维护,当前仓库中的 wppm 工具链提供了与之对应的解析、生成与比对能力,理解这些实现可以更清楚地知道这些文档"从哪里来、如何校验"。
1. 包索引 Markdown 的生成:generate_package_index_markdown
wppm/wppm.py 中的 Distribution 类负责对一个 WinPython 发行目录执行各类操作,其 get_package_index_data(约 L83-L114)按三步采集数据:
- 通过
utils.get_python_infos解析发行包的 Python 版本与位数(my_ver、my_arch); - 通过
WINPYVER2、WINPYFLAVOR、WINPYVER环境变量识别发行版品牌、flavor(如dot、slim、free)与 release level; - 分别调用
utils.get_installed_tools(采集 Tools)、get_installed_packages(基于pip list采集 Python 包)以及wheelhouse.list_packages_with_metadata(扫描wheelhouse/included.wheels目录)。
随后 generate_package_index_markdown(L116-L132)将数据渲染为如下结构的 Markdown:
## {名称} {版本}
The following packages are included in {名称}-{位数}bit v{版本} {release_level}.
### Tools
Name | Version | Description
-----|---------|------------
...
### Python packages
...
### WheelHouse packages
...
这与 2.7.4.0 主清单文档 "The following packages are included in WinPython v2.7.4.0" 的开头句式和 Tools / Python packages 分节结构一脉相承——只是 2012 年的旧文档使用 reStructuredText 表格(|| 分隔)记录在 changelogs 中,而现代工具链直接输出 Markdown 管道表格,且比当年的清单多出一节 WheelHouse packages(随包附带的可离线安装 wheel)。也就是说,2.7.4.0 这份旧式清单是新版索引格式的历史原型。
2. 版本间 diff:wppm/diff.py 如何产出 History 文档
wppm/diff.py 正是 History 类文档的自动生成/比对工具,其核心机制:
- 行级解析:
Package.from_text(L21-L36)内置两组正则PATTERNS,分别匹配 SourceForge 风格与 Google Code 风格的[名称 版本] | 版本 | 描述行——这两组模式恰好对应 2010 年代 changelog 中[http://sourceforge.net/projects/gettext gettext]这类带链接文本的历史行格式; - 分节索引:
PackageIndex(L38-L59)以### Tools、### Python packages、### WheelHouse packages为节标题(HEADERS字典),把每行解析为(name, url, version, description)四元组并按名称归入对应节; - 三态比对:
compare_packages(L61-L74)先做名称归一化(小写、-转_),再计算出added(新增)、upgraded(同名称但版本不同)、removed(旧有而新无)三个集合,输出文本正是 History 文档中 "New packages:" / "Upgraded packages:" / "Removed packages:" 三段式,升级行按旧版本 → 新版本 (描述)格式书写; - 版本序列枚举:
changelog_versions(L129 起)扫描CHANGELOGS_DIR(即changelogs/目录,L19 处定义为仓库根下的changelogs),以文件名为唯一版本来源解析出版本序列。其 docstring 特别说明了历史教训:旧的正则只接受数字与点号,会静默丢弃3.14.7.1b1这类 PEP 440 带 release level 的版本号,导致 b1 changelog 在比对中不可见——现在改为交由 version 解析器处理,同时自动排除_History伴生文件。
这解释了两个格式细节:其一,changelogs/ 下每个 WinPython-X.Y.Z.N.md 都有一个 _History 伴生文件,比对工具依赖这一命名约定来区分"快照"与"增量";其二,升级方向性至关重要——index_title(L97-L107)用文件名在标题中写明 "Changes from A to B",避免读者把每一行升级误读为降级。
3. 安装动作如何影响清单:install 与可移动补丁
Distribution.install(wppm/wppm.py)在装入一个包后会执行 handle_specific_packages 与 patch_standard_packages 两个后处理步骤。后者(L176 起)体现了 WinPython"便携发行版"区别于普通 venv 的两个关键工程动作:
- pywin32 后处理:把
site-packages/pywin32_system32中的 DLL 拷贝到发行包根目录(因为便携包根目录在 PATH 上,DLL 才能被定位); - 可移动启动器补丁:修改
pip/_vendor/distlib/scripts.py中生成Scripts/*.exe启动器的 shebang 逻辑(executable = os.path.join(os.path.basename(get_executable()))形式,代码注释引用了 pip issue 2328 作为依据),使生成的启动器相对定位解释器、不写死绝对路径——这是 WinPython 整体可任意挂载(USB 盘、任意盘符)的根本保障。
回到 2.7.4.0 的语境:当时发行包内的 Scripts/ 下同样布满了这类可移动启动器(ipython、spyder、wppm 等),Internals 一节所述"移除批处理脚本中不必要的 cd %WINPYDIR%"正是这一可移动化改造在脚本层的收尾工作。
小结
WinPython 2.7.4.0 的两份 changelog 文档提供了该发行版的完整技术快照:
- 清单侧(changelogs/WinPython-2.7.4.0.md):4 个内置工具(gettext 0.14.4、SciTE 3.2.3、TortoiseHg 2.7.2、MinGW32 4.6.2 [仅 32 位])+ 70 项 Python 组件,核心是 CPython 2.7.4、numpy-MKL 1.7.1、scipy 0.12.0、ipython 0.13.2、spyder 2.1.14dev4、PyQt 4.9.6-1/PySide 1.1.2 双 GUI 栈,以及 Pillow 2.0.0、pip 1.3.1 等当年生态的关键节点版本;
- 变更侧(changelogs/WinPython-2.7.4.0_History.md):8 个新增包、26 项升级(含解释器 2.7.3 → 2.7.4 主线升级与 pyzmq 2.2.0.1 → 13.1.0 的大幅重构)、1 个移除(PIL 1.1.7 被 Pillow 接替),外加发行版注册/注销、settings 目录禁用、批处理脚本精简等内部机制改进;
- 机制侧:当前仓库 wppm/wppm.py 的包索引生成与 wppm/diff.py 的三态比对(新增/升级/移除)说明,这套"清单快照 + 增量 History"的双文档格式是有工具支撑的工程约定——2.7.4.0 时期的手写 reStructuredText 表格,正是今日自动渲染 Markdown 索引与自动 diff 的历史源头。
适用前提与限制:本文所有版本号、包名与变更条目均以仓库中 2.7.4.0 两份 changelog 文档为准,反映的是 2012 年前后的发行版状态;对应当前仓库中的 wppm/构建工具链要求 Python 3.10+(运行 wppm)与 3.11+(运行构建工具链),与 2.7.4.0 时代的 Python 2.7 运行环境不可混用。