Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 9e6892d

Browse files
author
Matthias Koeppe
committed
DiGraphGenerators: Use NautyExecutable(...).absolute_filename()
1 parent ede2c3d commit 9e6892d

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/sage/graphs/digraph_generators.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
# http://www.gnu.org/licenses/
6464
################################################################################
6565
from sage.cpython.string import bytes_to_str
66-
from sage.env import SAGE_NAUTY_BINS_PREFIX as nautyprefix
6766

6867
import sys
6968
from sage.misc.randstate import current_randstate
@@ -528,7 +527,12 @@ def tournaments_nauty(self, n,
528527

529528
nauty_input += " " + str(n) + " "
530529

531-
sp = subprocess.Popen(nautyprefix+"gentourng {0}".format(nauty_input), shell=True,
530+
import shlex
531+
from sage.features.nauty import NautyExecutable
532+
gentourng_path = NautyExecutable("gentourng").absolute_filename()
533+
534+
sp = subprocess.Popen(shlex.quote(gentourng_path) + " {0}".format(nauty_input),
535+
shell=True,
532536
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
533537
stderr=subprocess.PIPE, close_fds=True)
534538

@@ -636,8 +640,13 @@ def nauty_directg(self, graphs, options="", debug=False):
636640
options += ' -q'
637641

638642
# Build directg input (graphs6 format)
639-
input = ''.join(g.graph6_string()+'\n' for g in graphs)
640-
sub = subprocess.Popen(nautyprefix+'directg {0}'.format(options),
643+
input = ''.join(g.graph6_string() + '\n' for g in graphs)
644+
645+
import shlex
646+
from sage.features.nauty import NautyExecutable
647+
directg_path = NautyExecutable("directg").absolute_filename()
648+
649+
sub = subprocess.Popen(shlex.quote(directg_path) + ' {0}'.format(options),
641650
shell=True,
642651
stdout=subprocess.PIPE,
643652
stdin=subprocess.PIPE,

0 commit comments

Comments
 (0)