Skip to content

Commit

Permalink
Merge pull request #1001 from phaer/pyproject-true
Browse files Browse the repository at this point in the history
treewide: format = "pyproject" -> pyproject = true
  • Loading branch information
phaer committed Jun 27, 2024
2 parents 26097d3 + 223674d commit 5206af5
Show file tree
Hide file tree
Showing 10 changed files with 21 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}: let
pyproject = lib.importTOML ./subpkg1/pyproject.toml;
buildWithSetuptools = {
buildPythonPackage.format = "pyproject";
buildPythonPackage.pyproject = true;
mkDerivation.buildInputs = [config.deps.python.pkgs.setuptools];
};
in {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@
dream2nix.modules.dream2nix.WIP-python-pdm
];

deps = {nixpkgs, ...}: {
python = nixpkgs.python3;
};

mkDerivation = {
src = lib.cleanSourceWith {
src = lib.cleanSource ./.;
Expand All @@ -28,7 +24,6 @@
pdm.pyproject = ./pyproject.toml;

buildPythonPackage = {
format = lib.mkForce "pyproject";
pythonImportsCheck = [
"mytool"
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ in {
};

buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"mytool"
];
Expand All @@ -50,6 +50,9 @@ in {
++ pyproject.project.dependencies;
flattenDependencies = true;

overrides.click.mkDerivation.nativeBuildInputs = [config.deps.python.pkgs.flit-core];
overrides.click = {
buildPythonPackage.pyproject = true;
mkDerivation.nativeBuildInputs = [config.deps.python.pkgs.flit-core];
};
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ in {
# We include fixes from nixpkgs for pendulum, but keep
# our dependencies to avoid version conflicts
pendulum = {
env.pyproject = null;
buildPythonPackage.pyproject = true;
mkDerivation.propagatedBuildInputs = [
python.pkgs.poetry-core
];
Expand Down
15 changes: 6 additions & 9 deletions modules/dream2nix/WIP-python-pdm/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ in {
writeText
unzip
;
python = lib.mkDefault config.deps.python3;
};
overrideType = {
imports = [commonModule];
Expand All @@ -105,7 +104,7 @@ in {
};
};
buildPythonPackage = {
format = lib.mkDefault "pyproject";
pyproject = lib.mkDefault true;
};
mkDerivation = {
buildInputs = map (name: config.deps.python.pkgs.${name}) buildSystemNames;
Expand Down Expand Up @@ -187,13 +186,11 @@ in {
inherit name;
version = lib.mkDefault pkg.version;
sourceSelector = lib.mkOptionDefault config.pdm.sourceSelector;
buildPythonPackage = {
format = lib.mkDefault (
if lib.hasSuffix ".whl" source.file
then "wheel"
else "pyproject"
);
};
buildPythonPackage.format = lib.mkDefault (
if lib.hasSuffix ".whl" source.file
then "wheel"
else null
);
mkDerivation = {
# TODO: handle sources outside pypi.org
src = lib.mkDefault (libpyproject-fetchers.fetchFromLegacy {
Expand Down
2 changes: 1 addition & 1 deletion modules/dream2nix/WIP-python-pyproject/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ in {
};

buildPythonPackage = {
format = "pyproject";
pyproject = true;
};

name = pyproject.project.name;
Expand Down
7 changes: 4 additions & 3 deletions modules/dream2nix/pip/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,12 @@
# deps.python cannot be defined in commonModule as this would trigger an
# infinite recursion.
deps = {inherit python;};
buildPythonPackage.format = l.mkDefault (
if l.hasSuffix ".whl" cfg.mkDerivation.src
buildPythonPackage.format = lib.mkDefault (
if lib.hasSuffix ".whl" cfg.mkDerivation.src
then "wheel"
else "pyproject"
else null
);

mkDerivation.buildInputs =
lib.optionals
(! lib.hasSuffix ".whl" cfg.mkDerivation.src)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in {
};

buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"my_tool"
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ in {
};

buildPythonPackage = {
format = lib.mkForce "pyproject";
pyproject = true;
pythonImportsCheck = [
"my_tool"
];
Expand Down
2 changes: 1 addition & 1 deletion pkgs/fetchPipMetadata/package.nix
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
}: let
package = python3.pkgs.buildPythonPackage {
name = "fetch-pip-metadata";
format = "pyproject";
pyproject = true;
src = ./src;
nativeBuildInputs = [
gitMinimal
Expand Down

0 comments on commit 5206af5

Please sign in to comment.