Пример #1
0
 def get_gumbo_path(self):
     if sys.platform.startswith('darwin'):
         lib_dir = unipath.abspath(os.path.join(self.appdir,"..","lib"))
         lib_name = 'libsigilgumbo.dylib'
     elif sys.platform.startswith('win'):
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'sigilgumbo.dll'
     else:
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'libsigilgumbo.so'
     return os.path.join(lib_dir, lib_name)
Пример #2
0
 def get_hunspell_path(self):
     if sys.platform.startswith('darwin'):
         lib_dir = unipath.abspath(os.path.join(self.appdir,"..","lib"))
         lib_name = 'libhunspell.dylib'
     elif sys.platform.startswith('win'):
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'hunspell.dll'
     else:
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'libhunspell.so'
     return os.path.join(lib_dir, lib_name)
Пример #3
0
 def get_hunspell_path(self):
     if sys.platform.startswith('darwin'):
         lib_dir = unipath.abspath(os.path.join(self.appdir,"..","lib"))
         lib_name = 'libhunspell.dylib'
     elif sys.platform.startswith('win'):
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'hunspell.dll'
     else:
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'libhunspell.so'
     return os.path.join(lib_dir, lib_name)
Пример #4
0
 def get_gumbo_path(self):
     if sys.platform.startswith('darwin'):
         lib_dir = unipath.abspath(os.path.join(self.appdir,"..","lib"))
         lib_name = 'libsigilgumbo.dylib'
     elif sys.platform.startswith('win'):
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'sigilgumbo.dll'
     else:
         lib_dir = unipath.abspath(self.appdir)
         lib_name = 'libsigilgumbo.so'
     return os.path.join(lib_dir, lib_name)
Пример #5
0
 def get_dictionary_dirs(self):
     apaths = []
     if sys.platform.startswith('darwin'):
         apaths.append(
             unipath.abspath(
                 os.path.join(self.appdir, "..", "hunspell_dictionaries")))
         apaths.append(
             unipath.abspath(
                 os.path.join(self.usrsupdir, "hunspell_dictionaries")))
     elif sys.platform.startswith('win'):
         apaths.append(
             unipath.abspath(
                 os.path.join(self.appdir, "hunspell_dictionaries")))
         apaths.append(
             unipath.abspath(
                 os.path.join(self.usrsupdir, "hunspell_dictionaries")))
     else:
         install_prefix = unipath.abspath(
             os.path.join(self.appdir, "..", ".."))
         apaths.append(
             unipath.abspath(
                 os.path.join(install_prefix, "share",
                              "hunspell_dictionaries")))
         apaths.append(
             unipath.abspath(
                 os.path.join(self.usrsupdir, "hunspell_dictionaries")))
     return apaths
Пример #6
0
    def get_dictionary_dirs(self):
        apaths = []
        if sys.platform.startswith('darwin'):
            apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        elif sys.platform.startswith('win'):
            apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        else:
            # Linux
            system_hunspell_dicts = ''
            share_prefix = ''
            share_override = ''
            sigil_share_dir_name = 'sigil'

            # get the env var SIGIL_DICTIONARIES set at launch time.
            if 'SIGIL_DICTIONARIES' in os.environ.keys():
                system_hunspell_dicts = os.environ['SIGIL_DICTIONARIES']

            # Runtime env var override of 'share/sigil' directory.
            if 'SIGIL_EXTRA_ROOT' in os.environ.keys():
                share_override = os.environ['SIGIL_EXTRA_ROOT']

            # The sigil launch script in <install_prefix>/bin knows where Sigil's build time
            # share prefix is and sets the env var SIGIL_SHARE_PREFIX to its value.
            if 'SIGIL_SHARE_PREFIX' in os.environ.keys():
                share_prefix = os.environ['SIGIL_SHARE_PREFIX']

            # If someone didn't launch Sigil with its launch script, this may save the
            # day (as long as the user didn't override SHARE_INSTALL_PREFIX at compile time).
            if not len(share_prefix) and not len(share_override):
                share_prefix = unipath.abspath(os.path.join(self.appdir,"..",".."))

            # If the 'share/sigil' location has indeed been overridden at runtime, get its prefix and use that.
            if len(share_override):
                sigil_share_dir_name = os.path.basename(share_override)
                share_prefix = unipath.abspath(os.path.join(share_override,"..",".."))

            # If the SIGIL_DICTIONARIES env var has content, use it for the dictionary location.
            if len(system_hunspell_dicts):
                apaths.append(unipath.abspath(system_hunspell_dicts))
            else:
                # Otherwise, use Sigil's bundled hunspell dictionary location.
                apaths.append(unipath.abspath(os.path.join(share_prefix, "share", sigil_share_dir_name, "hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        return apaths
Пример #7
0
    def get_dictionary_dirs(self):
        apaths = []
        if sys.platform.startswith('darwin'):
            apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        elif sys.platform.startswith('win'):
            apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        else:
            # Linux
            system_hunspell_dicts = ''
            share_prefix = ''
            share_override = ''

            # get the env var SIGIL_DICTIONARIES set at launch time.
            if 'SIGIL_DICTIONARIES' in os.environ.keys():
                system_hunspell_dicts = os.environ['SIGIL_DICTIONARIES']

            # Runtime env var override of 'share/sigil' directory.
            if 'SIGIL_EXTRA_ROOT' in os.environ.keys():
                share_override = os.environ['SIGIL_EXTRA_ROOT']

            # The sigil launch script in <install_prefix>/bin knows where Sigil's build time
            # share prefix is and sets the env var SIGIL_SHARE_PREFIX to its value.
            if 'SIGIL_SHARE_PREFIX' in os.environ.keys():
                share_prefix = os.environ['SIGIL_SHARE_PREFIX']

            # If someone didn't launch Sigil with its launch script, this may save the
            # day (as long as the user didn't override SHARE_INSTALL_PREFIX at compile time).
            if not len(share_prefix) and not len(share_override):
                share_prefix = unipath.abspath(os.path.join(self.appdir,"..",".."))

            # If the SIGIL_DICTIONARIES env var has content, use it for the dictionary location.
            if len(system_hunspell_dicts):
                for path in system_hunspell_dicts.split(':'):
                    apaths.append(unipath.abspath(path.strip()))
            else:
                # If the 'share/sigil' location has indeed been overridden at runtime, use that.
                if len(share_override):
                    apaths.append(unipath.abspath(os.path.join(share_override, "hunspell_dictionaries")))
                else:
                    # Otherwise, use Sigil's bundled hunspell dictionary location.
                    apaths.append(unipath.abspath(os.path.join(share_prefix, "share", 'sigil', "hunspell_dictionaries")))
            apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
        return apaths
Пример #8
0
 def get_dictionary_dirs(self):
     apaths = []
     if sys.platform.startswith('darwin'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     elif sys.platform.startswith('win'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     else:
         install_prefix = unipath.abspath(os.path.join(self.appdir,"..",".."))
         apaths.append(unipath.abspath(os.path.join(install_prefix, "share", "hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     return apaths
Пример #9
0
 def get_dictionary_dirs(self):
     apaths = []
     if sys.platform.startswith('darwin'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     elif sys.platform.startswith('win'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     else:
         # Linux
         for path in self.linux_hunspell_dict_dirs:
             apaths.append(unipath.abspath(path.strip()))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     return apaths
Пример #10
0
 def get_dictionary_dirs(self):
     apaths = []
     if sys.platform.startswith('darwin'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     elif sys.platform.startswith('win'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     else:
         # Linux
         for path in self.linux_hunspell_dict_dirs:
             apaths.append(unipath.abspath(path.strip()))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     return apaths
Пример #11
0
 def get_dictionary_dirs(self):
     apaths = []
     if sys.platform.startswith('darwin'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"..","hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     elif sys.platform.startswith('win'):
         apaths.append(unipath.abspath(os.path.join(self.appdir,"hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     else:
         # The sigil launch script in <install_prefix>/bin knows where Sigil's share
         # prefix is and sets the env var SIGIL_SHARE_PREFIX to its value.
         share_prefix = os.environ['SIGIL_SHARE_PREFIX']
         if not len(share_prefix):
             # If someone didn't launch Sigil with its launch script, this may save the 
             # day (as long as the user didn't override SHARE_INSTALL_PREFIX at compile time).
             share_prefix = unipath.abspath(os.path.join(self.appdir,"..",".."))
         apaths.append(unipath.abspath(os.path.join(share_prefix, "share", "sigil", "hunspell_dictionaries")))
         apaths.append(unipath.abspath(os.path.join(self.usrsupdir,"hunspell_dictionaries")))
     return apaths