# 构建系统:setuptools.build_meta + setup.py(pyproject.toml 存在但 build-backend=setuptools.build_meta) # topdir: python-scapy-2.7.0(由 --transform 重命名,与 %%autosetup -n %%{name}-%%{version} 对齐) %global pypi_name scapy Name: python-%{pypi_name} Version: 2.7.0 Release: 1%{?dist} Summary: Interactive packet manipulation tool License: GPL-2.0-only URL: https://github.com/secdev/scapy Source0: https://github.com/secdev/scapy/archive/refs/tags/v%{version}/%{name}-%{version}.tar.gz BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-setuptools >= 62.0.0 %description Scapy is a powerful Python-based interactive packet manipulation program and library. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, store or read them using pcap files, match requests and replies, and much more. It is designed to allow fast packet prototyping by using default values that work. %package -n python3-%{pypi_name} Summary: Interactive packet manipulation tool Provides: python-%{pypi_name} Provides: python3dist(%{pypi_name}) = %{version} %description -n python3-%{pypi_name} Scapy is a powerful Python-based interactive packet manipulation program and library. It is able to forge or decode packets of a wide number of protocols, send them on the wire, capture them, store or read them using pcap files, match requests and replies, and much more. It is designed to allow fast packet prototyping by using default values that work. %package help Summary: Development documents and examples for %{pypi_name} Requires: python3-%{pypi_name} Provides: python3-%{pypi_name}-doc %description help Scapy is a powerful Python-based interactive packet manipulation program and library. This package contains development documents and examples for Scapy. %prep %autosetup -n %{name}-%{version} -p1 %build # scapy 版本通过 _version() 动态检测(SCAPY_VERSION 环境变量 > VERSION 文件 > git archive > git describe > 文件修改日期)。 # tarball 无 .git 元数据也无 VERSION 文件,须通过 SCAPY_VERSION 环境变量强制指定版本,否则回退到文件修改日期导致版本号错误。 export SCAPY_VERSION=%{version} %py3_build %install export SCAPY_VERSION=%{version} %py3_install %files -n python3-%{pypi_name} %license LICENSE %{python3_sitelib}/scapy/ %{python3_sitelib}/scapy-%{version}*.egg-info/ %{_bindir}/scapy %{_mandir}/man1/scapy.1* %files help %license LICENSE %doc README.md %changelog * Tue Sep 29 2026 Python_Bot - 2.7.0-1 - Initial package