]>
Commit | Line | Data |
---|---|---|
1 | import distutils.command.bdist_rpm as orig | |
2 | ||
3 | from ..warnings import SetuptoolsDeprecationWarning | |
4 | ||
5 | ||
6 | class bdist_rpm(orig.bdist_rpm): | |
7 | """ | |
8 | Override the default bdist_rpm behavior to do the following: | |
9 | ||
10 | 1. Run egg_info to ensure the name and version are properly calculated. | |
11 | 2. Always run 'install' using --single-version-externally-managed to | |
12 | disable eggs in RPM distributions. | |
13 | """ | |
14 | ||
15 | def run(self): | |
16 | SetuptoolsDeprecationWarning.emit( | |
17 | "Deprecated command", | |
18 | """ | |
19 | bdist_rpm is deprecated and will be removed in a future version. | |
20 | Use bdist_wheel (wheel packages) instead. | |
21 | """, | |
22 | see_url="https://github.com/pypa/setuptools/issues/1988", | |
23 | due_date=(2023, 10, 30), # Deprecation introduced in 22 Oct 2021. | |
24 | ) | |
25 | ||
26 | # ensure distro name is up-to-date | |
27 | self.run_command('egg_info') | |
28 | ||
29 | orig.bdist_rpm.run(self) | |
30 | ||
31 | def _make_spec_file(self): | |
32 | spec = orig.bdist_rpm._make_spec_file(self) | |
33 | spec = [ | |
34 | line.replace( | |
35 | "setup.py install ", | |
36 | "setup.py install --single-version-externally-managed ", | |
37 | ).replace("%setup", "%setup -n %{name}-%{unmangled_version}") | |
38 | for line in spec | |
39 | ] | |
40 | return spec |