Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(pyodbc): manually add search path for unixODBC shared libs #1412

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions overrides/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2306,6 +2306,14 @@ lib.composeManyExtensions [
++ [ pkgs.freetds ];
});

pyodbc = super.pyodbc.overridePythonAttrs (
old: lib.optionalAttrs ((old.src.isWheel or false) && stdenv.isLinux) {
preFixup = old.preFixup or "" + ''
addAutoPatchelfSearchPath ${pkgs.unixODBC}
'';
}
);

pyopencl = super.pyopencl.overridePythonAttrs (
old: {
nativeBuildInputs = (old.nativeBuildInputs or [ ]) ++ [ self.numpy ];
Expand Down
1 change: 1 addition & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ in
orjson-test = callTest ./orjson-test { };
ruff = callTest ./ruff { };
colour = callTest ./colour { };
pyodbc-wheel = callTest ./pyodbc-wheel { };
} // lib.optionalAttrs (!stdenv.isDarwin) {
# pyqt5 = (callTest ./pyqt5 { });
pyqt6 = callTest ./pyqt6 { };
Expand Down
13 changes: 13 additions & 0 deletions tests/pyodbc-wheel/default.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{ poetry2nix, python3, runCommand }:
let
env = poetry2nix.mkPoetryEnv {
python = python3;
pyproject = ./pyproject.toml;
poetrylock = ./poetry.lock;
preferWheels = true;
};
in
assert env.python.pkgs.pyodbc.src.isWheel; runCommand "pyodbc-wheel-test" { } ''
${env}/bin/python -c 'import pyodbc'
touch $out
''
46 changes: 46 additions & 0 deletions tests/pyodbc-wheel/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions tests/pyodbc-wheel/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[tool.poetry]
name = "test-pyodbc-wheel"
version = "0.1.0"
description = "Test of pyodbc as wheel"
authors = ["Your Name <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
pyodbc = "^5.0.1"

[build-system]
requires = ["poetry-core>=1"]
build-backend = "poetry.core.masonry.api"