Skip to content

Commit 4a2ce42

Browse files
authored
Merge pull request #600 from GATEOverflow/use-updated-setup.py
Use updated setup.py
2 parents 65d9508 + 912ae6d commit 4a2ce42

File tree

5 files changed

+34
-3
lines changed

5 files changed

+34
-3
lines changed

Diff for: .github/workflows/build_wheel.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ jobs:
9494
working-directory: ./
9595
run: python3 -m build && rm dist/*.whl
9696

97-
# Step 9: Publish to PyPI
97+
# Step 9: Install the built wheel (as a test)
98+
- name: Install wheel
99+
working-directory: ./
100+
run: |
101+
wheel_file=$(ls dist/*.whl | tail -n 1)
102+
python3 -m pip install "$wheel_file"
103+
104+
# Step 10: Publish to PyPI
98105
- name: Publish to PyPI
99106
uses: pypa/gh-action-pypi-publish@release/v1
100107
with:

Diff for: get_git_version.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import subprocess
2+
3+
def get_git_commit_hash():
4+
try:
5+
commit_hash = subprocess.check_output(
6+
['git', 'rev-parse', 'HEAD'],
7+
stderr=subprocess.STDOUT
8+
).strip().decode('utf-8')
9+
return commit_hash
10+
except Exception:
11+
return "unknown"
12+
13+
if __name__ == "__main__":
14+
print(get_git_commit_hash())

Diff for: git_commit_hash.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
52910a20a16a578ddfe0247365fd8ca3d73d93a0

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[build-system]
2-
requires = ["setuptools>=60", "wheel", "cmind"]
2+
requires = ["setuptools>=60", "wheel", "cmind @ git+https://[email protected]/mlcommons/ck.git@084d4d6171a6e7ae9582a63777fbd19afa19947a#egg=cmind&subdirectory=cm"]

Diff for: setup.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,11 @@ def command_exists(self, command):
131131
return subprocess.call([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) == 0
132132

133133
def custom_function(self):
134+
commit_hash = get_commit_hash()
134135
import cmind
135136
#r = cmind.access({'action':'rm', 'automation':'repo', 'data_uoa':'mlcommons@cm4mlops', 'force': True})
136-
r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'branch': 'mlperf-inference'})
137+
r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'branch': 'mlperf-inference', 'checkout': commit_hash})
138+
#r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'checkout': commit_hash})
137139
print(r)
138140
if r['return'] > 0:
139141
return r['return']
@@ -148,6 +150,13 @@ def read_file(file_name, default=""):
148150
return f.read().strip()
149151
return default
150152

153+
def get_commit_hash():
154+
try:
155+
with open(os.path.join(os.path.dirname(__file__), 'git_commit_hash.txt'), 'r') as f:
156+
return f.read().strip()
157+
except FileNotFoundError:
158+
return "unknown"
159+
151160
long_description = read_file("README.md", "No description available.")
152161
version_ = read_file("VERSION", "0.3.1")
153162

0 commit comments

Comments
 (0)