Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python312Packages.{webassets, flask-assets}: remove nose; modernize #348621

Merged
merged 5 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"
'';
Comment on lines +24 to +28
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what’s going on here? Was it broken already or do the changes in this PR somehow make this necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see, it’s adapting for the changes in webassets.test. Okay, that seems fine then; hopefully upstream will release and the ecosystem will adapt at some point so that we no longer need to carry this.


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