Ticket #1696: make-some-rpms-1696-2.patch

File make-some-rpms-1696-2.patch, 8.2 KB (added by TimAllen, 10 years ago)

Yet another attempt at making bdist_rpm work, with dependencies.

  • new file MANIFEST.in

    diff --git a/MANIFEST.in b/MANIFEST.in
    new file mode 100644
    index 0000000..caf8765
    - +  
     1exclude rpm-post-install
     2exclude bin/admin/*
     3
     4# Include TwistedCore's extension-definitions in the sdist package, so they'll
     5# be available for bdist_rpm to read.
     6include twisted/topfiles/setup.py
  • deleted file dmin/twisted.spec

    diff --git a/admin/twisted.spec b/admin/twisted.spec
    deleted file mode 100644
    index ef0f21e..0000000
    + -  
    1 %define name     Twisted
    2 %define version  SVN-trunk
    3 %define release  1tummy
    4 %define prefix   %{_prefix}
    5 %define py_libver 2.3
    6 
    7 Summary:        Twisted is an event-based framework for internet applications.
    8 Name:           %{name}
    9 Version:        %{version}
    10 Release:        %{release}
    11 Source:         %{name}-%{version}.tar.bz2
    12 License:        MIT
    13 Group:          System/Libraries
    14 URL:            http://www.twistedmatrix.com/
    15 Requires:       python >= %{py_libver}
    16 BuildRequires:  python-devel
    17 BuildRoot:      %{_tmppath}/%{name}-buildroot
    18 Prefix:         %{_prefix}
    19 
    20 %description
    21 Twisted is an event-based framework for internet applications.  It includes a
    22 web server, a telnet server, a chat server, a news server, a generic client
    23 and server for remote object access, and APIs for creating new protocols and
    24 services. Twisted supports integration of the Tk, GTK+, Qt or wxPython event
    25 loop with its main event loop. The Win32 event loop is also supported, as is
    26 basic support for running servers on top of Jython.
    27 
    28 %package doc
    29 Summary: Twisted documentation and example programs
    30 Group: Development/Python
    31 %description doc
    32 Twisted is an event-based framework for internet applications.
    33 Install Twisted-doc if you need the API documentation and example programs.
    34 
    35 %prep
    36 %setup -n %{name}-%{version}
    37 %build
    38 
    39 %install
    40 [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
    41 mkdir -p "$RPM_BUILD_ROOT"
    42 
    43 python setup.py install --optimize=2 --record=installed-files \
    44       --root="$RPM_BUILD_ROOT"
    45 
    46 #  install man pages
    47 mkdir -p "$RPM_BUILD_ROOT"/%{_mandir}/man1/
    48 cp -a doc/man/*.1 "$RPM_BUILD_ROOT"/%{_mandir}/man1/
    49 
    50 %clean
    51 [ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf "$RPM_BUILD_ROOT"
    52 
    53 %files
    54 %defattr(755,root,root)
    55 %doc CREDITS LICENSE README
    56 %{_bindir}/*
    57 %attr(644,-,-) %{_mandir}/man1/*
    58 %{_libdir}/python%{py_libver}/site-packages/twisted/
    59 
    60 %files doc
    61 %defattr(-,root,root)
    62 %doc doc/*
  • new file rpm-post-install

    diff --git a/rpm-post-install b/rpm-post-install
    new file mode 100644
    index 0000000..45ea373
    - +  
     1#!/bin/sh
     2#
     3#  Create cache files.
     4
     5python -c 'from twisted.plugin import IPlugin, getPlugins; list(getPlugins(IPlugin))'
  • new file setup.cfg

    diff --git a/setup.cfg b/setup.cfg
    new file mode 100644
    index 0000000..2def89c
    - +  
     1[bdist_rpm]
     2post-install = rpm-post-install
     3
     4# Some RPM-based distributions configure RPM to automatically create .pyo files
     5# when .py files are installed, but don't configure bdist_rpm to add .pyo files
     6# to the list-of-files-to-be-installed. Since RPM will exit with an error if
     7# files are installed that aren't in the list-of-files-to-be-installed, this
     8# prevents bdist_rpm from working. This has been a problem for a very long time
     9# (at least since Fedora 6, if not before), but is due to be fixed in Fedora
     10# 11, with the same workaround we present here. For more details, see the
     11# upstream Fedora bug:
     12#
     13#   https://bugzilla.redhat.com/show_bug.cgi?id=236535
     14#
     15[install]
     16optimize = 1
  • setup.py

    diff --git a/setup.py b/setup.py
    index c8b5877..f0f05d7 100755
    a b on event-based network programming and multiprotocol integration. 
    7373            conditionalExtensions = getExtensions(),
    7474            scripts = scripts,
    7575            data_files=getDataFiles('twisted'),
     76            options = {
     77                    'bdist_rpm': {
     78                        'requires': [
     79                            'python >= 2.3',
     80                            'python-zope-interface >= 3.0.1',
     81                        ],
     82                    },
     83                },
    7684            )
    7785
    7886    if 'setuptools' in sys.modules:
  • twisted/test/generator_failure_tests.py

    diff --git a/twisted/test/generator_failure_tests.py b/twisted/test/generator_failure_tests.py
    index 8c31c27..89a017f 100644
    a b from twisted.internet import defer 
    1818
    1919class TwoPointFiveFailureTests(TestCase):
    2020
     21    if sys.version_info[0] <= 2 and sys.version_info[1] <= 4:
     22        # Running these tests will raise all kinds of errors on versions before
     23        # 2.5, so skip the whole lot. Note that examples of syntax introduce in
     24        # 2.5 have to be wrapped in exec so that this file doesn't cause Python
     25        # 2.4 to die with a SyntaxError when it tries to parse the file.
     26        skip = "generator_failure_tests require Python 2.5"
     27
    2128    def test_inlineCallbacksTracebacks(self):
    2229        """
    2330        inlineCallbacks that re-raise tracebacks into their deferred
    class TwoPointFiveFailureTests(TestCase): 
    6168        represents into a generator.
    6269        """
    6370        stuff = []
    64         def generator():
    65             try:
    66                 yield
    67             except:
    68                 stuff.append(sys.exc_info())
    69             else:
    70                 self.fail("Yield should have yielded exception.")
     71        exec """
     72            def generator():
     73                try:
     74                    yield
     75                except:
     76                    stuff.append(sys.exc_info())
     77                else:
     78                    self.fail("Yield should have yielded exception.")
     79            """
    7180        g = generator()
    7281        f = getDivisionFailure()
    7382        g.next()
    class TwoPointFiveFailureTests(TestCase): 
    8998        f.cleanFailure()
    9099
    91100        foundFailures = []
    92         def generator():
    93             try:
    94                 yield
    95             except:
    96                 foundFailures.append(Failure._findFailure())
    97             else:
    98                 self.fail("No exception sent to generator")
     101        exec """
     102            def generator():
     103                try:
     104                    yield
     105                except:
     106                    foundFailures.append(Failure._findFailure())
     107                else:
     108                    self.fail("No exception sent to generator")
     109            """
    99110
    100111        g = generator()
    101112        g.next()
    class TwoPointFiveFailureTests(TestCase): 
    116127
    117128        newFailures = []
    118129
    119         def generator():
    120             try:
    121                 yield
    122             except:
    123                 newFailures.append(Failure())
    124             else:
    125                 self.fail("No exception sent to generator")
     130        exec """
     131            def generator():
     132                try:
     133                    yield
     134                except:
     135                    newFailures.append(Failure())
     136                else:
     137                    self.fail("No exception sent to generator")
     138            """
    126139        g = generator()
    127140        g.next()
    128141        self._throwIntoGenerator(f, g)
    class TwoPointFiveFailureTests(TestCase): 
    136149        L{Failure._findFailure} inside the generator should find the reraised
    137150        exception rather than original one.
    138151        """
    139         def generator():
    140             try:
     152        exec """
     153            def generator():
    141154                try:
    142                     yield
     155                    try:
     156                        yield
     157                    except:
     158                        [][1]
    143159                except:
    144                     [][1]
    145             except:
    146                 self.assertIsInstance(Failure().value, IndexError)
     160                    self.assertIsInstance(Failure().value, IndexError)
     161            """
    147162        g = generator()
    148163        g.next()
    149164        f = getDivisionFailure()
    class TwoPointFiveFailureTests(TestCase): 
    155170        L{Failure._findFailure} above the generator should find the reraised
    156171        exception rather than original one.
    157172        """
    158         def generator():
    159             try:
    160                 yield
    161             except:
    162                 [][1]
     173        exec """
     174            def generator():
     175                try:
     176                    yield
     177                except:
     178                    [][1]
     179            """
    163180        g = generator()
    164181        g.next()
    165182        f = getDivisionFailure()