def _view_texdoc(file): if file is None: raise Exception('File must be specified') if not isinstance(file, strbase): raise TypeError('File must be a string') command = ['texdoc'] texpath = get_texpath() or os.environ['PATH'] env = dict(os.environ) env['PATH'] = texpath try: # Windows-specific adjustments startupinfo = None shell = False if sublime.platform() == 'windows': # ensure console window doesn't show startupinfo = subprocess.STARTUPINFO() startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW shell = True if using_miktex(): command.append('--view') command.append(file) print('Running %s' % (' '.join(command))) p = Popen( command, stdout=None, stdin=None, startupinfo=startupinfo, shell=shell, env=env ) if not using_miktex(): # see http://sourceforge.net/p/miktex/bugs/2367/ p.communicate() # cannot rely on texdoc --view from MiKTeX returning if p.returncode != 0: sublime.error_message('An error occurred while trying to run texdoc.') except OSError: sublime.error_message('Could not run texdoc. Please ensure that your texpath setting is configured correctly in the LaTeXTools settings.')
def get_aux_directory(view_or_root, return_setting=False): # not supported using texify or the simple builder if not using_miktex() or using_texify_or_simple(): if return_setting: return (None, None) else: return None root = get_root(view_or_root) aux_directory = get_directive(view_or_root, 'aux_directory') if (aux_directory is None or aux_directory == '') and ( root is not None and view_or_root != root): aux_directory = get_directive(root, 'aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path( root, aux_directory, _get_root_directory(root) ) if return_setting: return (aux_dir, aux_directory) else: return aux_dir view = sublime.active_window().active_view() aux_directory = view.settings().get('aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path( root, aux_directory, _get_root_directory(get_project_file_name(view)) ) if return_setting: return (aux_dir, aux_directory) else: return aux_dir settings = sublime.load_settings('LaTeXTools.sublime-settings') aux_directory = settings.get('aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path( root, aux_directory, _get_root_directory(root) ) if return_setting: return (aux_dir, aux_directory) else: return aux_dir return get_output_directory(root, return_setting)
def get_aux_directory(view_or_root, return_setting=False): # not supported using texify or the simple builder if not using_miktex() or using_texify_or_simple(): if return_setting: return (None, None) else: return None root = get_root(view_or_root) aux_directory = get_directive(view_or_root, 'aux_directory') if (aux_directory is None or aux_directory == '') and (root is not None and view_or_root != root): aux_directory = get_directive(root, 'aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path(root, aux_directory, _get_root_directory(root)) if return_setting: return (aux_dir, aux_directory) else: return aux_dir view = sublime.active_window().active_view() aux_directory = view.settings().get('aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path( root, aux_directory, _get_root_directory(get_project_file_name(view))) if return_setting: return (aux_dir, aux_directory) else: return aux_dir settings = sublime.load_settings('LaTeXTools.sublime-settings') aux_directory = settings.get('aux_directory') if aux_directory is not None and aux_directory != '': aux_dir = resolve_to_absolute_path(root, aux_directory, _get_root_directory(root)) if return_setting: return (aux_dir, aux_directory) else: return aux_dir return get_output_directory(root, return_setting)
def run(self): view = sublime.active_window().active_view() t = SystemCheckThread(sublime_exe=get_sublime_exe(), uses_miktex=using_miktex(), texpath=_get_texpath(view) or os.environ['PATH'], build_env=get_setting('builder_settings', {}).get( sublime.platform(), {}).get('env'), view=view, on_done=self.on_done) t.start() ProgressIndicator(t, 'Checking system...', 'System check complete')
def _view_texdoc(file): if file is None: raise Exception('File must be specified') if not isinstance(file, strbase): raise TypeError('File must be a string') command = ['texdoc'] if sublime.platform() == 'windows' and using_miktex(): command.append('--view') command.append(file) try: external_command(command) except OSError: traceback.print_exc() sublime.error_message('Could not run texdoc. Please ensure that your texpath setting is configured correctly in the LaTeXTools settings.')
def run(self): view = sublime.active_window().active_view() t = SystemCheckThread( sublime_exe=get_sublime_exe(), uses_miktex=using_miktex(), texpath=_get_texpath(view) or os.environ['PATH'], build_env=get_setting('builder_settings', {}).get( sublime.platform(), {} ).get('env'), view=view, on_done=self.on_done ) t.start() ProgressIndicator(t, 'Checking system...', 'System check complete')
def __init__(self, *args): # Sets the file name parts, plus internal stuff super(TraditionalBuilder, self).__init__(*args) # Now do our own initialization: set our name self.name = "Traditional Builder" # Display output? self.display_log = self.builder_settings.get("display_log", False) # Build command, with reasonable defaults # osx, linux, windows everything else really! default_command = DEFAULT_COMMAND_LATEXMK # When MiKTeX missing perl and latexmk, the `texify` compiler driver will be used. if using_miktex() and not perl_latexmk_installed(): default_command = DEFAULT_COMMAND_MIKTEX_TEXIFY self.cmd = self.builder_settings.get("command", default_command) if isinstance(self.cmd, strbase): self.cmd = shlex.split(self.cmd)
def using_texify_or_simple(): if using_miktex(): builder = get_setting('builder', 'traditional') if builder in ['', 'default', 'traditional', 'simple']: return True return False