annotate resfinder/git_test.py @ 0:55051a9bc58d draft default tip

Uploaded
author dcouvin
date Mon, 10 Jan 2022 20:06:07 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
1 #!/usr/bin/env python3
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
2 import os.path
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
3
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
4 from cge.out.util.generator import Generator
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
5
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
6 from git import Repo
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
7
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
8
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
9 # git_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
10 git_path = os.path.abspath(os.path.dirname(__file__))
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
11 print("Git path: {}".format(git_path))
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
12 repo = Repo(git_path)
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
13 commit = repo.commit()
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
14
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
15 com2tag = {}
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
16 for tag in repo.tags:
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
17 com2tag[tag.commit.hexsha] = str(tag)
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
18
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
19 version = com2tag.get(repo.commit().hexsha, repo.commit().hexsha[:7])
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
20 print("Version: {}".format(version))
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
21
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
22 git_path = os.path.abspath(os.path.dirname(__file__))
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
23 result = Generator.init_software_result(name="ResFinder", gitdir=git_path)
55051a9bc58d Uploaded
dcouvin
parents:
diff changeset
24 print(str(result))