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

Commit

Permalink
DiGraphGenerators: Use NautyExecutable(...).absolute_filename()
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthias Koeppe committed Mar 7, 2022
1 parent ede2c3d commit 9e6892d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions src/sage/graphs/digraph_generators.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
# http://www.gnu.org/licenses/
################################################################################
from sage.cpython.string import bytes_to_str
from sage.env import SAGE_NAUTY_BINS_PREFIX as nautyprefix

import sys
from sage.misc.randstate import current_randstate
Expand Down Expand Up @@ -528,7 +527,12 @@ def tournaments_nauty(self, n,

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

sp = subprocess.Popen(nautyprefix+"gentourng {0}".format(nauty_input), shell=True,
import shlex
from sage.features.nauty import NautyExecutable
gentourng_path = NautyExecutable("gentourng").absolute_filename()

sp = subprocess.Popen(shlex.quote(gentourng_path) + " {0}".format(nauty_input),
shell=True,
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
stderr=subprocess.PIPE, close_fds=True)

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

# Build directg input (graphs6 format)
input = ''.join(g.graph6_string()+'\n' for g in graphs)
sub = subprocess.Popen(nautyprefix+'directg {0}'.format(options),
input = ''.join(g.graph6_string() + '\n' for g in graphs)

import shlex
from sage.features.nauty import NautyExecutable
directg_path = NautyExecutable("directg").absolute_filename()

sub = subprocess.Popen(shlex.quote(directg_path) + ' {0}'.format(options),
shell=True,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE,
Expand Down

0 comments on commit 9e6892d

Please sign in to comment.