Skip to content

Commit c797fe0

Browse files
author
Alexander Smishlajev
committed
fix bdist_rpm [SF#1164328]
1 parent fd82fa8 commit c797fe0

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

setup.py

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@
1616
# BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
1717
# SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
1818
#
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 $
2020

2121
from distutils.core import setup, Extension
2222
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
2425
from distutils.command.build import build
26+
from distutils.command.build_scripts import build_scripts
2527
from distutils.command.build_py import build_py
2628

2729
import sys, os, string
@@ -255,6 +257,30 @@ def run(self):
255257
self.build_message_files()
256258
build.run(self)
257259

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+
258284
#############################################################################
259285
### Main setup stuff
260286
#############################################################################
@@ -368,6 +394,7 @@ def main():
368394
'build_scripts': build_scripts_roundup,
369395
'build_py': build_py_roundup,
370396
'build': build_roundup,
397+
'bdist_rpm': bdist_rpm_roundup,
371398
},
372399
'scripts': roundup_scripts,
373400

0 commit comments

Comments
 (0)