Skip to content

Failed import raises non-ImportError exception on MacOS #762

Closed
@terminalmage

Description

@terminalmage

This is related to #657.

Apparently, MacOS adds a git executable that is just a stub which displays an error. This gets past the try/except I added in #658, and allows all of the GitPython components to be imported, but since the executable is not actually git, it results in an exception when refresh() attemepts to run a git version:

  File "/opt/salt/lib/python2.7/site-packages/salt/utils/gitfs.py", line 90, in <module>
    import git
  File "/opt/salt/lib/python2.7/site-packages/git/__init__.py", line 82, in <module>
    refresh()
  File "/opt/salt/lib/python2.7/site-packages/git/__init__.py", line 73, in refresh
    if not Git.refresh(path=path):
  File "/opt/salt/lib/python2.7/site-packages/git/cmd.py", line 230, in refresh
    cls().version()
  File "/opt/salt/lib/python2.7/site-packages/git/cmd.py", line 551, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "/opt/salt/lib/python2.7/site-packages/git/cmd.py", line 1010, in _call_process
    return self.execute(call, **exec_kwargs)
  File "/opt/salt/lib/python2.7/site-packages/git/cmd.py", line 821, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git version
  stderr: 'xcode-select: error: no developer tools were found at '/Applications/Xcode.app', and no install could be requested (perhaps no UI is present), please install manually from 'developer
.apple.com'.'

Fix incoming.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions