Skip to content

Commit

Permalink
CM v2.1.1 release (#1208)
Browse files Browse the repository at this point in the history
  • Loading branch information
ctuning-admin committed Apr 16, 2024
2 parents f22a3fe + 5e406de commit 572fb00
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 5 deletions.
5 changes: 5 additions & 0 deletions cm/CHANGES.md
@@ -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
@@ -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
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
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
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

0 comments on commit 572fb00

Please sign in to comment.