[Bug 275997] devel/py-joblib: Add BSD support to CPU count check

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 29 Dec 2023 13:59:28 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=275997

            Bug ID: 275997
           Summary: devel/py-joblib: Add BSD support to CPU count check
           Product: Ports & Packages
           Version: Latest
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Some People
          Priority: ---
         Component: Individual Port(s)
          Assignee: skreuzer@FreeBSD.org
          Reporter: jwb@freebsd.org
             Flags: maintainer-feedback?(skreuzer@FreeBSD.org)
          Assignee: skreuzer@FreeBSD.org

---
/usr/ports/devel/py-joblib/files/patch-joblib_externals_loky_backend_context.py
    1969-12-31 18:00:00.000000000 -0600
+++
/usr/ports/wip/py-joblib/files/patch-joblib_externals_loky_backend_context.py  
    2023-12-29 07:58:36.334877000 -0600
@@ -0,0 +1,18 @@
+--- joblib/externals/loky/backend/context.py.orig      2023-06-29 15:14:21 UTC
++++ joblib/externals/loky/backend/context.py
+@@ -274,6 +274,15 @@ def _count_physical_cores():
+             )
+             cpu_info = cpu_info.stdout
+             cpu_count_physical = int(cpu_info)
++        # Maybe also openbsd, dragonfly, etc?
++        elif sys.platform.startswith('freebsd') or
sys.platform.startswith('netbsd'):
++            cpu_info = subprocess.run(
++                "sysctl -n hw.ncpu".split(),
++                capture_output=True,
++                text=True,
++            )
++            cpu_info = cpu_info.stdout
++            cpu_count_physical = int(cpu_info)
+         else:
+             raise NotImplementedError(f"unsupported platform:
{sys.platform}")
+

-- 
You are receiving this mail because:
You are the assignee for the bug.