Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use updated setup.py #600

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading