void-packages/srcpkgs/sagemath/patches/35204-fix_sage-cleaner.patch
Gonzalo Tornaría b34d0bbd28 sagemath: rebuild for singular update
Also fix doctests for pkg updates:
 - matplotlib 3.7
 - ipython 8.12
 - nauty 2.8.6
 - pythran 0.12.1

And add support for:
 - networkx 3.1

We use patches from upstream sagemath to fix all of these.

We also add pythran and sphinx to checkdepends to make sure doctests
pass when they are installed.
2023-05-01 00:15:47 +02:00

28 lines
950 B
Diff

diff --git a/src/bin/sage-cleaner b/src/bin/sage-cleaner
index e2e578eec60..dc7d8f0482e 100755
--- a/src/bin/sage-cleaner
+++ b/src/bin/sage-cleaner
@@ -99,6 +99,15 @@ def cleanup():
return len(pid_list)
+def cleanup_cruft():
+ """ remove directories leftover from improper shutdown """
+ tmp_dirs = os.listdir(SAGE_TMP_ROOT)
+ for dir_entry in tmp_dirs:
+ baddir = os.path.join(SAGE_TMP_ROOT, dir_entry)
+ if os.path.isdir(baddir):
+ logger.warning('Removing old directory %s from SAGE_TMP_ROOT', baddir)
+ rm_rf(baddir)
+
def kill_spawned_jobs(jobfile, parent_pid):
logger.info("Killing %s's spawned jobs", parent_pid)
killed_them_all = True
@@ -193,6 +202,7 @@ if __name__ == '__main__':
setup_daemon()
fix_old_mistakes()
logger.info("Starting sage-cleaner with PID %s", os.getpid())
+ cleanup_cruft()
if len(sys.argv) > 1:
wait = int(sys.argv[1])