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

CM v2.1.1 release #1208

Merged
merged 2 commits into from
Apr 16, 2024
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
5 changes: 5 additions & 0 deletions cm/CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## V2.1.1
- added --skip-zip-parent-dir to "cm pull repo --url=..." to support downloading
of stable CM-MLOps repositories from https://github.com/mlcommons/cm4mlops/releases .


## V2.1.0
- changed outdated version of CM in requirements when creating new repos
- fixed minor bug in `cm add automation {name}`
Expand Down
2 changes: 1 addition & 1 deletion cm/cmind/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "2.1.0"
__version__ = "2.1.1"

from cmind.core import access
from cmind.core import error
Expand Down
6 changes: 5 additions & 1 deletion cm/cmind/repo/automation/repo/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ def pull(self, i):
(depth) (int): Git depth
(desc) (str): brief repository description (1 line)
(prefix) (str): extra directory to keep CM artifacts
(skip_zip_parent_dir) (bool): skip parent dir in CM ZIP repo (useful when
downloading CM repo archives from GitHub)
Returns:
(CM return dict):
Expand All @@ -50,6 +52,7 @@ def pull(self, i):
pat = i.get('pat','')

checkout_only = i.get('checkout_only', False)
skip_zip_parent_dir = i.get('skip_zip_parent_dir', False)

if url == '':
if alias != '':
Expand Down Expand Up @@ -140,7 +143,8 @@ def pull(self, i):
prefix=prefix,
depth=depth,
path_to_repo=path_to_repo,
checkout_only=checkout_only)
checkout_only=checkout_only,
skip_zip_parent_dir=skip_zip_parent_dir)
if r['return']>0: return r

repo_meta = r['meta']
Expand Down
17 changes: 15 additions & 2 deletions cm/cmind/repos.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ def process(self, repo_path, mode='add'):
return {'return':0}

############################################################
def pull(self, alias, url = '', branch = '', checkout = '', console = False, desc = '', prefix = '', depth = None, path_to_repo = None, checkout_only = False):
def pull(self, alias, url = '', branch = '', checkout = '', console = False, desc = '', prefix = '', depth = None,
path_to_repo = None, checkout_only = False, skip_zip_parent_dir = False):
"""
Clone or pull CM repository
Expand All @@ -267,6 +268,9 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des
(desc) (str): optional repository description
(prefix) (str): sub-directory to be used inside this CM repository to store artifacts
(path_to_repo) (str): force path to repo (useful to pull imported repos with non-standard path)
(checkout_only) (bool): only checkout Git repository but don't pull
(skip_zip_parent_dir) (bool): skip parent dir in CM ZIP repo (useful when
downloading CM repo archives from GitHub)
Returns:
(CM return dict):
Expand Down Expand Up @@ -370,10 +374,19 @@ def pull(self, alias, url = '', branch = '', checkout = '', console = False, des
if console:
print ('Unpacking {} to {} ...'.format(pack_file, repo_path))

parent_dir = ''

# Unpacking zip
for f in files:
if not f.startswith('..') and not f.startswith('/') and not f.startswith('\\'):
file_path = os.path.join(repo_path, f)

if skip_zip_parent_dir and parent_dir == '':
parent_dir = f

ff = f[len(parent_dir):] if parent_dir != '' else f

file_path = os.path.join(repo_path, ff)

if f.endswith('/'):
# create directory
if not os.path.exists(file_path):
Expand Down
2 changes: 1 addition & 1 deletion cm/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def run(self):
'install': custom_install
},

install_requires=['pyyaml', 'requests'],
install_requires=['pyyaml', 'requests', 'setuptools', 'giturlparse'],

entry_points={"console_scripts": [
"cmind = cmind.cli:run",
Expand Down
Loading