comparison tincan.py @ 31:443a0001d841 draft header-includes

Improve the #include syntax a bit.
author David Barts <n5jrn@me.com>
date Mon, 27 May 2019 15:17:25 -0700
parents f34d5a90d618
children 3382799f3905
comparison
equal deleted inserted replaced
30:f34d5a90d618 31:443a0001d841
334 if raw.startswith('<') and raw.endswith('>'): 334 if raw.startswith('<') and raw.endswith('>'):
335 raw = raw[1:-1] 335 raw = raw[1:-1]
336 self.in_lib = True 336 self.in_lib = True
337 else: 337 else:
338 self.in_lib = False 338 self.in_lib = False
339 comma = raw.find(',') 339 equals = raw.find('=')
340 if comma < 0: 340 if equals < 0:
341 raise ValueError("missing comma") 341 self.vname = os.path.splitext(raw)[0]
342 self.vname = raw[:comma] 342 self.fname = raw
343 else:
344 self.vname = raw[:equals]
345 self.fname = raw[equals+1:]
343 if self.vname == "": 346 if self.vname == "":
344 raise ValueError("empty variable name") 347 raise ValueError("empty variable name")
345 self.fname = raw[comma+1:]
346 if self.fname == "": 348 if self.fname == "":
347 raise ValueError("empty file name") 349 raise ValueError("empty file name")
348 if not self.fname.endswith(_IEXTEN): 350 if not self.fname.endswith(_IEXTEN):
349 raise ValueError("file does not end in {0}".format(_IEXTEN)) 351 raise ValueError("file does not end in {0}".format(_IEXTEN))
350 352