Skip to content

Commit

Permalink
add sdist output to flake
Browse files Browse the repository at this point in the history
  • Loading branch information
DavHau committed Mar 12, 2021
1 parent 42abe60 commit afcfd0d
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
12 changes: 6 additions & 6 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ let

python_machnix = import ./mach_nix/nix/python.nix { inherit pkgs; };

python_deps = (builtins.attrValues (import ./mach_nix/nix/python-deps.nix {
python = python_machnix;
fetchurl = pkgs.fetchurl;
}));

pypiFetcher = (import ./mach_nix/nix/deps-db-and-fetcher.nix {
inherit pkgs;
pypi_deps_db_commit = pypiDataRev;
Expand Down Expand Up @@ -58,11 +53,16 @@ rec {
version = builtins.readFile ./mach_nix/VERSION;
name = "${pname}-${version}";
src = ./.;
propagatedBuildInputs = python_deps;
propagatedBuildInputs = pythonDeps;
checkInputs = [ python_machnix.pkgs.pytest ];
checkPhase = "pytest";
};

pythonDeps = (builtins.attrValues (import ./mach_nix/nix/python-deps.nix {
python = python_machnix;
fetchurl = pkgs.fetchurl;
}));

# the main functions
mkPython = args: __mkPython "mkPython" args;
mkPythonShell = args: (__mkPython "mkPythonShell" args).env;
Expand Down
8 changes: 8 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@
shellWith
dockerImageWith;
"with" = pythonWith;
sdist = pkgs.runCommand "mach-nix-sdist"
{ buildInputs = mach-nix-default.pythonDeps; }
''
mkdir src
cp -r ${./.}/* src
cd src
python setup.py sdist -d $out
'';
};

defaultPackage = packages.mach-nix;
Expand Down
1 change: 0 additions & 1 deletion mach_nix/generators/overides_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,6 @@ def _gen_prop_build_inputs(self, prop_build_inputs_local, prop_build_inputs_nixp
def _gen_overrideAttrs(
self, name, ver, circular_deps, nix_name, provider, build_inputs_str, prop_build_inputs_str,
keep_src=False):
# TODO: apply the buildInput replacement to all kinds of buildInputs
out = f"""
"{name}" = override python-super.{nix_name} ( oldAttrs:
(mapAttrs (n: v: if elem n depNamesOther then map (dep: updatePythonDepsRec python-self dep) v else v ) oldAttrs) // {{
Expand Down
1 change: 1 addition & 0 deletions mach_nix/nix/python-deps.nix
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ rec {
packaging = python.pkgs.packaging;
setuptools = python.pkgs.setuptools;
toml = python.pkgs.toml;
wheel = python.pkgs.wheel;
}

0 comments on commit afcfd0d

Please sign in to comment.