Skip to content

Commit

Permalink
python312Packages.{webassets, flask-assets}: remove nose; modernize (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
emilazy authored Oct 15, 2024
2 parents f5d3903 + 3a2ef16 commit df70905
Show file tree
Hide file tree
Showing 4 changed files with 662 additions and 30 deletions.
6 changes: 6 additions & 0 deletions pkgs/development/python-modules/dukpy/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ buildPythonPackage rec {
hash = "sha256-8RDMz9SfBoUe7LQ9/atsZlJ/2uwLUb0hZxeYdsUOGpU=";
};

postPatch = ''
substituteInPlace tests/test_webassets_filter.py \
--replace-fail "class PyTestTemp" "class _Temp" \
--replace-fail "PyTestTemp" "Temp"
'';

build-system = [ setuptools ];

dependencies = [ mutf8 ];
Expand Down
37 changes: 20 additions & 17 deletions pkgs/development/python-modules/flask-assets/default.nix
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
{
lib,
buildPythonPackage,
fetchPypi,
fetchFromGitHub,
fetchpatch2,
setuptools,
flask,
webassets,
Expand All @@ -13,35 +14,37 @@ buildPythonPackage rec {
version = "2.1.0";
pyproject = true;

src = fetchPypi {
pname = "Flask-Assets";
inherit version;
hash = "sha256-+E1lMv/lnJ/zUoheh0D/TaJcC8+s2AXwqAaBXkQ1SBM=";
src = fetchFromGitHub {
owner = "miracle2k";
repo = "flask-assets";
rev = "refs/tags/${version}";
hash = "sha256-R6cFTT+r/i5j5/QQ+cCFmeuO7SNTiV1F+e0JTxwIUGY=";
};

patchPhase = ''
substituteInPlace tests/test_integration.py --replace 'static_path=' 'static_url_path='
substituteInPlace tests/test_integration.py --replace "static_folder = '/'" "static_folder = '/x'"
substituteInPlace tests/test_integration.py --replace "'/foo'" "'/x/foo'"
'';
patches = [
# On master branch but not in a release.
(fetchpatch2 {
name = "refactor-with-pytest.patch";
url = "https://github.com/miracle2k/flask-assets/commit/56e06dbb160c165e0289ac97496354786fe3f3fd.patch?full_index=1";
hash = "sha256-Feo7gHHmHtWRB+3XvlECdU4i5rpyjyKEYEUCuy24rf4=";
})
];

nativeBuildInputs = [ setuptools ];
build-system = [ setuptools ];

propagatedBuildInputs = [
dependencies = [
flask
webassets
];

doCheck = false; # tests are broken with webassets 2.0

nativeCheckInputs = [ pytestCheckHook ];

pythonImportsCheck = [ "flask_assets" ];

meta = with lib; {
meta = {
homepage = "https://github.com/miracle2k/flask-assets";
description = "Asset management for Flask, to compress and merge CSS and Javascript files";
license = licenses.bsd2;
maintainers = with maintainers; [ abbradar ];
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ abbradar ];
};
}
58 changes: 45 additions & 13 deletions pkgs/development/python-modules/webassets/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,72 @@
lib,
buildPythonPackage,
fetchPypi,
setuptools,
pyyaml,
nose,
jinja2,
mock,
pytest,
fetchpatch2,
pytestCheckHook,
distutils,
}:

buildPythonPackage rec {
pname = "webassets";
version = "2.0";
format = "setuptools";
pyproject = true;

src = fetchPypi {
inherit pname version;
sha256 = "1kc1042jydgk54xpgcp0r1ib4gys91nhy285jzfcxj3pfqrk4w8n";
hash = "sha256-FnEyM3Z3yM7clwUJD21I2j+yYsjgsnc7KfM1LwUBgc0=";
};

propagatedBuildInputs = [ pyyaml ];
patches = [
# remove nose and extra mock
(fetchpatch2 {
name = "remove-nose-and-mock.patch";
url = "https://github.com/miracle2k/webassets/commit/26e203929eebbb4cdbb9967cf47fefa95df8f24d.patch?full_index=1";
hash = "sha256-+jrMT6Sl/MOLkleUEDZkzRd5tzBTXZYNoCXRrTFVtq4=";
excludes = [
"requirements-dev.pip"
"tox.ini"
];
})
(fetchpatch2 {
name = "fix-missing-zope-skip.patch";
url = "https://github.com/miracle2k/webassets/commit/3bfb5ea8223c46c60b922fdbbda36d9b8c5e9c9c.patch?full_index=1";
hash = "sha256-dV8bp6vYr56mZpzw5C7ac4rXri04o4MrAhwfWUXLe4s=";
})
./migrate_test_setup_to_pytest.patch
];

build-system = [ setuptools ];

dependencies = [ pyyaml ];

nativeCheckInputs = [
nose
jinja2
mock
pytest
pytestCheckHook
distutils
];

# Needs Babel CLI tool
doCheck = false;
checkPhase = "py.test";
postPatch = ''
# Fix thread attribute "isAlive"
substituteInPlace tests/test_script.py \
--replace-fail "isAlive" "is_alive"
'';

disabledTests = [
"TestFilterBaseClass"
"TestAutoprefixer6Filter"
"TestBabel"
];

meta = with lib; {
meta = {
description = "Media asset management for Python, with glue code for various web frameworks";
mainProgram = "webassets";
homepage = "https://github.com/miracle2k/webassets/";
license = licenses.bsd2;
maintainers = with maintainers; [ abbradar ];
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ abbradar ];
};
}
Loading

0 comments on commit df70905

Please sign in to comment.