From 5c620d068604222ad00f64aae1d80404cc3fd83d Mon Sep 17 00:00:00 2001 From: freezeboy Date: Mon, 21 Sep 2020 15:09:15 +0200 Subject: [PATCH 1/3] crc32c: enable static (cherry picked from commit 160f169f03cd338c065d2060512259c140666e2d) --- pkgs/development/libraries/crc32c/default.nix | 5 ++++- pkgs/top-level/static.nix | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/crc32c/default.nix b/pkgs/development/libraries/crc32c/default.nix index 1da2f210c5cf36..b9c12b1889c213 100644 --- a/pkgs/development/libraries/crc32c/default.nix +++ b/pkgs/development/libraries/crc32c/default.nix @@ -1,4 +1,6 @@ -{ stdenv, fetchFromGitHub, cmake, gflags }: +{ stdenv, lib, fetchFromGitHub, cmake, gflags +, staticOnly ? false }: + stdenv.mkDerivation rec { pname = "crc32c"; version = "1.1.0"; @@ -14,6 +16,7 @@ stdenv.mkDerivation rec { nativeBuildInputs = [ cmake ]; buildInputs = [ gflags ]; NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isAarch64 "-march=armv8-a+crc"; + cmakeFlags = lib.optionals (!staticOnly) [ "-DBUILD_SHARED_LIBS=1" ]; meta = with stdenv.lib; { homepage = "https://github.com/google/crc32c"; diff --git a/pkgs/top-level/static.nix b/pkgs/top-level/static.nix index ca64c4d975cb6b..4fa5b92e951d0b 100644 --- a/pkgs/top-level/static.nix +++ b/pkgs/top-level/static.nix @@ -191,6 +191,9 @@ in { gsm = super.gsm.override { staticSupport = true; }; + crc32c = super.crc32c.override { + staticOnly = true; + }; parted = super.parted.override { enableStatic = true; }; From 72ab9370bbd97a5d25a6e985ec8bd3bc9baffe3e Mon Sep 17 00:00:00 2001 From: freezeboy Date: Mon, 21 Sep 2020 15:10:08 +0200 Subject: [PATCH 2/3] python3Packages.crc32c: init at 1.0.0 (cherry picked from commit 2468315f2b4715ea3392450966e832aab756bc41) --- .../python-modules/google-crc32c/default.nix | 31 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 +++ 2 files changed, 35 insertions(+) create mode 100644 pkgs/development/python-modules/google-crc32c/default.nix diff --git a/pkgs/development/python-modules/google-crc32c/default.nix b/pkgs/development/python-modules/google-crc32c/default.nix new file mode 100644 index 00000000000000..fbed406cebcea3 --- /dev/null +++ b/pkgs/development/python-modules/google-crc32c/default.nix @@ -0,0 +1,31 @@ +{ lib, buildPythonPackage, isPy3k, fetchFromGitHub, cffi, crc32c, pytestCheckHook }: + +buildPythonPackage rec { + pname = "google-crc32c"; + version = "1.0.0"; + + disabled = !isPy3k; + + src = fetchFromGitHub { + owner = "googleapis"; + repo = "python-crc32c"; + rev = "v${version}"; + sha256 = "0n3ggsxmk1fhq0kz6p5rcj4gypfb05i26fcn7lsawakgl7fzxqyl"; + }; + + buildInputs = [ crc32c ]; + propagatedBuildInputs = [ cffi ]; + + LDFLAGS = "-L${crc32c}/lib"; + CFLAGS = "-I${crc32c}/include"; + + checkInputs = [ pytestCheckHook crc32c ]; + pythonImportsCheck = [ "google_crc32c" ]; + + meta = with lib; { + homepage = "https://github.com/googleapis/python-crc32c"; + description = "Wrapper the google/crc32c hardware-based implementation of the CRC32C hashing algorithm"; + license = with licenses; [ asl20 ]; + maintainers = with maintainers; [ freezeboy ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 90d4646dfb4a30..be028c653f49ce 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2452,6 +2452,10 @@ in { google-compute-engine = callPackage ../tools/virtualization/google-compute-engine { }; + google-crc32c = callPackage ../development/python-modules/google-crc32c { + inherit (pkgs) crc32c; + }; + google-i18n-address = callPackage ../development/python-modules/google-i18n-address { }; google-music = callPackage ../development/python-modules/google-music { }; From a9a70965078f947731a237c4a27fcb909be9ca00 Mon Sep 17 00:00:00 2001 From: freezeboy Date: Mon, 21 Sep 2020 00:36:38 +0200 Subject: [PATCH 3/3] python3Packages.google_resumable_media,python2Packages.google_resumable_media: fix tests (cherry picked from commit 908d8c3459941010dfddd655116f9a23aac9670d) --- .../google_resumable_media/default.nix | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/google_resumable_media/default.nix b/pkgs/development/python-modules/google_resumable_media/default.nix index ac8a111b3e764a..5bd95004f93b31 100644 --- a/pkgs/development/python-modules/google_resumable_media/default.nix +++ b/pkgs/development/python-modules/google_resumable_media/default.nix @@ -1,30 +1,35 @@ -{ stdenv +{ lib , buildPythonPackage +, isPy3k , fetchPypi , six , requests , setuptools , pytest , mock +, crcmod +, google-crc32c }: buildPythonPackage rec { pname = "google-resumable-media"; - version = "0.7.1"; + version = "1.0.0"; src = fetchPypi { inherit pname version; - sha256 = "57841f5e65fb285c01071f439724745b2549a72eb75e5fd979198eb518608ed0"; + sha256 = "FzrMa63hSApSn6KcbCcXVDri3AnULpRh/bhvOVAu/PI="; }; checkInputs = [ pytest mock ]; - propagatedBuildInputs = [ requests setuptools six ]; + propagatedBuildInputs = [ requests setuptools six ] + ++ lib.optional isPy3k google-crc32c + ++ lib.optional (!isPy3k) crcmod; checkPhase = '' py.test tests/unit ''; - meta = with stdenv.lib; { + meta = with lib; { description = "Utilities for Google Media Downloads and Resumable Uploads"; homepage = "https://github.com/GoogleCloudPlatform/google-resumable-media-python"; license = licenses.asl20;