Please note: This wiki is currently running in test mode after an attack on January 5 2013. All passwords were reset, so you will have to use the password recovery function to get a new password. To edit wiki pages, please log in first. See the wiki attack description page for more details. If you find problems, please report them to the pydotorg-www mailing list.

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 AkiraKitada)