diff options
-rw-r--r-- | gerber/layers.py | 6 | ||||
-rw-r--r-- | gerber/tests/test_layers.py | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/gerber/layers.py b/gerber/layers.py index c80baa4..5c26412 100644 --- a/gerber/layers.py +++ b/gerber/layers.py @@ -122,11 +122,11 @@ def guess_layer_class(filename): pass
try:
- directory, name = os.path.split(filename)
- name, ext = os.path.splitext(name.lower())
+ directory, filename = os.path.split(filename)
+ name, ext = os.path.splitext(filename.lower())
for hint in hints:
if hint.regex:
- if re.findall(hint.regex, name, re.IGNORECASE):
+ if re.findall(hint.regex, filename, re.IGNORECASE):
return hint.layer
patterns = [r'^(\w*[.-])*{}([.-]\w*)?$'.format(x) for x in hint.name]
diff --git a/gerber/tests/test_layers.py b/gerber/tests/test_layers.py index 597c0d3..3a21a2c 100644 --- a/gerber/tests/test_layers.py +++ b/gerber/tests/test_layers.py @@ -61,7 +61,7 @@ def test_guess_layer_class_regex(): Hint(layer='top', ext=[], name=[], - regex=r'(.*)(\scopper top|\stop copper)$', + regex=r'(.*)(\scopper top|\stop copper).gbr', content=[] ), ] |