Skip to content

Commit 572fb00

Browse files
CM v2.1.1 release (#1208)
2 parents f22a3fe + 5e406de commit 572fb00

File tree

5 files changed

+27
-5
lines changed

5 files changed

+27
-5
lines changed

cm/CHANGES.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## V2.1.1
2+
- added --skip-zip-parent-dir to "cm pull repo --url=..." to support downloading
3+
of stable CM-MLOps repositories from https://github.com/mlcommons/cm4mlops/releases .
4+
5+
16
## V2.1.0
27
- changed outdated version of CM in requirements when creating new repos
38
- fixed minor bug in `cm add automation {name}`

cm/cmind/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.1.0"
1+
__version__ = "2.1.1"
22

33
from cmind.core import access
44
from cmind.core import error

cm/cmind/repo/automation/repo/module.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ def pull(self, i):
3131
(depth) (int): Git depth
3232
(desc) (str): brief repository description (1 line)
3333
(prefix) (str): extra directory to keep CM artifacts
34+
(skip_zip_parent_dir) (bool): skip parent dir in CM ZIP repo (useful when
35+
downloading CM repo archives from GitHub)
3436
3537
Returns:
3638
(CM return dict):
@@ -50,6 +52,7 @@ def pull(self, i):
5052
pat = i.get('pat','')
5153

5254
checkout_only = i.get('checkout_only', False)
55+
skip_zip_parent_dir = i.get('skip_zip_parent_dir', False)
5356

5457
if url == '':
5558
if alias != '':
@@ -140,7 +143,8 @@ def pull(self, i):
140143
prefix=prefix,
141144
depth=depth,
142145
path_to_repo=path_to_repo,
143-
checkout_only=checkout_only)
146+
checkout_only=checkout_only,
147+
skip_zip_parent_dir=skip_zip_parent_dir)
144148
if r['return']>0: return r
145149

146150
repo_meta = r['meta']

cm/cmind/repos.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,8 @@ def process(self, repo_path, mode='add'):
252252
return {'return':0}
253253

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

377+
parent_dir = ''
378+
373379
# Unpacking zip
374380
for f in files:
375381
if not f.startswith('..') and not f.startswith('/') and not f.startswith('\\'):
376-
file_path = os.path.join(repo_path, f)
382+
383+
if skip_zip_parent_dir and parent_dir == '':
384+
parent_dir = f
385+
386+
ff = f[len(parent_dir):] if parent_dir != '' else f
387+
388+
file_path = os.path.join(repo_path, ff)
389+
377390
if f.endswith('/'):
378391
# create directory
379392
if not os.path.exists(file_path):

cm/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ def run(self):
9494
'install': custom_install
9595
},
9696

97-
install_requires=['pyyaml', 'requests'],
97+
install_requires=['pyyaml', 'requests', 'setuptools', 'giturlparse'],
9898

9999
entry_points={"console_scripts": [
100100
"cmind = cmind.cli:run",

0 commit comments

Comments
 (0)