dragnpkgs/pkgs/crypto/cado-nfs/0001-use-PATH-lookup-for-no...

73 lines
2.4 KiB
Diff
Raw Normal View History

2024-11-21 03:30:32 +00:00
From b5e7381235ed64b58b267af8f796c50b01900464 Mon Sep 17 00:00:00 2001
From: xenia <xenia@awoo.systems>
Date: Wed, 20 Nov 2024 22:16:47 -0500
Subject: [PATCH] use PATH lookup for non-cado programs
---
scripts/cadofactor/cadoprograms.py | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/cadofactor/cadoprograms.py b/scripts/cadofactor/cadoprograms.py
index 6743480e1..946771f83 100755
--- a/scripts/cadofactor/cadoprograms.py
+++ b/scripts/cadofactor/cadoprograms.py
@@ -1,4 +1,5 @@
import os
+import shutil
import platform
import abc
import inspect
@@ -327,6 +328,8 @@ class Program(object, metaclass=InspectType):
# class attributes, which properties can't. Ergo dummy variables
binary = None
+ use_which = False
+
# This class variable definition should not be here. It gets overwritten
# when the InspectType meta-class creates the class object. The only purpose
# is to make pylint shut up about the class not having an init_signature
@@ -408,6 +411,8 @@ class Program(object, metaclass=InspectType):
self.execfile = execsubfile
elif os.path.isfile(execfile):
self.execfile = execfile
+ elif self.use_which and shutil.which(binary) is not None:
+ self.execfile = shutil.which(binary)
else:
self.execfile = os.sep.join([self.subdir, binary])
if not skip_check_binary_exists:
@@ -1251,6 +1256,7 @@ class SSH(Program):
binary = "ssh"
name = binary
path = "/usr/bin"
+ use_which = True
def __init__(self,
host: PositionalParameter(),
*args: PositionalParameter(),
@@ -1268,6 +1274,7 @@ class RSync(Program):
binary = "rsync"
name = binary
path = "/usr/bin"
+ use_which = True
def __init__(self,
sourcefile: PositionalParameter(),
remotefile: PositionalParameter(),
@@ -1278,6 +1285,7 @@ class Ls(Program):
binary = "ls"
name = binary
path = "/bin"
+ use_which = True
def __init__(self,
*args : PositionalParameter(),
long : Toggle('l')=None,
@@ -1288,6 +1296,7 @@ class Kill(Program):
binary = "kill"
name = binary
path = "/bin"
+ use_which = True
def __init__(self,
*args: PositionalParameter(),
signal: Parameter("s"),
--
2.44.2