예제 #1
0
def create_program_action(parent, text, icon, name, nt_name=None):
    """Create action to run a program"""
    if os.name == 'nt':
        if nt_name is not None:
            name = nt_name
        name = programs.get_nt_program_name(name)
    if isinstance(icon, basestring):
        icon = get_icon(icon)
    if programs.is_program_installed(name):
        return create_action(parent, text, icon=icon,
                             triggered=lambda: programs.run_program(name))
예제 #2
0
def create_program_action(parent, text, icon, name, nt_name=None):
    """Create action to run a program"""
    if os.name == 'nt':
        if nt_name is None:
            name += ".exe"
        else:
            name = nt_name
    if isinstance(icon, basestring):
        icon = get_icon(icon)
    if programs.is_program_installed(name):
        return create_action(parent,
                             text,
                             icon=icon,
                             triggered=lambda: programs.run_program(name))
예제 #3
0
 def get_default_ipython_options(self):
     """Return default ipython command line arguments"""
     default_options = []
     if programs.is_module_installed('matplotlib'):
         default_options.append("-pylab")
     else:
         default_options.append("-q4thread")
     default_options.append("-colors LightBG")
     default_options.append("-xmode Plain")
     for editor_name in ("scite", "gedit"):
         real_name = programs.get_nt_program_name(editor_name)
         if programs.is_program_installed(real_name):
             default_options.append("-editor "+real_name)
             break
     return " ".join(default_options)
예제 #4
0
def get_checker_executable(name):
    """Return checker executable in the form of a list of arguments
    for subprocess.Popen"""
    if programs.is_program_installed(name):
        # Checker is properly installed
        return [name]
    else:
        path1 = programs.python_script_exists(package=None,
                                              module=name+'_script')
        path2 = programs.python_script_exists(package=None, module=name)
        if path1 is not None:  # checker_script.py is available
            # Checker script is available but has not been installed
            # (this may work with pyflakes)
            return [sys.executable, path1]
        elif path2 is not None:  # checker.py is available
            # Checker package is available but its script has not been
            # installed (this works with pep8 but not with pyflakes)
            return [sys.executable, path2]
예제 #5
0
def get_checker_executable(name):
    """Return checker executable in the form of a list of arguments
    for subprocess.Popen"""
    if programs.is_program_installed(name):
        # Checker is properly installed
        return [name]
    else:
        path1 = programs.python_script_exists(package=None,
                                              module=name + '_script')
        path2 = programs.python_script_exists(package=None, module=name)
        if path1 is not None:  # checker_script.py is available
            # Checker script is available but has not been installed
            # (this may work with pyflakes)
            return [sys.executable, path1]
        elif path2 is not None:  # checker.py is available
            # Checker package is available but its script has not been
            # installed (this works with pep8 but not with pyflakes)
            return [sys.executable, path2]
예제 #6
0
        if osp.isfile(nsis_exe):
            break
    else:
        raise RuntimeError("NSIS is not installed on this computer.")

    for fname in nsis_files:
        os.system('"%s" %s' % (nsis_exe, fname))

def get_pythonxy_plugindir(name):
    """Searching Python(x,y) plugin directory in current working directory"""
    for fname in os.listdir(getcwd()):
        path = osp.abspath(osp.join(fname, 'src', 'python', name))
        if osp.isdir(path):
            # Also create the binary directory if it does not exist yet:
            def create_dir(path):
                if not osp.isdir(path):
                    os.mkdir(path)
            create_dir(osp.join(fname, 'bin'))
            create_dir(osp.join(fname, 'bin', 'python'))
            return path

## Building Python(x,y) plugin on Windows platforms, if 'unzip.exe' is available
## and if the `pythonxy` repository exists:
from spyderlib.utils import programs
unzip_exe = 'unzip.exe'
plugin_dir = get_pythonxy_plugindir(name)
if programs.is_program_installed(unzip_exe) and plugin_dir:
    extract_exe_dist(plugin_dir, exe_dist)
    include_chm_doc(plugin_dir)
    build_pythonxy_plugin(plugin_dir, version)
예제 #7
0
def is_hg_installed():
    return is_program_installed('hg.exe' if os.name == 'nt' else 'hg')
예제 #8
0
def is_pylint_installed():
    return is_program_installed(PYLINT_PATH)
예제 #9
0
def is_pylint_installed():
    return is_program_installed(PYLINT_PATH)
예제 #10
0
def is_hg_installed():
    return is_program_installed('hg.exe' if os.name == 'nt' else 'hg')
예제 #11
0
        raise RuntimeError("NSIS is not installed on this computer.")

    for fname in nsis_files:
        os.system('"%s" %s' % (nsis_exe, fname))


def get_pythonxy_plugindir(name):
    """Searching Python(x,y) plugin directory in current working directory"""
    for fname in os.listdir(getcwd()):
        path = osp.abspath(osp.join(fname, 'src', 'python', name))
        if osp.isdir(path):
            # Also create the binary directory if it does not exist yet:
            def create_dir(path):
                if not osp.isdir(path):
                    os.mkdir(path)

            create_dir(osp.join(fname, 'bin'))
            create_dir(osp.join(fname, 'bin', 'python'))
            return path


## Building Python(x,y) plugin on Windows platforms, if 'unzip.exe' is available
## and if the `pythonxy` repository exists:
from spyderlib.utils import programs
unzip_exe = 'unzip.exe'
plugin_dir = get_pythonxy_plugindir(name)
if programs.is_program_installed(unzip_exe) and plugin_dir:
    extract_exe_dist(plugin_dir, exe_dist)
    include_chm_doc(plugin_dir)
    build_pythonxy_plugin(plugin_dir, version)