1{ lib, stdenv 2, buildPythonPackage 3, fetchPypi 4, isPy3k 5, pkgs 6}: 7 8buildPythonPackage rec { 9 pname = "pysqlite"; 10 version = "2.8.3"; 11 12 src = fetchPypi { 13 inherit pname version; 14 sha256 = "17d3335863e8cf8392eea71add33dab3f96d060666fe68ab7382469d307f4490"; 15 }; 16 17 # Need to use the builtin sqlite3 on Python 3 18 disabled = isPy3k; 19 20 # Since the `.egg' file is zipped, the `NEEDED' of the `.so' files 21 # it contains is not taken into account. Thus, we must explicitly make 22 # it a propagated input. 23 propagatedBuildInputs = [ pkgs.sqlite ]; 24 25 patchPhase = '' 26 substituteInPlace "setup.cfg" \ 27 --replace "/usr/local/include" "${pkgs.sqlite.dev}/include" \ 28 --replace "/usr/local/lib" "${pkgs.sqlite.out}/lib" 29 ${lib.optionalString (!stdenv.isDarwin) ''export LDSHARED="$CC -pthread -shared"''} 30 ''; 31 32 meta = with lib; { 33 homepage = "https://pysqlite.org/"; 34 description = "Python bindings for the SQLite embedded relational database engine"; 35 longDescription = '' 36 pysqlite is a DB-API 2.0-compliant database interface for SQLite. 37 38 SQLite is a relational database management system contained in 39 a relatively small C library. It is a public domain project 40 created by D. Richard Hipp. Unlike the usual client-server 41 paradigm, the SQLite engine is not a standalone process with 42 which the program communicates, but is linked in and thus 43 becomes an integral part of the program. The library 44 implements most of SQL-92 standard, including transactions, 45 triggers and most of complex queries. 46 47 pysqlite makes this powerful embedded SQL engine available to 48 Python programmers. It stays compatible with the Python 49 database API specification 2.0 as much as possible, but also 50 exposes most of SQLite's native API, so that it is for example 51 possible to create user-defined SQL functions and aggregates 52 in Python. 53 ''; 54 license = licenses.bsd3; 55 }; 56 57}