import tempfile
s_dir = srcdir or d.getVar('EXTERNALSRC')
- git_dir = os.path.join(s_dir, '.git')
- oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
+ git_dir = None
+
+ try:
+ # git rev-parse returns the path relative to the current working
+ # directory
+ git_dir = os.path.join(s_dir,
+ subprocess.check_output(['git', 'rev-parse', '--git-dir'], cwd=s_dir).decode("utf-8").rstrip())
+ except subprocess.CalledProcessError:
+ pass
ret = " "
- if os.path.exists(git_dir):
+ if git_dir is not None:
+ oe_hash_file = os.path.join(git_dir, 'oe-devtool-tree-sha1')
with tempfile.NamedTemporaryFile(prefix='oe-devtool-index') as tmp_index:
# Clone index
shutil.copyfile(os.path.join(git_dir, 'index'), tmp_index.name)