Skip to content

Commit

Permalink
mkPythonMetaPackage: Create a top_level.txt file in build output
Browse files Browse the repository at this point in the history
In NixOS#337621 I had initially
created an empty, but importable package, meaning that initial
tests worked just fine, because the top_level.txt file is always
created when an importable package exists.

Subsequent refactors removed the importable package, but didn't verify
that the dependency satisfaction still works, only that the
metadata output looked good.

It was a bit tricky to express what I wanted to with hatchling, so I switched to setuptools.
  • Loading branch information
adisbladis committed Aug 30, 2024
1 parent 0721823 commit 7bcd6a0
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions pkgs/development/interpreters/python/meta-package.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
buildPythonPackage,
lib,
hatchling,
setuptools,
}:
{
pname,
Expand All @@ -16,6 +16,11 @@
# This is useful for packages that have a split binary/source dichotomy like psycopg2/psycopg2-binary,
# where we want to use the former, but some projects declare a dependency on the latter.

let
pyname = lib.replaceStrings [ "-" ] [ "_" ] pname;

in

buildPythonPackage {
inherit
pname
Expand Down Expand Up @@ -45,14 +50,16 @@ buildPythonPackage {
))
)}
[tool.hatch.build.targets.wheel]
bypass-selection = true
[tool.setuptools]
packages = [ "${pyname}" ]
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
requires = ["setuptools"]
build-backend = "setuptools.build_meta"
EOF
mkdir ${pyname}
'';

build-system = [ hatchling ];
build-system = [ setuptools ];
}

0 comments on commit 7bcd6a0

Please sign in to comment.