Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 240 lines 8.9 kB view raw
1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 fetchPypi, 7 fetchpatch, 8 python, 9 10 # build-system 11 hatchling, 12 hatch-fancy-pypi-readme, 13 14 # dependencies 15 attrs, 16 automat, 17 constantly, 18 hyperlink, 19 incremental, 20 typing-extensions, 21 zope-interface, 22 23 # optional-dependencies 24 appdirs, 25 bcrypt, 26 cryptography, 27 h2, 28 idna, 29 priority, 30 pyasn1, 31 pyopenssl, 32 pyserial, 33 service-identity, 34 35 # tests 36 cython-test-exception-raiser, 37 git, 38 glibcLocales, 39 pyhamcrest, 40 hypothesis, 41 42 # for passthru.tests 43 cassandra-driver, 44 klein, 45 magic-wormhole, 46 scrapy, 47 treq, 48 txaio, 49 txamqp, 50 txrequests, 51 txtorcon, 52 thrift, 53 nixosTests, 54}: 55 56buildPythonPackage rec { 57 pname = "twisted"; 58 version = "24.7.0"; 59 format = "pyproject"; 60 61 disabled = pythonOlder "3.6"; 62 63 src = fetchPypi { 64 inherit pname version; 65 extension = "tar.gz"; 66 hash = "sha256-WmAUfwRBh6En7H2pbRcNSbzOUMb9NvWU5g9Fh+/005Q="; 67 }; 68 69 patches = [ 70 (fetchpatch { 71 # Conditionally skip tests that require METHOD_CRYPT 72 # https://github.com/twisted/twisted/pull/11827 73 url = "https://github.com/mweinelt/twisted/commit/e69e652de671aac0abf5c7e6c662fc5172758c5a.patch"; 74 hash = "sha256-LmvKUTViZoY/TPBmSlx4S9FbJNZfB5cxzn/YcciDmoI="; 75 }) 76 77 (fetchpatch { 78 name = "python-3.12.6.patch"; 79 url = "https://github.com/twisted/twisted/commit/3422f7988e3d42e6e5184acd65f103fd28750648.patch"; 80 excludes = [ ".github/workflows/test.yaml" ]; 81 hash = "sha256-/UmrHdWaApytkEDZiISjPGzpWv/Yxe/xjvr9GOjMPmQ="; 82 }) 83 ]; 84 85 __darwinAllowLocalNetworking = true; 86 87 nativeBuildInputs = [ 88 hatchling 89 hatch-fancy-pypi-readme 90 incremental 91 ]; 92 93 propagatedBuildInputs = [ 94 attrs 95 automat 96 constantly 97 hyperlink 98 incremental 99 typing-extensions 100 zope-interface 101 ]; 102 103 postPatch = 104 '' 105 echo 'ListingTests.test_localeIndependent.skip = "Timezone issue"'>> src/twisted/conch/test/test_cftp.py 106 echo 'ListingTests.test_newFile.skip = "Timezone issue"'>> src/twisted/conch/test/test_cftp.py 107 echo 'ListingTests.test_newSingleDigitDayOfMonth.skip = "Timezone issue"'>> src/twisted/conch/test/test_cftp.py 108 echo 'ListingTests.test_oldFile.skip = "Timezone issue"'>> src/twisted/conch/test/test_cftp.py 109 echo 'ListingTests.test_oldSingleDigitDayOfMonth.skip = "Timezone issue"'>> src/twisted/conch/test/test_cftp.py 110 111 echo 'WrapClientTLSParserTests.test_tls.skip = "pyopenssl update"' >> src/twisted/internet/test/test_endpoints.py 112 echo 'UNIXTestsBuilder_AsyncioSelectorReactorTests.test_sendFileDescriptorTriggersPauseProducing.skip = "sendFileDescriptor producer was not paused"'>> src/twisted/internet/test/test_unix.py 113 echo 'UNIXTestsBuilder_SelectReactorTests.test_sendFileDescriptorTriggersPauseProducing.skip = "sendFileDescriptor producer was not paused"'>> src/twisted/internet/test/test_unix.py 114 115 echo 'FileObserverTests.test_getTimezoneOffsetEastOfUTC.skip = "mktime argument out of range"'>> src/twisted/test/test_log.py 116 echo 'FileObserverTests.test_getTimezoneOffsetWestOfUTC.skip = "mktime argument out of range"'>> src/twisted/test/test_log.py 117 echo 'FileObserverTests.test_getTimezoneOffsetWithoutDaylightSavingTime.skip = "tuple differs, values not"'>> src/twisted/test/test_log.py 118 119 echo 'FileDescriptorTests.test_expectedFDs.skip = "Expected duplicate file descriptor to be greater than original"' >> src/twisted/internet/test/test_posixprocess.py 120 121 echo 'MulticastTests.test_joinLeave.skip = "No such device"'>> src/twisted/test/test_udp.py 122 echo 'MulticastTests.test_loopback.skip = "No such device"'>> src/twisted/test/test_udp.py 123 echo 'MulticastTests.test_multicast.skip = "Reactor was unclean"'>> src/twisted/test/test_udp.py 124 echo 'MulticastTests.test_multiListen.skip = "No such device"'>> src/twisted/test/test_udp.py 125 126 # fails since migrating to libxcrypt 127 echo 'HelperTests.test_refuteCryptedPassword.skip = "OSError: Invalid argument"' >> src/twisted/conch/test/test_checkers.py 128 129 # expectation mismatch with `python -m twisted --help` and `python -m twisted.trial --help` usage output 130 echo 'MainTests.test_twisted.skip = "Expectation Mismatch"' >> src/twisted/test/test_main.py 131 echo 'MainTests.test_trial.skip = "Expectation Mismatch"' >> src/twisted/test/test_main.py 132 133 # tests for missing https support in usage 134 echo 'ServiceTests.test_HTTPSFailureOnMissingSSL.skip = "Expectation Mismatch"' >> src/twisted/web/test/test_tap.py 135 136 # fail on Python 3.12 137 echo 'WorkerReporterTests.test_addSkipPyunit.skip = "'WorkerReporter' object has no attribute '_testStarted'"' >> src/twisted/trial/_dist/test/test_workerreporter.py 138 echo 'LocalWorkerAMPTests.test_runSkip.skip = "twisted.protocols.amp.UnknownRemoteError: Code<UNKNOWN>: Unknown Error"' >> src/twisted/trial/_dist/test/test_worker.py 139 140 # https://github.com/twisted/twisted/issues/12194 141 echo 'FlattenerErrorTests.test_asynchronousFlattenError.skip = "builtins.KeyError: 'root'"' >> src/twisted/web/test/test_flatten.py 142 echo 'FlattenerErrorTests.test_cancel.skip = "builtins.KeyError: 'root'"' >> src/twisted/web/test/test_flatten.py 143 144 # not packaged 145 substituteInPlace src/twisted/test/test_failure.py \ 146 --replace "from cython_test_exception_raiser import raiser # type: ignore[import]" "raiser = None" 147 '' 148 + lib.optionalString stdenv.hostPlatform.isLinux '' 149 echo 'PTYProcessTestsBuilder_EPollReactorTests.test_openFileDescriptors.skip = "invalid syntax"'>> src/twisted/internet/test/test_process.py 150 echo 'PTYProcessTestsBuilder_PollReactorTests.test_openFileDescriptors.skip = "invalid syntax"'>> src/twisted/internet/test/test_process.py 151 echo 'UNIXTestsBuilder_EPollReactorTests.test_sendFileDescriptorTriggersPauseProducing.skip = "sendFileDescriptor producer was not paused"'>> src/twisted/internet/test/test_unix.py 152 echo 'UNIXTestsBuilder_PollReactorTests.test_sendFileDescriptorTriggersPauseProducing.skip = "sendFileDescriptor producer was not paused"'>> src/twisted/internet/test/test_unix.py 153 154 # Patch t.p._inotify to point to libc. Without this, 155 # twisted.python.runtime.platform.supportsINotify() == False 156 substituteInPlace src/twisted/python/_inotify.py --replace \ 157 "ctypes.util.find_library(\"c\")" "'${stdenv.cc.libc}/lib/libc.so.6'" 158 '' 159 + lib.optionalString stdenv.hostPlatform.isDarwin '' 160 echo 'ProcessTestsBuilder_AsyncioSelectorReactorTests.test_openFileDescriptors.skip = "invalid syntax"'>> src/twisted/internet/test/test_process.py 161 echo 'ProcessTestsBuilder_SelectReactorTests.test_openFileDescriptors.skip = "invalid syntax"'>> src/twisted/internet/test/test_process.py 162 echo 'ProcessTestsBuilder_AsyncioSelectorReactorTests.test_processEnded.skip = "exit code 120"' >> src/twisted/internet/test/test_process.py 163 echo 'ProcessTestsBuilder_SelectReactorTests.test_processEnded.skip = "exit code 120"' >> src/twisted/internet/test/test_process.py 164 ''; 165 166 # Generate Twisted's plug-in cache. Twisted users must do it as well. See 167 # http://twistedmatrix.com/documents/current/core/howto/plugin.html#auto3 168 # and http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=477103 for details. 169 postFixup = lib.optionalString (stdenv.buildPlatform.canExecute stdenv.hostPlatform) '' 170 $out/bin/twistd --help > /dev/null 171 ''; 172 173 nativeCheckInputs = 174 [ 175 cython-test-exception-raiser 176 git 177 glibcLocales 178 hypothesis 179 pyhamcrest 180 ] 181 ++ optional-dependencies.conch 182 ++ optional-dependencies.http2 183 ++ optional-dependencies.serial 184 # not supported on aarch64-darwin: https://github.com/pyca/pyopenssl/issues/873 185 ++ lib.optionals ( 186 !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) 187 ) optional-dependencies.tls; 188 189 checkPhase = '' 190 export SOURCE_DATE_EPOCH=315532800 191 export PATH=$out/bin:$PATH 192 # race conditions when running in paralell 193 ${python.interpreter} -m twisted.trial -j1 twisted 194 ''; 195 196 optional-dependencies = { 197 conch = [ 198 appdirs 199 bcrypt 200 cryptography 201 pyasn1 202 ]; 203 http2 = [ 204 h2 205 priority 206 ]; 207 serial = [ pyserial ]; 208 tls = [ 209 idna 210 pyopenssl 211 service-identity 212 ]; 213 }; 214 215 passthru = { 216 tests = { 217 inherit 218 cassandra-driver 219 klein 220 magic-wormhole 221 scrapy 222 treq 223 txaio 224 txamqp 225 txrequests 226 txtorcon 227 thrift 228 ; 229 inherit (nixosTests) buildbot matrix-synapse; 230 }; 231 }; 232 233 meta = with lib; { 234 changelog = "https://github.com/twisted/twisted/blob/twisted-${version}/NEWS.rst"; 235 homepage = "https://github.com/twisted/twisted"; 236 description = "Asynchronous networking framework written in Python"; 237 license = licenses.mit; 238 maintainers = [ ]; 239 }; 240}