Merge pull request #303650 from fabaff/publicsuffix2-refactor

python312Packages.publicsuffix2: refactor, python312Packages.publicsuffix: refactor
This commit is contained in:
Fabian Affolter 2024-04-12 20:56:27 +02:00 committed by GitHub
commit 6bffef7a1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 8 deletions

View File

@ -1,25 +1,37 @@
{ lib, buildPythonPackage, fetchPypi }:
{
lib,
buildPythonPackage,
fetchPypi,
setuptools,
pythonOlder,
}:
buildPythonPackage rec {
pname = "publicsuffix";
version = "1.1.1";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.7";
src = fetchPypi {
inherit pname version;
sha256 = "22ce1d65ab6af5e9b2122e2443facdb93fb5c4abf24138099cb10fe7989f43b6";
hash = "sha256-Is4dZatq9emyEi4kQ/rNuT+1xKvyQTgJnLEP55ifQ7Y=";
};
# disable test_fetch and the doctests (which also invoke fetch)
postPatch = ''
sed -i -e "/def test_fetch/i\\
\\t@unittest.skip('requires internet')" -e "/def additional_tests():/,+1d" tests.py
'';
build-system = [ setuptools ];
pythonImportsCheck = [ "publicsuffix" ];
meta = with lib; {
description = "Allows to get the public suffix of a domain name";
homepage = "https://pypi.python.org/pypi/publicsuffix/";
license = licenses.mit;
maintainers = with maintainers; [ ];
};
}

View File

@ -1,4 +1,9 @@
{ lib, buildPythonPackage, fetchFromGitHub }:
{
lib,
buildPythonPackage,
fetchFromGitHub,
setuptools,
}:
let
tagVersion = "2.2019-12-21";
in
@ -6,16 +11,18 @@ buildPythonPackage {
pname = "publicsuffix2";
# tags have dashes, while the library version does not
# see https://github.com/nexB/python-publicsuffix2/issues/12
version = lib.replaceStrings ["-"] [""] tagVersion;
format = "setuptools";
version = lib.replaceStrings [ "-" ] [ "" ] tagVersion;
pyproject = true;
src = fetchFromGitHub {
owner = "nexB";
repo = "python-publicsuffix2";
rev = "release-${tagVersion}";
sha256 = "1dkvfvl0izq9hqzilnw8ipkbgjs9xyad9p21i3864hzinbh0wp9r";
hash = "sha256-OV0O4LLxQ2LQiEHc1JTvScu35o2IWxo/hgn/COh2e7Y=";
};
build-system = [ setuptools ];
postPatch = ''
# only used to update the interal publicsuffix list
substituteInPlace setup.py \