|
1 | 1 | { stdenv, pkgs, lib, fetchFromGitHub, |
2 | | - cython, buildPythonPackage, setuptools, |
| 2 | + cython, python, buildPythonPackage, setuptools, |
3 | 3 | openafs, libkrb5, |
4 | 4 | }: |
5 | 5 |
|
@@ -34,6 +34,27 @@ in buildPythonPackage { |
34 | 34 | "afs" |
35 | 35 | ]; |
36 | 36 |
|
| 37 | + env = lib.optionalAttrs (python.pythonAtLeast "3.13") { |
| 38 | + # Workaround for https://github.com/mit-athena/python-afs/issues/6 |
| 39 | + # Can probably be removed in 3.15 or maybe 3.14 |
| 40 | + |
| 41 | + # Without this hack, Python and OpenAFS have competing lock.h files, and we |
| 42 | + # need OpenAFS's to win but Python's does win. Until Python 3.15 comes out, |
| 43 | + # we force OpenAFS's headers to come before Python's when building |
| 44 | + # python-afs. This is a little tricky, because Python's headers use -I by |
| 45 | + # default while OpenAFS's use -isystem, and -I headers all come before |
| 46 | + # -isystem ones. However, if we add Python headers with -isystem at the |
| 47 | + # start of the compiler command, Python's -I will be treated as a dup of a |
| 48 | + # system header, and Python's headers will be moved to the system section |
| 49 | + # of the search path. *However*, because they're at the *start* of the |
| 50 | + # search path, they'll still beat OpenAFS, so we need to also add -isystem |
| 51 | + # for OpenAFS at the start of the compiler command, so the relative order |
| 52 | + # among the system section is correct. |
| 53 | + |
| 54 | + NIX_CFLAGS_COMPILE="-isystem${openafs.dev}/include -isystem${python}/include/python${python.pythonVersion}"; |
| 55 | + #NIX_DEBUG="1"; |
| 56 | + }; |
| 57 | + |
37 | 58 | # The tests assume that we have AFS installed and working on the machine |
38 | 59 | # (e.g., they access files in AFS, expect ThisCell to be set, etc.), so |
39 | 60 | # skip them. |
|
0 commit comments