338 |
338 |
339 separator = "=" # initialize for old-style header |
339 separator = "=" # initialize for old-style header |
340 insideHeader = False |
340 insideHeader = False |
341 for line in pluginSource.splitlines(): |
341 for line in pluginSource.splitlines(): |
342 line = line.strip() |
342 line = line.strip() |
343 if line.startswith("# Start-Of-Header"): |
343 if line.lower().startswith("# start-of-header"): |
344 insideHeader = True |
344 insideHeader = True |
345 continue |
345 continue |
346 |
346 |
347 if not insideHeader: |
347 if not insideHeader: |
348 continue |
348 continue |
349 |
349 |
350 if line.startswith("__header__"): |
350 if line.startswith("__header__"): |
351 # it is a new style header |
351 # it is a new style header |
352 separator = ":" |
352 separator = ":" |
353 continue |
353 continue |
354 elif line.startswith("# End-Of-Header"): |
354 elif line.lower().startswith("# end-of-header"): |
355 break |
355 break |
356 |
356 |
357 with contextlib.suppress(ValueError): |
357 with contextlib.suppress(ValueError): |
358 key, value = line.split(separator) |
358 key, value = line.split(separator) |
359 key = key.strip().strip("\"'") |
359 key = key.strip().strip("\"'") |