Package buildbot :: Package monkeypatches
[frames] | no frames]

Source Code for Package buildbot.monkeypatches

 1  # This file is part of Buildbot.  Buildbot is free software: you can 
 2  # redistribute it and/or modify it under the terms of the GNU General Public 
 3  # License as published by the Free Software Foundation, version 2. 
 4  # 
 5  # This program is distributed in the hope that it will be useful, but WITHOUT 
 6  # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
 7  # FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more 
 8  # details. 
 9  # 
10  # You should have received a copy of the GNU General Public License along with 
11  # this program; if not, write to the Free Software Foundation, Inc., 51 
12  # Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 
13  # 
14  # Copyright Buildbot Team Members 
15   
16  import twisted 
17  from twisted.python import versions 
18  from buildbot.util import sautils 
19   
20  # NOTE: all of these patches test for applicability *before* importing the 
21  # patch module.  This will help cut down on unnecessary imports where the 
22  # patches are not needed, and also avoid problems with patches importing 
23  # private things in external libraries that no longer exist. 
24   
25 -def patch_bug4881():
26 # this patch doesn't apply (or even import!) on Windows 27 import sys 28 if sys.platform == 'win32': 29 return 30 31 # this bug was only present in Twisted-10.2.0 32 if twisted.version == versions.Version('twisted', 10, 2, 0): 33 from buildbot.monkeypatches import bug4881 34 bug4881.patch()
35
36 -def patch_bug4520():
37 # this bug was patched in twisted-11.1.0, and only affects py26 and up 38 import sys 39 py_26 = (sys.version_info[0] > 2 or 40 (sys.version_info[0] == 2 and sys.version_info[1] >= 6)) 41 if twisted.version < versions.Version('twisted', 11, 1, 0) and py_26: 42 from buildbot.monkeypatches import bug4520 43 bug4520.patch()
44
45 -def patch_bug5079():
46 # this bug will hopefully be patched in Twisted-12.0.0; it was probably 47 # present in Twisted-8.x.0, but the patch doesn't work 48 if (twisted.version < versions.Version('twisted', 12, 0, 0) and 49 twisted.version >= versions.Version('twisted', 9, 0, 0)): 50 from buildbot.monkeypatches import bug5079 51 bug5079.patch()
52
53 -def patch_sqlalchemy2364():
54 # fix for SQLAlchemy bug 2364 55 if sautils.sa_version() < (0,7,5): 56 from buildbot.monkeypatches import sqlalchemy2364 57 sqlalchemy2364.patch()
58
59 -def patch_sqlalchemy2189():
60 # fix for SQLAlchemy bug 2189 61 if sautils.sa_version() <= (0,7,1): 62 from buildbot.monkeypatches import sqlalchemy2189 63 sqlalchemy2189.patch()
64
65 -def patch_all(for_tests=False):
66 patch_bug4881() 67 patch_bug4520() 68 patch_bug5079() 69 patch_sqlalchemy2364() 70 patch_sqlalchemy2189() 71 72 if for_tests: 73 from buildbot.monkeypatches import servicechecks 74 servicechecks.patch_servicechecks() 75 from buildbot.monkeypatches import testcase_patch 76 testcase_patch.patch_testcase_patch()
77