Skip to content

Commit

Permalink
Merge pull request #600 from GATEOverflow/use-updated-setup.py
Browse files Browse the repository at this point in the history
Use updated setup.py
  • Loading branch information
arjunsuresh authored Nov 23, 2024
2 parents 65d9508 + 912ae6d commit 4a2ce42
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 3 deletions.
9 changes: 8 additions & 1 deletion .github/workflows/build_wheel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ jobs:
working-directory: ./
run: python3 -m build && rm dist/*.whl

# Step 9: Publish to PyPI
# Step 9: Install the built wheel (as a test)
- name: Install wheel
working-directory: ./
run: |
wheel_file=$(ls dist/*.whl | tail -n 1)
python3 -m pip install "$wheel_file"
# Step 10: Publish to PyPI
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
14 changes: 14 additions & 0 deletions get_git_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import subprocess

def get_git_commit_hash():
try:
commit_hash = subprocess.check_output(
['git', 'rev-parse', 'HEAD'],
stderr=subprocess.STDOUT
).strip().decode('utf-8')
return commit_hash
except Exception:
return "unknown"

if __name__ == "__main__":
print(get_git_commit_hash())
1 change: 1 addition & 0 deletions git_commit_hash.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
52910a20a16a578ddfe0247365fd8ca3d73d93a0
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[build-system]
requires = ["setuptools>=60", "wheel", "cmind"]
requires = ["setuptools>=60", "wheel", "cmind @ git+https://[email protected]/mlcommons/ck.git@084d4d6171a6e7ae9582a63777fbd19afa19947a#egg=cmind&subdirectory=cm"]
11 changes: 10 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,11 @@ def command_exists(self, command):
return subprocess.call([command, '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) == 0

def custom_function(self):
commit_hash = get_commit_hash()
import cmind
#r = cmind.access({'action':'rm', 'automation':'repo', 'data_uoa':'mlcommons@cm4mlops', 'force': True})
r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'branch': 'mlperf-inference'})
r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'branch': 'mlperf-inference', 'checkout': commit_hash})
#r = cmind.access({'action':'pull', 'automation':'repo', 'artifact':'mlcommons@cm4mlops', 'checkout': commit_hash})
print(r)
if r['return'] > 0:
return r['return']
Expand All @@ -148,6 +150,13 @@ def read_file(file_name, default=""):
return f.read().strip()
return default

def get_commit_hash():
try:
with open(os.path.join(os.path.dirname(__file__), 'git_commit_hash.txt'), 'r') as f:
return f.read().strip()
except FileNotFoundError:
return "unknown"

long_description = read_file("README.md", "No description available.")
version_ = read_file("VERSION", "0.3.1")

Expand Down

0 comments on commit 4a2ce42

Please sign in to comment.