Skip to content
Merged
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
49 changes: 29 additions & 20 deletions pkgs/development/python-modules/weasyprint/default.nix
Original file line number Diff line number Diff line change
@@ -1,39 +1,45 @@
{
stdenv,
lib,
stdenv,
pkgs,
buildPythonPackage,
cffi,
cssselect2,
fetchPypi,
flit-core,
fetchFromGitHub,
fontconfig,
fonttools,
glib,
harfbuzz,
pango,

# build-system
flit-core,

# dependencies
cffi,
cssselect2,
fonttools,
pillow,
pydyf,
pyphen,
tinycss2,
tinyhtml5,

# tests
pytest-cov-stub,
pytestCheckHook,
pythonOlder,
replaceVars,
tinycss2,
tinyhtml5,
versionCheckHook,
writableTmpDirAsHomeHook,
}:

buildPythonPackage rec {
pname = "weasyprint";
version = "65.1";
pyproject = true;

disabled = pythonOlder "3.9";

src = fetchPypi {
inherit version;
pname = "weasyprint";
hash = "sha256-EgKBvb1C/6p9flztvjGCos7zbqWtl/6fNX5DvmoeWOo=";
src = fetchFromGitHub {
owner = "Kozea";
repo = "WeasyPrint";
tag = "v${version}";
hash = "sha256-iSeuRX1dnnrGZbcb1yTxOJPD5kgIWY6oz/0v02QJqSs=";
};

patches = [
Expand Down Expand Up @@ -64,7 +70,10 @@ buildPythonPackage rec {
pkgs.ghostscript
pytest-cov-stub
pytestCheckHook
versionCheckHook
writableTmpDirAsHomeHook
];
versionCheckProgramArg = "--version";

disabledTests = [
# needs the Ahem font (fails on macOS)
Expand Down Expand Up @@ -93,11 +102,6 @@ buildPythonPackage rec {
# Set env variable explicitly for Darwin, but allow overriding when invoking directly
makeWrapperArgs = [ "--set-default FONTCONFIG_FILE ${FONTCONFIG_FILE}" ];

preCheck = ''
# Fontconfig wants to create a cache.
export HOME=$TMPDIR
'';

pythonImportsCheck = [ "weasyprint" ];

meta = {
Expand All @@ -107,5 +111,10 @@ buildPythonPackage rec {
homepage = "https://weasyprint.org/";
license = lib.licenses.bsd3;
teams = [ lib.teams.apm ];
badPlatforms = [
# Fatal Python error: Segmentation fault
# "...weasyprint/pdf/fonts.py", line 221 in _harfbuzz_subset
lib.systems.inspect.patterns.isDarwin
];
Comment on lines +114 to +118

@DutchGerman DutchGerman May 30, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is 406734 not fixing this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Apparently not. The package still fails on master.

@DutchGerman DutchGerman Jun 3, 2025

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see, it's still on staging (https://nixpk.gs/pr-tracker.html?pr=406734). We might want to check if this is still needed when it hits master

};
}