Skip to content

Commit

Permalink
Merge pull request #120009 from DeterminateSystems/scancode
Browse files Browse the repository at this point in the history
python3.pkgs.scancode-toolkit: init at 21.3.31
  • Loading branch information
grahamc committed Apr 23, 2021
2 parents a773d88 + cdc750d commit 8d0340a
Show file tree
Hide file tree
Showing 21 changed files with 1,015 additions and 4 deletions.
27 changes: 27 additions & 0 deletions pkgs/development/python-modules/banal/default.nix
@@ -0,0 +1,27 @@
{ lib
, fetchPypi
, buildPythonPackage
}:
buildPythonPackage rec {
pname = "banal";
version = "1.0.6";

src = fetchPypi {
inherit pname version;
sha256 = "2fe02c9305f53168441948f4a03dfbfa2eacc73db30db4a93309083cb0e250a5";
};

# no tests
doCheck = false;

pythonImportsCheck = [
"banal"
];

meta = with lib; {
description = "Commons of banal micro-functions for Python";
homepage = "https://github.com/pudo/banal";
license = licenses.mit;
maintainers = teams.determinatesystems.members;
};
}
55 changes: 55 additions & 0 deletions pkgs/development/python-modules/commoncode/default.nix
@@ -0,0 +1,55 @@
{ lib
, fetchPypi
, buildPythonPackage
, setuptools-scm
, click
, requests
, attrs
, intbitset
, saneyaml
, text-unidecode
, beautifulsoup4
, pytestCheckHook
, pytest-xdist
}:
buildPythonPackage rec {
pname = "commoncode";
version = "21.1.21";

src = fetchPypi {
inherit pname version;
sha256 = "6e2daa34fac2d91307b23d9df5f01a6168fdffb12bf5d161bd6776bade29b479";
};

dontConfigure = true;

nativeBuildInputs = [
setuptools-scm
];

propagatedBuildInputs = [
click
requests
attrs
intbitset
saneyaml
text-unidecode
beautifulsoup4
];

checkInputs = [
pytestCheckHook
pytest-xdist
];

pythonImportsCheck = [
"commoncode"
];

meta = with lib; {
description = "A set of common utilities, originally split from ScanCode";
homepage = "https://github.com/nexB/commoncode";
license = licenses.asl20;
maintainers = teams.determinatesystems.members;
};
}
53 changes: 53 additions & 0 deletions pkgs/development/python-modules/debian-inspector/default.nix
@@ -0,0 +1,53 @@
{ lib
, buildPythonPackage
, fetchPypi
, pythonAtLeast
, fetchpatch
, chardet
, attrs
, commoncode
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "debian-inspector";
version = "0.9.10";

src = fetchPypi {
pname = "debian_inspector";
inherit version;
sha256 = "fd29a02b925a4de0d7bb00c29bb05f19715a304bc10ef7b9ad06a93893dc3a8c";
};

patches = lib.optionals (pythonAtLeast "3.9") [
# https://github.com/nexB/debian-inspector/pull/15
# fixes tests on Python 3.9
(fetchpatch {
name = "drop-encoding-argument.patch";
url = "https://github.com/nexB/debian-inspector/commit/ff991cdb788671ca9b81f1602b70a439248fd1aa.patch";
sha256 = "bm3k7vb9+Rm6+YicQEeDOOUVut8xpDaNavG+t2oLZkI=";
})
];

dontConfigure = true;

propagatedBuildInputs = [
chardet
attrs
commoncode
];

checkInputs = [
pytestCheckHook
];

pythonImportsCheck = [
"debian_inspector"
];

meta = with lib; {
description = "Utilities to parse Debian package, copyright and control files";
homepage = "https://github.com/nexB/debian-inspector";
license = with licenses; [ asl20 bsd3 mit ];
maintainers = teams.determinatesystems.members;
};
}
27 changes: 23 additions & 4 deletions pkgs/development/python-modules/dparse/default.nix
@@ -1,4 +1,12 @@
{ lib, buildPythonPackage, fetchPypi, isPy27, pytest, toml, pyyaml }:
{ lib
, buildPythonPackage
, fetchPypi
, isPy27
, toml
, pyyaml
, packaging
, pytestCheckHook
}:

buildPythonPackage rec {
pname = "dparse";
Expand All @@ -10,13 +18,24 @@ buildPythonPackage rec {
sha256 = "a1b5f169102e1c894f9a7d5ccf6f9402a836a5d24be80a986c7ce9eaed78f367";
};

propagatedBuildInputs = [ toml pyyaml ];
propagatedBuildInputs = [
toml
pyyaml
packaging
];

checkInputs = [ pytest ];
checkInputs = [
pytestCheckHook
];

disabledTests = [
# requires unpackaged dependency pipenv
"test_update_pipfile"
];

meta = with lib; {
description = "A parser for Python dependency files";
homepage = "https://github.com/pyupio/safety";
homepage = "https://github.com/pyupio/dparse";
license = licenses.mit;
maintainers = with maintainers; [ thomasdesr ];
};
Expand Down
48 changes: 48 additions & 0 deletions pkgs/development/python-modules/extractcode/7z.nix
@@ -0,0 +1,48 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, plugincode
, p7zip
}:
buildPythonPackage rec {
pname = "extractcode-7z";
version = "21.4.4";

src = fetchFromGitHub {
owner = "nexB";
repo = "scancode-plugins";
rev = "v${version}";
sha256 = "xnUGDMS34iMVMGo/nZwRarGzzbj3X4Rt+YHvvKpmy6A=";
};

sourceRoot = "source/builtins/extractcode_7z-linux";

propagatedBuildInputs = [
plugincode
];

preBuild = ''
pushd src/extractcode_7z/bin
rm 7z 7z.so
ln -s ${p7zip}/bin/7z 7z
ln -s ${p7zip}/lib/p7zip/7z.so 7z.so
popd
'';

# no tests
doCheck = false;

pythonImportsCheck = [
"extractcode_7z"
];

meta = with lib; {
description = "A ScanCode Toolkit plugin to provide pre-built binary libraries and utilities and their locations";
homepage = "https://github.com/nexB/scancode-plugins/tree/main/builtins/extractcode_7z-linux";
license = with licenses; [ asl20 lgpl21 ];
maintainers = teams.determinatesystems.members;
platforms = platforms.linux;
};
}
60 changes: 60 additions & 0 deletions pkgs/development/python-modules/extractcode/default.nix
@@ -0,0 +1,60 @@
{ lib
, fetchPypi
, buildPythonPackage
, setuptools-scm
, typecode
, patch
, extractcode-libarchive
, extractcode-7z
, pytestCheckHook
, pytest-xdist
}:
buildPythonPackage rec {
pname = "extractcode";
version = "21.2.24";

src = fetchPypi {
inherit pname version;
sha256 = "f91638dbf523b80df90ac184c25d5cd1ea24cac53f67a6bb7d7b389867e0744b";
};

dontConfigure = true;

nativeBuildInputs = [
setuptools-scm
];

propagatedBuildInputs = [
typecode
patch
extractcode-libarchive
extractcode-7z
];

checkInputs = [
pytestCheckHook
pytest-xdist
];

# cli test tests the cli which we can't do until after install
disabledTestPaths = [
"tests/test_extractcode_cli.py"
];

# test_uncompress_* wants to use a binary to extract instead of the provided library
disabledTests = [
"test_uncompress_lz4_basic"
"test_extract_tarlz4_basic"
];

pythonImportsCheck = [
"extractcode"
];

meta = with lib; {
description = "A mostly universal archive extractor using z7zip, libarchve, other libraries and the Python standard library for reliable archive extraction";
homepage = "https://github.com/nexB/extractcode";
license = licenses.asl20;
maintainers = teams.determinatesystems.members;
};
}
62 changes: 62 additions & 0 deletions pkgs/development/python-modules/extractcode/libarchive.nix
@@ -0,0 +1,62 @@
{ lib
, fetchFromGitHub
, buildPythonPackage
, libarchive
, libb2
, bzip2
, expat
, lz4
, lzma
, zlib
, zstd
, plugincode
, pytestCheckHook
}:
buildPythonPackage rec {
pname = "extractcode-libarchive";
version = "21.4.4";

src = fetchFromGitHub {
owner = "nexB";
repo = "scancode-plugins";
rev = "v${version}";
sha256 = "xnUGDMS34iMVMGo/nZwRarGzzbj3X4Rt+YHvvKpmy6A=";
};

sourceRoot = "source/builtins/extractcode_libarchive-linux";

preBuild = ''
pushd src/extractcode_libarchive/lib
rm *.so *.so.*
ln -s ${lib.getLib libarchive}/lib/libarchive.so libarchive.so
ln -s ${lib.getLib libb2}/lib/libb2.so libb2-la3511.so.1
ln -s ${lib.getLib bzip2}/lib/libbz2.so libbz2-la3511.so.1.0
ln -s ${lib.getLib expat}/lib/libexpat.so libexpat-la3511.so.1
ln -s ${lib.getLib lz4}/lib/liblz4.so liblz4-la3511.so.1
ln -s ${lib.getLib lzma}/lib/liblzma.so liblzma-la3511.so.5
ln -s ${lib.getLib zlib}/lib/libz.so libz-la3511.so.1
ln -s ${lib.getLib zstd}/lib/libzstd.so libzstd-la3511.so.1
popd
'';

propagatedBuildInputs = [
plugincode
];

# no tests
doCheck = false;

pythonImportsCheck = [
"extractcode_libarchive"
];

meta = with lib; {
description = "A ScanCode Toolkit plugin to provide pre-built binary libraries and utilities and their locations";
homepage = "https://github.com/nexB/scancode-plugins/tree/main/builtins/extractcode_libarchive-linux";
license = with licenses; [ asl20 bsd2 ];
maintainers = teams.determinatesystems.members;
platforms = platforms.linux;
};
}
42 changes: 42 additions & 0 deletions pkgs/development/python-modules/fingerprints/default.nix
@@ -0,0 +1,42 @@
{ lib
, fetchPypi
, buildPythonPackage
, normality
, mypy
, coverage
, nose
}:
buildPythonPackage rec {
pname = "fingerprints";
version = "1.0.3";

src = fetchPypi {
inherit pname version;
sha256 = "cafd5f92b5b91e4ce34af2b954da9c05b448a4778947785abb19a14f363352d0";
};

propagatedBuildInputs = [
normality
];

checkInputs = [
mypy
coverage
nose
];

checkPhase = ''
nosetests
'';

pythonImportsCheck = [
"fingerprints"
];

meta = with lib; {
description = "A library to generate entity fingerprints";
homepage = "https://github.com/alephdata/fingerprints";
license = licenses.mit;
maintainers = teams.determinatesystems.members;
};
}

0 comments on commit 8d0340a

Please sign in to comment.