Esempio n. 1
0
    def makeWrapper(self):
        """
        Start gnuplot and return wrapper around the REPL
        """
        if pexpect.which('gnuplot'):
            program = 'gnuplot'
        elif pexpect.which('gnuplot.exe'):
            program = 'gnuplot.exe'
        else:
            raise Exception("gnuplot not found.")

        # We don't want help commands getting stuck,
        # use a non interactive PAGER
        if pexpect.which('env') and pexpect.which('cat'):
            command = 'env PAGER=cat {}'.format(program)
        else:
            command = program

        d = dict(cmd_or_spawn=command,
                 prompt_regex=u('\w*> $'),
                 prompt_change_cmd=None)
        wrapper = GnuplotREPLWrapper(**d)
        # No sleeping before sending commands to gnuplot
        wrapper.child.delaybeforesend = 0
        return wrapper
Esempio n. 2
0
 def _get_executable(self):
     """Find the best octave executable.
     """
     # Attempt to get the octave executable
     executable = os.environ.get('OCTAVE_EXECUTABLE', None)
     if executable:
         executable = which(executable)
         if 'octave-cli' not in executable:
             raise OSError('OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README')
     else:
         executable = which('octave-cli')
         if not executable:
             raise OSError('octave-cli not found, please see README')
     return executable.replace(os.path.sep, '/')
Esempio n. 3
0
 def _get_executable(self):
     """Find the best octave executable.
     """
     executable = os.environ.get('OCTAVE_EXECUTABLE', None)
     if not executable or not which(executable):
         if which('octave-cli'):
             executable = 'octave-cli'
         elif which('octave'):
             executable = 'octave'
         else:
             msg = ('Octave Executable not found, please add to path or set'
                    '"OCTAVE_EXECUTABLE" environment variable')
             raise OSError(msg)
     executable = executable.replace(os.path.sep, '/')
     return executable
Esempio n. 4
0
 def executable(self):
     if self._executable:
         return self._executable
     executable = os.environ.get('SCILAB_EXECUTABLE', None)
     if not executable or not which(executable):
         if os.name == 'nt':
             executable = 'Scilex'
         else:
             executable = 'scilab'
         if not which(executable):
             msg = ('Scilab Executable not found, please add to path or set'
                    '"SCILAB_EXECUTABLE" environment variable')
             raise OSError(msg)
     self._executable = executable
     return executable
Esempio n. 5
0
 def _get_executable(self):
     """Find the best RevBayes executable.
     """
     executable = os.environ.get('REVBAYES_JUPYTER_EXECUTABLE', None)
     if not executable or not which(executable):
         if which('rb-jupyter'):
             executable = 'rb-jupyter'
         else:
             msg = (
                 'RevBayes Executable not found, please add to path or set',
                 '\"REVBAYES_JUPYTER_EXECUTABLE\" environment variable.',
                 'See README.md for instructions to build rb-jupyter.')
             raise OSError(msg)
     executable = executable.replace(os.path.sep, '/')
     return executable
Esempio n. 6
0
 def executable(self):
     if self._executable:
         return self._executable
     executable = os.environ.get('PSYSH_EXECUTABLE', None)
     if not executable or not which(executable):
         if which('psysh'):
             self._executable = 'psysh'
             return self._executable
         else:
             msg = ('PsySH executable not found, please add to path or set'
                    '"PSYSH_EXECUTABLE" environment variable')
             raise OSError(msg)
     else:
         self._executable = executable
         return executable
Esempio n. 7
0
 def executable(self):
     if self._executable:
         return self._executable
     executable = os.environ.get('SCILAB_EXECUTABLE', None)
     if not executable or not which(executable):
         if os.name == 'nt':
             executable = 'Scilex'
         else:
             executable = 'scilab'
         if not which(executable):
             msg = ('Scilab Executable not found, please add to path or set'
                    '"SCILAB_EXECUTABLE" environment variable')
             raise OSError(msg)
     self._executable = executable
     return executable
Esempio n. 8
0
 def _get_executable(self):
     """Find the best octave executable.
     """
     # Attempt to get the octave executable
     executable = os.environ.get('OCTAVE_EXECUTABLE', None)
     if executable:
         executable = which(executable)
         if 'octave-cli' not in executable:
             raise OSError(
                 'OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README'
             )
     else:
         executable = which('octave-cli')
         if not executable:
             raise OSError('octave-cli not found, please see README')
     return executable.replace(os.path.sep, '/')
Esempio n. 9
0
 def _get_executable(self):
     """Find the best maude executable.
     """
     executable = os.environ.get('MAUDE_EXECUTABLE', None)
     if not executable or not which(executable):
         if sys.platform == 'darwin':
             if which('maude.darwin64'):
                 executable = 'maude.darwin64'
         elif which('maude.linux64'):
             executable = 'maude.linux64'
         else:
             msg = ('Maude Executable not found, please add to path or set'
                    '"MAUDE_EXECUTABLE" environment variable')
             raise OSError(msg)
     executable = executable.replace(os.path.sep, '/')
     return executable
Esempio n. 10
0
    def start_process(self):
        if self.repl is not None:
            self.repl.child.terminate()

        if not self.cmd:
            if os.name == 'nt':
                self.cmd = 'cmd'
                self.repl = cmd()
            elif pexpect.which('bash'):
                self.cmd = 'bash'
                self.repl = bash()
            elif pexpect.which('sh'):
                self.cmd = 'sh'
                self.repl = bash(command='sh')
            else:
                msg = "The command was not found or was not executable: sh"
                raise Exception(msg)
Esempio n. 11
0
    def start_process(self):
        if self.repl is not None:
            self.repl.child.terminate()

        if not self.cmd:
            if os.name == 'nt':
                self.cmd = 'cmd'
                self.repl = cmd()
            elif pexpect.which('bash'):
                self.cmd = 'bash'
                self.repl = bash()
            elif pexpect.which('sh'):
                self.cmd = 'sh'
                self.repl = bash(command='sh')
            else:
                msg = "The command was not found or was not executable: sh"
                raise Exception(msg)
Esempio n. 12
0
 def executable(self):
     if self._executable:
         return self._executable
     executable = os.environ.get('OCTAVE_EXECUTABLE', None)
     if not executable or not which(executable):
         if which('octave-cli'):
             self._executable = 'octave-cli'
             return self._executable
         elif which('octave'):
             self._executable = 'octave'
             return self._executable
         else:
             msg = ('Octave Executable not found, please add to path or set'
                    '"OCTAVE_EXECUTABLE" environment variable')
             raise OSError(msg)
     else:
         self._executable = executable
         return executable
Esempio n. 13
0
 def executable(self):
     if self._executable:
         return self._executable
     executable = os.environ.get('OCTAVE_EXECUTABLE', None)
     if not executable or not which(executable):
         if which('octave-cli'):
             self._executable = 'octave-cli'
             return self._executable
         elif which('octave'):
             self._executable = 'octave'
             return self._executable
         else:
             msg = ('Octave Executable not found, please add to path or set'
                    '"OCTAVE_EXECUTABLE" environment variable')
             raise OSError(msg)
     else:
         self._executable = executable
         return executable
Esempio n. 14
0
    def start_process(self):
        if not self.repl is None:
            self.repl.child.terminate()

        if not self.cmd:
            try:
                pexpect.which('bash')
            except Exception as e:  # pragma: no cover

                if os.name == 'nt':
                    self.cmd = 'cmd'
                else:
                    raise (e)
            else:
                self.cmd = 'bash'

        if self.cmd == 'cmd':
            self.repl = cmd()
        else:
            self.repl = bash()
Esempio n. 15
0
    def start_process(self):
        if not self.repl is None:
            self.repl.child.terminate()

        if not self.cmd:
            try:
                pexpect.which('bash')
            except Exception as e:  # pragma: no cover

                if os.name == 'nt':
                    self.cmd = 'cmd'
                else:
                    raise(e)
            else:
                self.cmd = 'bash'

        if self.cmd == 'cmd':
            self.repl = cmd()
        else:
            self.repl = bash()
Esempio n. 16
0
    def makeWrapper(self):
        """
        Start gnuplot and return wrapper around the REPL
        """
        if not pexpect.which('gnuplot'):
            raise Exception("gnuplot not found.")

        # We don't want help commands getting stuck,
        # use a non interactive PAGER
        command = 'env PAGER=cat gnuplot'
        d = dict(cmd_or_spawn=command,
                 prompt_regex=u('\w*> $'),
                 prompt_change_cmd=None)
        wrapper = GnuplotREPLWrapper(**d)
        # No sleeping before sending commands to gnuplot
        wrapper.child.delaybeforesend = 0
        return wrapper