Merge pull request #337099 from sarahec/scalene-src-build

This commit is contained in:
Franz Pletz 2024-08-25 14:16:05 +02:00 committed by GitHub
commit 428161db29
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 96 additions and 10 deletions

View File

@ -0,0 +1,23 @@
From 4e25ccee2f1eeed1dfdd9356b4fde511a48d9f01 Mon Sep 17 00:00:00 2001
From: Sarah Clark <seclark@nextquestion.net>
Date: Sat, 24 Aug 2024 11:32:38 -0700
Subject: [PATCH] Update MANIFEST.in to remove .git references
---
MANIFEST.in | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/MANIFEST.in b/MANIFEST.in
index 5ebcb7781..7340b1982 100644
--- a/MANIFEST.in
+++ b/MANIFEST.in
@@ -1,5 +1,5 @@
graft vendor/Heap-Layers
-prune vendor/Heap-Layers/.git
+# prune vendor/Heap-Layers/.git
graft vendor/printf
-prune vendor/printf/.git
+# prune vendor/printf/.git
exclude scalene/old/*
--

View File

@ -0,0 +1,23 @@
From 777be9c46c4caed5f3fcde65b70ada4d773f4298 Mon Sep 17 00:00:00 2001
From: Sarah Clark <seclark@nextquestion.net>
Date: Sat, 24 Aug 2024 11:26:30 -0700
Subject: [PATCH] Unpin setuptools
---
pyproject.toml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pyproject.toml b/pyproject.toml
index d17d12dc8..6bf1c7a38 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -54,7 +54,7 @@ scalene = "scalene.__main__:main"
[build-system]
build-backend = "setuptools.build_meta"
requires = [
- "setuptools>=65.5.1,<71.0", # Pin to setuptools<71.0 to avoid this bug: https://github.com/pypa/setuptools/issues/4496
+ "setuptools>=65.5.1",
"setuptools_scm>=8",
"wheel",
"cython",
--

View File

@ -2,33 +2,67 @@
lib,
stdenv,
buildPythonPackage,
hypothesis,
fetchPypi,
setuptools,
setuptools-scm,
fetchFromGitHub,
cloudpickle,
cython,
hypothesis,
jinja2,
numpy,
nvidia-ml-py,
psutil,
pynvml,
nvidia-ml-py,
pytestCheckHook,
pythonOlder,
rich,
setuptools-scm,
setuptools,
}:
let
heap-layers-src = fetchFromGitHub {
owner = "emeryberger";
repo = "heap-layers";
name = "Heap-Layers";
rev = "a2048eae91b531dc5d72be7a194e0b333c06bd4c";
sha256 = "sha256-vl3z30CBX7hav/DM/UE0EQ9lLxZF48tMJrYMXuSulyA=";
};
printf-src = fetchFromGitHub {
owner = "mpaland";
repo = "printf";
name = "printf";
rev = "v4.0.0";
sha256 = "sha256-tgLJNJw/dJGQMwCmfkWNBvHB76xZVyyfVVplq7aSJnI=";
};
in
buildPythonPackage rec {
pname = "scalene";
version = "1.5.43.2";
version = "1.5.44.1";
pyproject = true;
disabled = pythonOlder "3.9";
src = fetchPypi {
inherit pname version;
hash = "sha256-LtD7v3pLz4UCnh6xlhkPdcEjyu3mt+YQPYZ0nNCLuDw=";
src = fetchFromGitHub {
owner = "plasma-umass";
repo = "scalene";
rev = "v${version}";
hash = "sha256-XMz+gwiNaKiKplD4kOE1yhcg+dkzjEdDYjW0JsDEMQE=";
};
patches = [
./01-manifest-no-git.patch
./02-pyproject-unpin-setuptools.patch
];
prePatch = ''
cp -r ${heap-layers-src} vendor/Heap-Layers
mkdir vendor/printf
cp ${printf-src}/printf.c vendor/printf/printf.cpp
cp -r ${printf-src}/* vendor/printf
sed -i"" 's/^#define printf printf_/\/\/&/' vendor/printf/printf.h
sed -i"" 's/^#define vsnprintf vsnprintf_/\/\/&/' vendor/printf/printf.h
'';
nativeBuildInputs = [
cython
setuptools
@ -38,9 +72,10 @@ buildPythonPackage rec {
propagatedBuildInputs = [
cloudpickle
jinja2
numpy
psutil
rich
pynvml
rich
] ++ lib.optionals stdenv.hostPlatform.isLinux [ nvidia-ml-py ];
pythonRemoveDeps = [
@ -56,6 +91,11 @@ buildPythonPackage rec {
numpy
];
disabledTests = [
# Flaky -- socket collision
"test_show_browser"
];
# remove scalene directory to prevent pytest import confusion
preCheck = ''
rm -rf scalene