-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
python3Packages.mkPythonMetaPackage: init
This function exists create a meta package containing [metadata files](https://packaging.python.org/en/latest/specifications/recording-installed-packages/) to satisfy a dependency on a package, without it actually having been installed into the environment.
- Loading branch information
1 parent
ee2a36d
commit 8cd58c7
Showing
3 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
{ | ||
buildPythonPackage, | ||
lib, | ||
hatchling, | ||
}: | ||
{ | ||
pname, | ||
version, | ||
dependencies ? [ ], | ||
optional-dependencies ? { }, | ||
passthru ? { }, | ||
meta ? { }, | ||
}: | ||
|
||
# Create a "fake" meta package to satisfy a dependency on a package, but don't actually build it. | ||
# 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. | ||
|
||
buildPythonPackage { | ||
inherit | ||
pname | ||
version | ||
dependencies | ||
optional-dependencies | ||
meta | ||
passthru | ||
; | ||
|
||
pyproject = true; | ||
|
||
# Make a minimal pyproject.toml that can be built | ||
unpackPhase = '' | ||
cat > pyproject.toml << EOF | ||
[project] | ||
name = "${pname}" | ||
version = "${version}" | ||
dependencies = ${builtins.toJSON (map lib.getName dependencies)} | ||
[project.optional-dependencies] | ||
${lib.optionalString (optional-dependencies != { }) ( | ||
(lib.concatStringsSep "\n" ( | ||
lib.mapAttrsToList ( | ||
group: deps: group + " = " + builtins.toJSON (map lib.getName deps) | ||
) optional-dependencies | ||
)) | ||
)} | ||
[tool.hatch.build.targets.wheel] | ||
bypass-selection = true | ||
[build-system] | ||
requires = ["hatchling"] | ||
build-backend = "hatchling.build" | ||
EOF | ||
''; | ||
|
||
build-system = [ hatchling ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters