Skip to content

Commit

Permalink
Fix for Ticket twisted#1696, bdist_rpm failures particular on Python …
Browse files Browse the repository at this point in the history
…<= 2.3.

git-svn-id: svn://svn.twistedmatrix.com/svn/Twisted/trunk@26608 bbbe8e31-12d6-0310-92fd-ac37d47ddeeb
  • Loading branch information
jafo committed Apr 1, 2009
1 parent 5bb6ca5 commit cd2b579
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions Manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
exclude rpm-post-install
5 changes: 5 additions & 0 deletions rpm-post-install
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
#
# Create cache files.

python -c 'from twisted.plugin import IPlugin, getPlugins; list(getPlugins(IPlugin))'
5 changes: 5 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[bdist_rpm]
post-install = rpm-post-install

[install]
optimize = 1
30 changes: 30 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,30 @@
import sys, os


# remove the generator_failure_tests.py test which fails on Python 2.3
# with a syntax error
from distutils.command.sdist import sdist as _sdist
class twisted_sdist(_sdist):
def run(self):
from distutils.filelist import FileList
self.filelist = FileList()
self.check_metadata()
self.get_file_list()
self.filelist.files.remove('twisted/test/generator_failure_tests.py')
if self.manifest_only: return
self.make_distribution()


# some unpackaged files are being installed, work around that.
# For example, see: https://bugzilla.redhat.com/show_bug.cgi?id=198877#c1
from distutils.command.bdist_rpm import bdist_rpm as _bdist_rpm
class twisted_bdist_rpm(_bdist_rpm):
def _make_spec_file(self):
spec_file = _bdist_rpm._make_spec_file(self)
spec_file.insert(0, '%define _unpackaged_files_terminate_build 0')
return(spec_file)


def getExtensions():
"""
Get all extensions from core and all subprojects.
Expand Down Expand Up @@ -89,6 +113,12 @@ def main(args):
setup_args['install_requires'] = requirements
setup_args['include_package_data'] = True
setup_args['zip_safe'] = False

# Python v2.3 and lower...
if sys.version_info[0] <= 2 and sys.version_info[1] <= 3:
setup_args['cmdclass'] = { 'sdist' : twisted_sdist,
'bdist_rpm' : twisted_bdist_rpm }

setup(**setup_args)


Expand Down

0 comments on commit cd2b579

Please sign in to comment.