From 283d622397539f196416657da9dc804a4ca89846 Mon Sep 17 00:00:00 2001 From: sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> Date: Mon, 7 Jun 2021 12:51:17 +0200 Subject: [PATCH] darwin.xattr: init at 61.60.1 --- pkgs/os-specific/darwin/xattr/default.nix | 73 +++++++++++++++++++++++ pkgs/top-level/darwin-packages.nix | 2 + 2 files changed, 75 insertions(+) create mode 100644 pkgs/os-specific/darwin/xattr/default.nix diff --git a/pkgs/os-specific/darwin/xattr/default.nix b/pkgs/os-specific/darwin/xattr/default.nix new file mode 100644 index 00000000000..1aa8b49e88a --- /dev/null +++ b/pkgs/os-specific/darwin/xattr/default.nix @@ -0,0 +1,73 @@ +{ lib +, stdenv +, fetchzip +, buildPythonPackage +, python +, ed +, unifdef +}: + +buildPythonPackage rec { + pname = "xattr"; + version = "61.60.1"; + + src = fetchzip rec { + url = "https://opensource.apple.com/tarballs/python_modules/python_modules-${version}.tar.gz"; + sha256 = "19kydl7w4vpdi7zmfd5z9vjkq24jfk2cv4j0pppw69j06czhdwwi"; + }; + + sourceRoot = "${src.name}/Modules/xattr-0.6.4"; + format = "other"; + + nativeBuildInputs = [ + ed + unifdef + ]; + + makeFlags = [ + "OBJROOT=$(PWD)" + "DSTROOT=${placeholder "out"}" + "OSL=${placeholder "doc"}/share/xattr/OpenSourceLicenses" + "OSV=${placeholder "doc"}/share/xattr/OpenSourceVersions" + ]; + + # need to use `out` instead of `bin` since buildPythonPackage ignores the latter + outputs = [ "out" "doc" "python" ]; + + # We need to patch a reference to gnutar in an included Makefile + postUnpack = '' + chmod u+w $sourceRoot/.. + ''; + + postPatch = '' + substituteInPlace ../Makefile.inc --replace gnutar tar + substituteInPlace Makefile --replace "/usr" "" + ''; + + preInstall = '' + # prevent setup.py from trying to download setuptools + sed -i xattr-*/setup.py -e '/ez_setup/d' + + # create our custom target dirs we patch in + mkdir -p "$doc/share/xattr/"OpenSource{Licenses,Versions} + mkdir -p "$python/lib/${python.libPrefix}" + ''; + + # move python package to its own output to reduce clutter + postInstall = '' + mv "$out/lib/python" "$python/${python.sitePackages}" + rmdir "$out/lib" + ''; + + makeWrapperArgs = [ + "--prefix" "PYTHONPATH" ":" "${placeholder "python"}/${python.sitePackages}" + ]; + + meta = with lib; { + description = "Display and manipulate extended attributes"; + license = [ licenses.psfl licenses.mit ]; # see $doc/share/xattr/OpenSourceLicenses + maintainers = [ maintainers.sternenseemann ]; + homepage = "https://opensource.apple.com/source/python_modules/"; + platforms = lib.platforms.darwin; + }; +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index a7f29d67261..2e031e27307 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -156,6 +156,8 @@ impure-cmds // appleSourcePackages // chooseLibs // { usr-include = callPackage ../os-specific/darwin/usr-include { }; + xattr = pkgs.python3Packages.callPackage ../os-specific/darwin/xattr { }; + inherit (pkgs.callPackages ../os-specific/darwin/xcode { }) xcode_8_1 xcode_8_2 xcode_9_1 xcode_9_2 xcode_9_4 xcode_9_4_1