|
63 | 63 | # http://www.gnu.org/licenses/
|
64 | 64 | ################################################################################
|
65 | 65 | from sage.cpython.string import bytes_to_str
|
66 |
| -from sage.env import SAGE_NAUTY_BINS_PREFIX as nautyprefix |
67 | 66 |
|
68 | 67 | import sys
|
69 | 68 | from sage.misc.randstate import current_randstate
|
@@ -528,7 +527,12 @@ def tournaments_nauty(self, n,
|
528 | 527 |
|
529 | 528 | nauty_input += " " + str(n) + " "
|
530 | 529 |
|
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, |
532 | 536 | stdin=subprocess.PIPE, stdout=subprocess.PIPE,
|
533 | 537 | stderr=subprocess.PIPE, close_fds=True)
|
534 | 538 |
|
@@ -636,8 +640,13 @@ def nauty_directg(self, graphs, options="", debug=False):
|
636 | 640 | options += ' -q'
|
637 | 641 |
|
638 | 642 | # 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), |
641 | 650 | shell=True,
|
642 | 651 | stdout=subprocess.PIPE,
|
643 | 652 | stdin=subprocess.PIPE,
|
|
0 commit comments