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: drop nose dependency #334483

Closed
wants to merge 2 commits into from
Closed
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
30 changes: 19 additions & 11 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,16 +14,25 @@ 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 = [
(fetchpatch2 {
url = "https://github.com/miracle2k/flask-assets/commit/56e06dbb160c165e0289ac97496354786fe3f3fd.patch?full_index=1";
hash = "sha256-Feo7gHHmHtWRB+3XvlECdU4i5rpyjyKEYEUCuy24rf4=";
})
];

postPatch = ''
substituteInPlace tests/test_integration.py \
--replace-fail 'static_path=' 'static_url_path=' \
--replace-fail "static_folder = '/'" "static_folder = '/x'" \
--replace-fail "'/foo'" "'/x/foo'"
'';

nativeBuildInputs = [ setuptools ];
Expand All @@ -32,8 +42,6 @@ buildPythonPackage rec {
webassets
];

doCheck = false; # tests are broken with webassets 2.0

nativeCheckInputs = [ pytestCheckHook ];

pythonImportsCheck = [ "flask_assets" ];
Expand Down
52 changes: 39 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,66 @@
lib,
buildPythonPackage,
fetchPypi,
setuptools,
pyyaml,
nose,
jinja2,
mock,
pytest,
fetchpatch2,
pytestCheckHook,
}:

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 {
url = "https://github.com/miracle2k/webassets/commit/26e203929eebbb4cdbb9967cf47fefa95df8f24d.patch?full_index=1";
hash = "sha256-+jrMT6Sl/MOLkleUEDZkzRd5tzBTXZYNoCXRrTFVtq4=";
excludes = [
"requirements-dev.pip"
"tox.ini"
];
})
(fetchpatch2 {
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
];

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

disabledTestPaths = [
"tests/test_filters.py" # no module "distutils"
Copy link
Member

Choose a reason for hiding this comment

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

Did you try adding setuptools?

Copy link
Member Author

Choose a reason for hiding this comment

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

in nativeCheckInputs?

Copy link
Member Author

Choose a reason for hiding this comment

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

Still the same outcome:

____________________ ERROR collecting tests/test_filters.py ____________________
ImportError while importing test module '/build/webassets-2.0/tests/test_filters.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/nix/store/l014xp1qxdl6gim3zc0jv3mpxhbp346s-python3-3.12.4/lib/python3.12/importlib/__init__.py:90: in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
tests/test_filters.py:15: in <module>
    from distutils.spawn import find_executable
E   ModuleNotFoundError: No module named 'distutils'

Copy link
Member

Choose a reason for hiding this comment

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

Try adding distutils to dependencies or nativeCheckInputs as appropriate.

];

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