Unverified Commit 1cd75316 authored by Marcel's avatar Marcel
Browse files

python3Packages.selectolax: init at 0.4.3

parent 654dac01
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
From f0e18a73f15f9cf0d60a25304e212e10bc206c53 Mon Sep 17 00:00:00 2001
From: Marcel <me@m4rc3l.de>
Date: Fri, 21 Nov 2025 03:29:50 +0100
Subject: [PATCH] setup.py: devendor modest and lexbor

---
 setup.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/setup.py b/setup.py
index 618e989..bf7028e 100644
--- a/setup.py
+++ b/setup.py
@@ -163,9 +163,9 @@ def make_extensions():
                 files_to_compile,
                 language="c",
                 include_dirs=[
-                    "modest/include/",
+                    "@modest@/include/",
                 ],
-                extra_objects=extra_objects,
+                libraries=["modest"],
                 extra_compile_args=compile_arguments,
             )
         )
@@ -177,9 +177,9 @@ def make_extensions():
                 files_to_compile_lxb,
                 language="c",
                 include_dirs=[
-                    "lexbor/source/",
+                    "@lexbor@/include/",
                 ],
-                extra_objects=extra_objects_lxb,
+                libraries=["lexbor"],
                 extra_compile_args=compile_arguments_lxb,
             )
         )
-- 
2.50.1
+62 −0
Original line number Diff line number Diff line
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  replaceVars,
  setuptools,
  cython,
  modest,
  lexbor,
  pytestCheckHook,
}:

buildPythonPackage rec {
  pname = "selectolax";
  version = "0.4.3";
  pyproject = true;

  src = fetchFromGitHub {
    owner = "rushter";
    repo = "selectolax";
    tag = "v${version}";
    hash = "sha256-1xoHMQzoO0NYi5gJsV++Ngvkaf/O3U14nYkJLvzzbrQ=";
  };

  patches = [
    (replaceVars ./0001-setup.py-devendor-modest-and-lexbor.patch {
      modest = lib.getDev modest;
      lexbor = lib.getDev lexbor;
    })
  ];

  build-system = [
    setuptools
    cython
  ];

  buildInputs = [
    modest
    lexbor
  ];

  nativeCheckInputs = [
    pytestCheckHook
  ];

  preCheck = ''
    # shadows name and breaks imports in tests
    rm -rf selectolax
  '';

  pythonImportsCheck = [
    "selectolax"
  ];

  meta = {
    description = "Python binding to Modest and Lexbor engines. Fast HTML5 parser with CSS selectors for Python";
    homepage = "https://github.com/rushter/selectolax";
    changelog = "https://github.com/rushter/selectolax/blob/${src.tag}/CHANGES.md";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ marcel ];
  };
}
+2 −0
Original line number Diff line number Diff line
@@ -16793,6 +16793,8 @@ self: super: with self; {
  segyio = callPackage ../development/python-modules/segyio { inherit (pkgs) cmake ninja; };
  selectolax = callPackage ../development/python-modules/selectolax { };
  selenium = callPackage ../development/python-modules/selenium { };
  selenium-wire = callPackage ../development/python-modules/selenium-wire { };