|
16 | 16 | # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, |
17 | 17 | # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
18 | 18 | # |
19 | | -# $Id: setup.py,v 1.77.2.7 2005-03-03 22:12:35 richard Exp $ |
| 19 | +# $Id: setup.py,v 1.77.2.8 2005-04-07 07:24:43 a1s Exp $ |
20 | 20 |
|
21 | 21 | from distutils.core import setup, Extension |
22 | 22 | from distutils.util import get_platform |
23 | | -from distutils.command.build_scripts import build_scripts |
| 23 | +from distutils.file_util import write_file |
| 24 | +from distutils.command.bdist_rpm import bdist_rpm |
24 | 25 | from distutils.command.build import build |
| 26 | +from distutils.command.build_scripts import build_scripts |
25 | 27 | from distutils.command.build_py import build_py |
26 | 28 |
|
27 | 29 | import sys, os, string |
@@ -255,6 +257,30 @@ def run(self): |
255 | 257 | self.build_message_files() |
256 | 258 | build.run(self) |
257 | 259 |
|
| 260 | +class bdist_rpm_roundup(bdist_rpm): |
| 261 | + |
| 262 | + def finalize_options(self): |
| 263 | + bdist_rpm.finalize_options(self) |
| 264 | + if self.install_script: |
| 265 | + # install script is overridden. skip default |
| 266 | + return |
| 267 | + # install script option must be file name. |
| 268 | + # create the file in rpm build directory. |
| 269 | + install_script = os.path.join(self.rpm_base, "install.sh") |
| 270 | + self.mkpath(self.rpm_base) |
| 271 | + self.execute(write_file, (install_script, [ |
| 272 | + ("%s setup.py install --root=$RPM_BUILD_ROOT " |
| 273 | + "--record=ROUNDUP_FILES") % self.python, |
| 274 | + # allow any additional extension for man pages |
| 275 | + # (rpm may compress them to .gz or .bz2) |
| 276 | + # man page here is any file |
| 277 | + # with single-character extension |
| 278 | + # in man directory |
| 279 | + "sed -e 's,\(/man/.*\..\)$,\\1*,' " |
| 280 | + "<ROUNDUP_FILES >INSTALLED_FILES", |
| 281 | + ]), "writing '%s'" % install_script) |
| 282 | + self.install_script = install_script |
| 283 | + |
258 | 284 | ############################################################################# |
259 | 285 | ### Main setup stuff |
260 | 286 | ############################################################################# |
@@ -368,6 +394,7 @@ def main(): |
368 | 394 | 'build_scripts': build_scripts_roundup, |
369 | 395 | 'build_py': build_py_roundup, |
370 | 396 | 'build': build_roundup, |
| 397 | + 'bdist_rpm': bdist_rpm_roundup, |
371 | 398 | }, |
372 | 399 | 'scripts': roundup_scripts, |
373 | 400 |
|
|
0 commit comments