summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/s4/s4cmd/package.nix
blob: 2a951ef942ec923aa2adc539c2686987c900baa1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
{
  lib,
  python3Packages,
  fetchPypi,
}:

python3Packages.buildPythonApplication (finalAttrs: {
  pname = "s4cmd";
  version = "2.1.0";
  pyproject = true;

  src = fetchPypi {
    inherit (finalAttrs) pname version;
    sha256 = "0d4mx98i3qhvlmr9x898mjvf827smzx6x5ji6daiwgjdlxc60mj2";
  };

  build-system = with python3Packages; [ setuptools ];

  dependencies = with python3Packages; [
    boto3
    pytz
  ];

  # The upstream package tries to install some bash shell completion scripts in /etc.
  # Setuptools is bugged and doesn't handle --prefix properly: https://github.com/pypa/setuptools/issues/130
  patchPhase = ''
    sed -i '/ data_files=/d' setup.py
    sed -i 's|os.chmod("/etc.*|pass|' setup.py
  '';

  # Replace upstream's s4cmd wrapper script with the built-in Nix wrapper
  postInstall = ''
    ln -fs $out/bin/s4cmd.py $out/bin/s4cmd
  '';

  # Test suite requires an S3 bucket
  doCheck = false;

  pythonImportsCheck = [ "s4cmd" ];

  meta = {
    homepage = "https://github.com/bloomreach/s4cmd";
    description = "Super S3 command line tool";
    license = lib.licenses.asl20;
  };
})