CARVIEW |
Select Language
HTTP/2 200
date: Fri, 25 Jul 2025 06:56:59 GMT
server: Apache/2.4.41 (Ubuntu)
vary: Cookie,User-Agent,Accept-Encoding
set-cookie: MOIN_SESSION_443_ROOT_moin=cb46322566f9865fb119da7b7a065c1bc48e52ec; Expires=Fri, 25-Jul-2025 07:56:00 GMT; Max-Age=3600; Secure; Path=/
content-encoding: gzip
content-type: text/html; charset=utf-8
x-clacks-overhead: GNU Terry Pratchett
strict-transport-security: max-age=315360000; includeSubDomains; preload
Distutils/Extensions/SpecFileManipulation - Python Wiki
This extension of the bdist_rpm command shows how to modify the SPEC file before it is passed to the RPM shell command. It makes the Python version used to call "setup.py" known within the spec file, and also sets another prefix for the install step.
Note that you can use pre_install and post_install in your "setup.cfg" to add customized %pre and %post sections (those settings contain the names of files that are then appended to the SPEC file).
1 class bdist_rpm_ext(bdist_rpm):
2 """ Überladung von bdist_rpm, um das SPEC-File etwas zu erweitern.
3 """
4
5 def _make_spec_file(self):
6 spec_file = bdist_rpm._make_spec_file(self)
7 spec_file[0:0] = [
8 '%define pyversion ' + sys.version[:3],
9 ]
10
11 install = spec_file.index('%install')
12 spec_file[install+1] = spec_file[install+1].replace(
13 'setup.py install',
14 'setup.py install --prefix /opt/%{name}/%{version}')
15
16 return spec_file
Distutils/Extensions/SpecFileManipulation (last edited 2009-01-31 14:27:51 by 61)
Unable to edit the page? See the FrontPage for instructions.