12 hatch-fancy-pypi-readme,
23 # optional-dependencies
36 cython-test-exception-raiser,
56 buildPythonPackage rec {
61 disabled = pythonOlder "3.6";
64 inherit pname version;
66 hash = "sha256-WmAUfwRBh6En7H2pbRcNSbzOUMb9NvWU5g9Fh+/005Q=";
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=";
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=";
85 __darwinAllowLocalNetworking = true;
89 hatch-fancy-pypi-readme
93 propagatedBuildInputs = [
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
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
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
119 echo 'FileDescriptorTests.test_expectedFDs.skip = "Expected duplicate file descriptor to be greater than original"' >> src/twisted/internet/test/test_posixprocess.py
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
126 # fails since migrating to libxcrypt
127 echo 'HelperTests.test_refuteCryptedPassword.skip = "OSError: Invalid argument"' >> src/twisted/conch/test/test_checkers.py
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
133 # tests for missing https support in usage
134 echo 'ServiceTests.test_HTTPSFailureOnMissingSSL.skip = "Expectation Mismatch"' >> src/twisted/web/test/test_tap.py
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
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
145 substituteInPlace src/twisted/test/test_failure.py \
146 --replace "from cython_test_exception_raiser import raiser # type: ignore[import]" "raiser = None"
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
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'"
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
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
175 cython-test-exception-raiser
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
186 !(stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64)
187 ) optional-dependencies.tls;
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
196 optional-dependencies = {
207 serial = [ pyserial ];
229 inherit (nixosTests) buildbot matrix-synapse;
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;