diff --git a/nexus/lib/machines.py b/nexus/lib/machines.py index 0a4094ac87..f9deb27b39 100644 --- a/nexus/lib/machines.py +++ b/nexus/lib/machines.py @@ -120,31 +120,7 @@ def read(self,options): self[str(len(self))] = o #end for elif isinstance(options,str): - nopts = 0 - intext = False - nstart = -2 - nend = -2 - n = 0 - for c in options: - if c=='-' and nstart!=n-1 and not intext: - prevdash=True - if nopts>0: - opt = options[nstart:n].strip() - name = opt.replace('-','').replace('=',' ').split()[0] - self[name]=opt - #end if - nopts+=1 - nstart = n - elif c=='"' or c=="'": - intext=not intext - #end if - n+=1 - #end for - if nopts>0: - opt = options[nstart:n].strip() - name = opt.replace('-','').replace('=',' ').split()[0] - self[name]=opt - #end if + self[str(len(self))] = options else: self.error('invalid type provided to Options') #end if diff --git a/nexus/tests/unit/test_machines.py b/nexus/tests/unit/test_machines.py index cf92ea8b4d..471d7b86a5 100644 --- a/nexus/tests/unit/test_machines.py +++ b/nexus/tests/unit/test_machines.py @@ -90,16 +90,8 @@ def test_options(): # read opts = '-a -b 1 -c=2 --dname="0 1 2" --evar -fval -gval other --hval' - ref = obj( - a = '-a', - b = '-b 1', - c = '-c=2', - dname = '--dname="0 1 2"', - evar = '--evar', - fval = '-fval', - gval = '-gval other', - hval = '--hval', - ) + ref = obj() + ref['0'] = opts o = Options() o.read(opts) assert(object_eq(o.to_obj(),ref)) @@ -107,7 +99,7 @@ def test_options(): # write opts_write = o.write() o2 = Options() - o2.read(opts_write) + o2.read(opts_write.strip()) assert(object_eq(o2.to_obj(),ref)) #end def test_options