Merge branch 'master' into staging-next

This commit is contained in:
Jan Tojnar
2021-03-18 19:24:39 +01:00
91 changed files with 982 additions and 256 deletions

View File

@@ -1,8 +1,9 @@
{ lib, buildPythonPackage, fetchPypi }:
{ lib, buildPythonPackage, fetchPypi, pythonAtLeast }:
buildPythonPackage rec {
pname = "backports.ssl_match_hostname";
version = "3.7.0.1";
disabled = pythonAtLeast "3.7";
src = fetchPypi {
inherit pname version;

View File

@@ -1,14 +1,16 @@
{ lib, buildPythonPackage, isPy3k, fetchPypi, bluez, txdbus, pytest, pytestcov }:
{ lib, buildPythonPackage, isPy3k, fetchPypi
, bluez, dbus-next, pytestCheckHook, pytest-cov
}:
buildPythonPackage rec {
pname = "bleak";
version = "0.10.0";
version = "0.11.0";
disabled = !isPy3k;
src = fetchPypi {
inherit pname version;
sha256 = "5c3a873965f2910865895e572e7a4f10533d6e150e6ba17936397426bf8d1eee";
sha256 = "1zs5lz3r17a2xn19i4na132iccyjsl9navj0d3v7gks7hlcad5kp";
};
postPatch = ''
@@ -19,10 +21,11 @@ buildPythonPackage rec {
--replace \"bluetoothctl\" \"${bluez}/bin/bluetoothctl\"
'';
propagatedBuildInputs = [ txdbus ];
checkInputs = [ pytest pytestcov ];
propagatedBuildInputs = [ dbus-next ];
checkPhase = "AGENT_OS=linux py.test";
checkInputs = [ pytestCheckHook pytest-cov ];
pythonImportsCheck = [ "bleak" ];
meta = with lib; {
description = "Bluetooth Low Energy platform Agnostic Klient for Python";

View File

@@ -13,11 +13,11 @@
buildPythonPackage rec {
pname = "boto3";
version = "1.17.29"; # N.B: if you change this, change botocore and awscli to a matching version
version = "1.17.30"; # N.B: if you change this, change botocore and awscli to a matching version
src = fetchPypi {
inherit pname version;
sha256 = "sha256-MTlvyv/fwPRltN524eyuU4lOuGmwAP+lSqFpOpjbOjw=";
sha256 = "sha256-05wEtR5gGX9VA/hInwQ7yQSYFWfMhDHTiTZ3Z9w/1a4=";
};
propagatedBuildInputs = [ botocore jmespath s3transfer ] ++ lib.optionals (!isPy3k) [ futures ];

View File

@@ -12,11 +12,11 @@
buildPythonPackage rec {
pname = "botocore";
version = "1.20.29"; # N.B: if you change this, change boto3 and awscli to a matching version
version = "1.20.30"; # N.B: if you change this, change boto3 and awscli to a matching version
src = fetchPypi {
inherit pname version;
sha256 = "sha256-GEt9JrBmn9ZayBk2YjdtEmfYAOAFtpQStXzILF/76TU=";
sha256 = "sha256-mP8eshDTlKH/5zazPIp75o8w8KA1ULVZxbtv3wwpMo0=";
};
propagatedBuildInputs = [

View File

@@ -3,14 +3,14 @@
buildPythonPackage rec {
pname = "bx-python";
version = "0.8.10";
version = "0.8.11";
disabled = isPy27;
src = fetchFromGitHub {
owner = "bxlab";
repo = "bx-python";
rev = "v${version}";
sha256 = "09q5nrv0w9b1bclc7g80bih87ikffhvia22d6cpdc747wjrzz8il";
sha256 = "0cz5vgw19hmkcg689vr540q2gl2lb3xcf1lphm7zbfp8wmypcadm";
};
nativeBuildInputs = [ cython ];

View File

@@ -1,7 +1,7 @@
{ lib, buildPythonPackage
, fetchPypi, isPy3k, linuxPackages
, fastrlock, numpy, six, wheel, pytest, mock, setuptools
, cudatoolkit, cudnn, nccl
, cudatoolkit, cudnn, cutensor, nccl
}:
buildPythonPackage rec {
@@ -26,6 +26,7 @@ buildPythonPackage rec {
propagatedBuildInputs = [
cudatoolkit
cudnn
cutensor
linuxPackages.nvidia_x11
nccl
fastrlock

View File

@@ -24,11 +24,11 @@
buildPythonPackage rec {
pname = "datashader";
version = "0.12.0";
version = "0.12.1";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-CnV6ne3cbMtoVUBDqXf4n3tlEMzuKp7H8Ju7Qrzn9es=";
sha256 = "a135612876dc3e4b16ccb9ddb70de50519825c8c1be251b49aefa550bcf8a39a";
};
propagatedBuildInputs = [

View File

@@ -6,6 +6,7 @@
, certifi
, six
, backports_ssl_match_hostname
, pythonOlder
}:
buildPythonPackage rec {
@@ -18,7 +19,8 @@ buildPythonPackage rec {
};
buildInputs = [ pytest ];
propagatedBuildInputs = [ gevent certifi six backports_ssl_match_hostname ];
propagatedBuildInputs = [ gevent certifi six ]
++ lib.optionals (pythonOlder "3.7") [ backports_ssl_match_hostname ];
# Several tests fail that require network
doCheck = false;

View File

@@ -26,7 +26,7 @@ buildPythonPackage rec {
substituteInPlace pyproject.toml \
--replace 'numpy = "1.18.5"' 'numpy = "^1.18.5"' \
--replace 'hyperopt = "0.1.2"' 'hyperopt = ">=0.1.2"' \
--replace 'wheel = "^0.35.1"' 'wheel = "^0.36"'
--replace 'wheel = "^0.35.1"' 'wheel = "*"'
'';
nativeBuildInputs = [ poetry-core ];

View File

@@ -0,0 +1,98 @@
{ lib
, buildPythonPackage
, python
, pythonOlder
, fetchFromGitLab
, substituteAll
, bubblewrap
, exiftool
, ffmpeg
, mime-types
, wrapGAppsHook
, gdk-pixbuf
, gobject-introspection
, librsvg
, poppler_gi
, mutagen
, pygobject3
, pycairo
, dolphinIntegration ? false, plasma5Packages
}:
buildPythonPackage rec {
pname = "mat2";
version = "0.12.0";
disabled = pythonOlder "3.5";
src = fetchFromGitLab {
domain = "0xacab.org";
owner = "jvoisin";
repo = "mat2";
rev = version;
sha256 = "0amxwwmcf47dakfm6zvsksv6ja7rz7dpmd1z2rsspy8yds6zgxs7";
};
patches = [
# hardcode paths to some binaries
(substituteAll ({
src = ./paths.patch;
bwrap = "${bubblewrap}/bin/bwrap";
exiftool = "${exiftool}/bin/exiftool";
ffmpeg = "${ffmpeg}/bin/ffmpeg";
# remove once faf0f8a8a4134edbeec0a73de7f938453444186d is in master
mimetypes = "${mime-types}/etc/mime.types";
} // lib.optionalAttrs dolphinIntegration {
kdialog = "${plasma5Packages.kdialog}/bin/kdialog";
}))
# the executable shouldn't be called .mat2-wrapped
./executable-name.patch
# hardcode path to mat2 executable
./tests.patch
];
postPatch = ''
substituteInPlace dolphin/mat2.desktop \
--replace "@mat2@" "$out/bin/mat2" \
--replace "@mat2svg@" "$out/share/icons/hicolor/scalable/apps/mat2.svg"
'';
nativeBuildInputs = [
wrapGAppsHook
];
buildInputs = [
gdk-pixbuf
gobject-introspection
librsvg
poppler_gi
];
propagatedBuildInputs = [
mutagen
pygobject3
pycairo
];
postInstall = ''
install -Dm 444 data/mat2.svg -t "$out/share/icons/hicolor/scalable/apps"
install -Dm 444 doc/mat2.1 -t "$out/share/man/man1"
install -Dm 444 nautilus/mat2.py -t "$out/share/nautilus-python/extensions"
buildPythonPath "$out $pythonPath"
patchPythonScript "$out/share/nautilus-python/extensions/mat2.py"
'' + lib.optionalString dolphinIntegration ''
install -Dm 444 dolphin/mat2.desktop -t "$out/share/kservices5/ServiceMenus"
'';
checkPhase = ''
${python.interpreter} -m unittest discover -v
'';
meta = with lib; {
description = "A handy tool to trash your metadata";
homepage = "https://0xacab.org/jvoisin/mat2";
changelog = "https://0xacab.org/jvoisin/mat2/-/blob/${version}/CHANGELOG.md";
license = licenses.lgpl3Plus;
maintainers = with maintainers; [ dotlambda ];
};
}

View File

@@ -0,0 +1,13 @@
diff --git a/mat2 b/mat2
index 3b77e1e..b99a633 100755
--- a/mat2
+++ b/mat2
@@ -46,7 +46,7 @@ def __check_file(filename: str, mode: int = os.R_OK) -> bool:
def create_arg_parser() -> argparse.ArgumentParser:
- parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2')
+ parser = argparse.ArgumentParser(description='Metadata anonymisation toolkit 2', prog='mat2')
parser.add_argument('-V', '--verbose', action='store_true',
help='show more verbose status information')

View File

@@ -0,0 +1,111 @@
diff --git a/dolphin/mat2.desktop b/dolphin/mat2.desktop
index e623962..5d69ae2 100644
--- a/dolphin/mat2.desktop
+++ b/dolphin/mat2.desktop
@@ -7,5 +7,5 @@ Type=Service
[Desktop Action cleanMetadata]
Name=Clean metadata
Name[es]=Limpiar metadatos
-Icon=/usr/share/icons/hicolor/scalable/apps/mat2.svg
-Exec=kdialog --yesno "$( mat2 -s %U )" --title "Clean Metadata?" && mat2 %U
+Icon=@mat2svg@
+Exec=@kdialog@ --yesno "$( @mat2@ -s %U )" --title "Clean Metadata?" && @mat2@ %U
diff --git a/libmat2/bubblewrap.py b/libmat2/bubblewrap.py
index 970d5dd..5d3c0b7 100644
--- a/libmat2/bubblewrap.py
+++ b/libmat2/bubblewrap.py
@@ -22,11 +22,7 @@ CalledProcessError = subprocess.CalledProcessError
def _get_bwrap_path() -> str:
- which_path = shutil.which('bwrap')
- if which_path:
- return which_path
-
- raise RuntimeError("Unable to find bwrap") # pragma: no cover
+ return '@bwrap@'
def _get_bwrap_args(tempdir: str,
@@ -37,16 +33,11 @@ def _get_bwrap_args(tempdir: str,
# XXX: use --ro-bind-try once all supported platforms
# have a bubblewrap recent enough to support it.
- ro_bind_dirs = ['/usr', '/lib', '/lib64', '/bin', '/sbin', '/etc/alternatives', cwd]
+ ro_bind_dirs = ['/nix/store', cwd]
for bind_dir in ro_bind_dirs:
if os.path.isdir(bind_dir): # pragma: no cover
ro_bind_args.extend(['--ro-bind', bind_dir, bind_dir])
- ro_bind_files = ['/etc/ld.so.cache']
- for bind_file in ro_bind_files:
- if os.path.isfile(bind_file): # pragma: no cover
- ro_bind_args.extend(['--ro-bind', bind_file, bind_file])
-
args = ro_bind_args + \
['--dev', '/dev',
'--proc', '/proc',
diff --git a/libmat2/exiftool.py b/libmat2/exiftool.py
index eb65b2a..51a0fa1 100644
--- a/libmat2/exiftool.py
+++ b/libmat2/exiftool.py
@@ -1,8 +1,6 @@
-import functools
import json
import logging
import os
-import shutil
import subprocess
from typing import Dict, Union, Set
@@ -70,14 +68,5 @@ class ExiftoolParser(abstract.AbstractParser):
return False
return True
-@functools.lru_cache()
def _get_exiftool_path() -> str: # pragma: no cover
- which_path = shutil.which('exiftool')
- if which_path:
- return which_path
-
- # Exiftool on Arch Linux has a weird path
- if os.access('/usr/bin/vendor_perl/exiftool', os.X_OK):
- return '/usr/bin/vendor_perl/exiftool'
-
- raise RuntimeError("Unable to find exiftool")
+ return '@exiftool@'
diff --git a/libmat2/parser_factory.py b/libmat2/parser_factory.py
index 9965432..bd45179 100644
--- a/libmat2/parser_factory.py
+++ b/libmat2/parser_factory.py
@@ -8,6 +8,7 @@ from . import abstract, UNSUPPORTED_EXTENSIONS
T = TypeVar('T', bound='abstract.AbstractParser')
+mimetypes.init(['@mimetypes@'])
mimetypes.add_type('application/epub+zip', '.epub')
mimetypes.add_type('application/x-dtbncx+xml', '.ncx') # EPUB Navigation Control XML File
diff --git a/libmat2/video.py b/libmat2/video.py
index b4a3232..3dd7ee5 100644
--- a/libmat2/video.py
+++ b/libmat2/video.py
@@ -1,6 +1,4 @@
import subprocess
-import functools
-import shutil
import logging
from typing import Dict, Union
@@ -135,10 +133,5 @@ class MP4Parser(AbstractFFmpegParser):
}
-@functools.lru_cache()
def _get_ffmpeg_path() -> str: # pragma: no cover
- which_path = shutil.which('ffmpeg')
- if which_path:
- return which_path
-
- raise RuntimeError("Unable to find ffmpeg")
+ return '@ffmpeg@'

View File

@@ -0,0 +1,18 @@
diff --git a/tests/test_climat2.py b/tests/test_climat2.py
index cede642..2d5ad77 100644
--- a/tests/test_climat2.py
+++ b/tests/test_climat2.py
@@ -10,12 +10,7 @@ import glob
from libmat2 import images, parser_factory
-mat2_binary = ['./mat2']
-
-if 'MAT2_GLOBAL_PATH_TESTSUITE' in os.environ:
- # Debian runs tests after installing the package
- # https://0xacab.org/jvoisin/mat2/issues/16#note_153878
- mat2_binary = ['/usr/bin/env', 'mat2']
+mat2_binary = [os.environ['out'] + '/bin/mat2']
class TestHelp(unittest.TestCase):

View File

@@ -14,11 +14,11 @@
buildPythonPackage rec {
pname = "sagemaker";
version = "2.29.2";
version = "2.30.0";
src = fetchPypi {
inherit pname version;
sha256 = "sha256-e+yrjtDC6d47+zEFv6WY7xGw9kDfKLrNyMh/IkC/bQs=";
sha256 = "sha256-3BxRDoaKxaXlKYGYQqhQ2DUO3XONvf6dlofE0pbXIho=";
};
pythonImportsCheck = [

View File

@@ -30,10 +30,12 @@ buildPythonPackage rec {
sha256 = "sha256-CCgkzUkt9YqTJt9tPBLmYXW6ZuRoMDd7xahYmNXgfM0=";
};
patches = [(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/SoCo/SoCo/pull/811.patch";
sha256 = "sha256-GBd74c8zc25ROO411SZ9TTa+bi8yXJaaOQqY9FM1qj4=";
})];
patches = [
(fetchpatch {
url = "https://patch-diff.githubusercontent.com/raw/SoCo/SoCo/pull/811.patch";
sha256 = "sha256-GBd74c8zc25ROO411SZ9TTa+bi8yXJaaOQqY9FM1qj4=";
})
];
# N.B. These exist because:
# 1. Upstream's pinning isn't well maintained, leaving dependency versions no

View File

@@ -6,22 +6,16 @@
buildPythonPackage rec {
pname = "TatSu";
version = "5.0.0";
version = "5.5.0";
src = fetchFromGitHub {
owner = "neogeny";
repo = pname;
rev = "v${version}";
sha256 = "1c16fcxf0xjkh5py9bnj6ljb9krhrj57mkwayl1w1dvzwl5lkgj3";
sha256 = "07bmdnwh99p60cgzhlb8s5vwi5v4r5zi8shymxnnarannkc66hzn";
};
# Since version 5.0.0 only >=3.8 is officially supported, but ics is not
# compatible with Python 3.8 due to aiohttp:
disabled = pythonOlder "3.7";
postPatch = ''
substituteInPlace setup.py \
--replace "python_requires='>=3.8'," "python_requires='>=3.7',"
'';
disabled = pythonOlder "3.8";
nativeBuildInputs = [ pytestrunner ];
propagatedBuildInputs = [ colorama mypy pyyaml regex ]

View File

@@ -0,0 +1,33 @@
{ lib
, buildPythonPackage
, isPy27
, fetchPypi
, requests
}:
buildPythonPackage rec {
pname = "ytmusicapi";
version = "0.14.3";
disabled = isPy27;
src = fetchPypi {
inherit pname version;
sha256 = "83251a95d5bd74116353d29dfda2d0c5055b88276a0876a313a66f8b9c691344";
};
propagatedBuildInputs = [
requests
];
doCheck = false; # requires network access
pythonImportsCheck = [ "ytmusicapi" ];
meta = with lib; {
description = "Unofficial API for YouTube Music";
homepage = "https://github.com/sigma67/ytmusicapi";
license = licenses.mit;
maintainers = with maintainers; [ dotlambda ];
};
}