summaryrefslogtreecommitdiffstats
path: root/identify/identify.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-12 21:19:15 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2021-03-12 21:20:17 +0000
commit0ece75006ba491182e21cc1234c8e958cc9744f0 (patch)
treebefc84c7c2e47ff88a0e490cdf80edc7aa140b92 /identify/identify.py
parentReleasing debian version 2.1.0-1. (diff)
downloadidentify-0ece75006ba491182e21cc1234c8e958cc9744f0.tar.xz
identify-0ece75006ba491182e21cc1234c8e958cc9744f0.zip
Merging upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'identify/identify.py')
-rw-r--r--identify/identify.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/identify/identify.py b/identify/identify.py
index 51c1288..52d2c2d 100644
--- a/identify/identify.py
+++ b/identify/identify.py
@@ -1,3 +1,4 @@
+import errno
import os.path
import re
import shlex
@@ -205,8 +206,14 @@ def parse_shebang_from_file(path: str) -> Tuple[str, ...]:
if not os.access(path, os.X_OK):
return ()
- with open(path, 'rb') as f:
- return parse_shebang(f)
+ try:
+ with open(path, 'rb') as f:
+ return parse_shebang(f)
+ except OSError as e:
+ if e.errno == errno.EINVAL:
+ return ()
+ else:
+ raise
COPYRIGHT_RE = re.compile(r'^\s*(Copyright|\(C\)) .*$', re.I | re.MULTILINE)