mirror of https://github.com/ecmwf/eccodes.git
Fix last commit. memfs.py broken in Python 3
This commit is contained in:
parent
4e2cd7e4a7
commit
404b4ffeb4
9
memfs.py
9
memfs.py
|
@ -13,11 +13,12 @@ print(dirs)
|
||||||
FILES = {}
|
FILES = {}
|
||||||
NAMES = []
|
NAMES = []
|
||||||
|
|
||||||
|
# Binary to ASCII function. Different in Python 2 and 3
|
||||||
try:
|
try:
|
||||||
str("",'ascii')
|
str(b'\x23\x20','ascii')
|
||||||
ascii = lambda x: str(x, 'ascii')
|
ascii = lambda x: str(x, 'ascii') # Python 3
|
||||||
except:
|
except:
|
||||||
ascii = lambda x: str(x)
|
ascii = lambda x: str(x) # Python 2
|
||||||
|
|
||||||
|
|
||||||
# The last argument is the generated C file
|
# The last argument is the generated C file
|
||||||
|
@ -37,7 +38,7 @@ for directory in dirs:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
fname = full[full.find("/%s/" % (dname,)):]
|
fname = full[full.find("/%s/" % (dname,)):]
|
||||||
print("MEMFS add", fname)
|
#print("MEMFS add", fname)
|
||||||
name = re.sub(r'\W', '_', fname)
|
name = re.sub(r'\W', '_', fname)
|
||||||
|
|
||||||
assert name not in FILES
|
assert name not in FILES
|
||||||
|
|
Loading…
Reference in New Issue