Skip to content

Commit

Permalink
fixed issue #82 (detecting name of repo from the zip filename)
Browse files Browse the repository at this point in the history
  • Loading branch information
gfursin committed Oct 12, 2017
1 parent da69fe0 commit f55ea00
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* fixed issue #80 (adding zip repo if starts with ~)
* fixed issue #81 (when renaming entry with data_name==data_alias, change it to the new alias)
* added flag --name (duplicate of --show_name) to "ck ls"
* fixed issue #82 (detecting name of repo from the zip filename)

* V1.9.2
* added "ck cd {CK entry}" to open a new shell in a given CK entry
Expand Down
28 changes: 19 additions & 9 deletions ck/repo/module/repo/module.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,22 +159,32 @@ def add(i):

try:
with zipfile.ZipFile(zp) as z:
x=z.open(ck.cfg['repo_file'])
y=x.read()
if ck.cfg['repo_file'] in z.namelist():
x=z.open(ck.cfg['repo_file'])
y=x.read()

r=ck.convert_json_str_to_dict({'str':y, 'skip_quote_replacement':'yes'})
if r['return']>0: return r
yd=r['dict']
r=ck.convert_json_str_to_dict({'str':y, 'skip_quote_replacement':'yes'})
if r['return']>0: return r
yd=r['dict']

d=yd.get('data_uoa','')
di=yd.get('data_uid','')
dn=yd.get('data_name','')
d=yd.get('data_uoa','')
di=yd.get('data_uid','')
dn=yd.get('data_name','')

x.close()
x.close()
z.close()
except Exception as e:
return {'return':1, 'error':'problem reading zip file ('+format(e)+')'}

if d=='':
x1=os.path.basename(zp)
d=os.path.splitext(x1)[0]
if d.startswith('ckr-'):
d=d[4:]

if o=='con':
ck.out('Auto-detected repo name from zip filename: '+d)

if gz=='yes':
zp=ck.cfg['default_shared_repo_url']+'/'+d+'/archive/master.zip'
ptr=d+'-master/'
Expand Down

0 comments on commit f55ea00

Please sign in to comment.