示例#1
0
 def abscommand(self):
     """The absolute path of the command."""
     if os.name == "nt":
         # on Windows, newer versions of LilyPond don't add themselves to the
         # PATH, so add a probable path here
         path = glob.glob(os.path.join(
             os.environ.get('ProgramFiles', 'C:\\Program Files'),
             'LilyPond*', 'usr', 'bin'))
     elif sys.platform.startswith('darwin'):
         # also on Mac OS X, LilyPond is not automatically added to the PATH
         path = [
             os.path.join('/Applications', 'LilyPond.app', 'Contents', 'Resources', 'bin'),
             os.path.join('/opt', 'local', 'bin'),
             os.path.join('/opt', 'lilypond', 'bin'),
             # Default path for Homebrew on MacOS arm64.
             '/opt/homebrew/bin',
             # Default path for Homebrew on MacOS x86_64.
             '/usr/local/bin',
         ]
         if macosx.inside_app_bundle():
             # By default, the PATH environment variable for app bundles
             # does not contain the path which is required for lilypond
             # and other helper programs like gs.
             # Add the lilypond path to PATH to find the helper programs
             # for Homebrew, Macports and other local installations.
             exe = util.findexe(self.command, path)
             if exe:
                 bindir = os.path.dirname(exe)
                 os.environ['PATH'] = bindir + ':' + os.environ['PATH']
     else:
         path = None
     return util.findexe(self.command, path) or False
示例#2
0
def findexternaltool(ui, tool):
    for kn in ("regkey", "regkeyalt"):
        k = _toolstr(ui, tool, kn)
        if not k:
            continue
        p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
        if p:
            p = util.findexe(p + _toolstr(ui, tool, "regappend"))
            if p:
                return p
    exe = _toolstr(ui, tool, "executable", tool)
    return util.findexe(util.expandpath(exe))
示例#3
0
def findexternaltool(ui, tool):
    for kn in ("regkey", "regkeyalt"):
        k = _toolstr(ui, tool, kn)
        if not k:
            continue
        p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
        if p:
            p = util.findexe(p + _toolstr(ui, tool, "regappend"))
            if p:
                return p
    exe = _toolstr(ui, tool, "executable", tool)
    return util.findexe(util.expandpath(exe))
示例#4
0
def _findtool(ui, tool):
    if tool in _internal:
        return tool
    for kn in ("regkey", "regkeyalt"):
        k = _toolstr(ui, tool, kn)
        if not k:
            continue
        p = util.lookupreg(k, _toolstr(ui, tool, "regname"))
        if p:
            p = util.findexe(p + _toolstr(ui, tool, "regappend"))
            if p:
                return p
    return util.findexe(_toolstr(ui, tool, "executable", tool))
示例#5
0
 def __init__(self, ctx, path, state):
     self._path = path
     self._state = state
     self._ctx = ctx
     self._ui = ctx._repo.ui
     self._exe = util.findexe("svn")
     if not self._exe:
         raise util.Abort(_("'svn' executable not found for subrepo '%s'") % self._path)
示例#6
0
 def __init__(self, ctx, path, state):
     self._path = path
     self._state = state
     self._ctx = ctx
     self._ui = ctx._repo.ui
     self._exe = util.findexe('svn')
     if not self._exe:
         raise util.Abort(
             _("'svn' executable not found for subrepo '%s'") % self._path)
示例#7
0
def validateconfig(ui):
    """determine if we have enough config data to try sending email."""
    method = ui.config("email", "method", "smtp")
    if method == "smtp":
        if not ui.config("smtp", "host"):
            raise util.Abort(_("smtp specified as email transport, " "but no smtp host configured"))
    else:
        if not util.findexe(method):
            raise util.Abort(_("%r specified as email transport, " "but not in PATH") % method)
示例#8
0
文件: mail.py 项目: mortonfox/cr48
def validateconfig(ui):
    '''determine if we have enough config data to try sending email.'''
    method = ui.config('email', 'method', 'smtp')
    if method == 'smtp':
        if not ui.config('smtp', 'host'):
            raise util.Abort(_('smtp specified as email transport, '
                               'but no smtp host configured'))
    else:
        if not util.findexe(method):
            raise util.Abort(_('%r specified as email transport, '
                               'but not in PATH') % method)
示例#9
0
 def abscommand(self):
     """The absolute path of the command."""
     if os.name == "nt":
         # on Windows, newer versions of LilyPond don't add themselves to the
         # PATH, so add a probable path here
         path = glob.glob(os.path.join(
             os.environ.get('ProgramFiles', 'C:\\Program Files'),
             'LilyPond*', 'usr', 'bin'))
     else:
         path = None
     return util.findexe(self.command, path)
示例#10
0
def validateconfig(ui):
    '''determine if we have enough config data to try sending email.'''
    method = ui.config('email', 'method', 'smtp')
    if method == 'smtp':
        if not ui.config('smtp', 'host'):
            raise util.Abort(
                _('smtp specified as email transport, '
                  'but no smtp host configured'))
    else:
        if not util.findexe(method):
            raise util.Abort(
                _('%r specified as email transport, '
                  'but not in PATH') % method)
示例#11
0
 def abscommand(self):
     """The absolute path of the command."""
     if os.name == "nt":
         # on Windows, newer versions of LilyPond don't add themselves to the
         # PATH, so add a probable path here
         path = glob.glob(os.path.join(
             os.environ.get('ProgramFiles', 'C:\\Program Files'),
             'LilyPond*', 'usr', 'bin'))
     elif sys.platform.startswith('darwin'):
         # also on Mac OS X, LilyPond is not automatically added to the PATH
         path = glob.glob(os.path.join(
             '/Applications', 'LilyPond.app', 'Contents', 'Resources', 'bin'))
     else:
         path = None
     return util.findexe(self.command, path) or False
示例#12
0
 def abscommand(self):
     """The absolute path of the command."""
     if os.name == "nt":
         # on Windows, newer versions of LilyPond don't add themselves to the
         # PATH, so add a probable path here
         path = glob.glob(os.path.join(
             os.environ.get('ProgramFiles', 'C:\\Program Files'),
             'LilyPond*', 'usr', 'bin'))
     elif sys.platform.startswith('darwin'):
         # also on Mac OS X, LilyPond is not automatically added to the PATH
         path = [
             os.path.join('/Applications', 'LilyPond.app', 'Contents', 'Resources', 'bin'),
             os.path.join('/opt', 'local', 'bin'),
         ]
     else:
         path = None
     return util.findexe(self.command, path) or False
示例#13
0
 def abscommand(self):
     """The absolute path of the command."""
     return util.findexe(self.command) or False