summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--.pre-commit-config.yaml2
-rw-r--r--identify/extensions.py1
-rw-r--r--identify/identify.py6
-rw-r--r--setup.cfg2
-rw-r--r--tests/identify_test.py2
5 files changed, 10 insertions, 3 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 878fbb0..4f87a3c 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -35,7 +35,7 @@ repos:
- id: add-trailing-comma
args: [--py36-plus]
- repo: https://github.com/asottile/pyupgrade
- rev: v2.25.0
+ rev: v2.28.0
hooks:
- id: pyupgrade
args: [--py36-plus]
diff --git a/identify/extensions.py b/identify/extensions.py
index 8e650ed..67d601a 100644
--- a/identify/extensions.py
+++ b/identify/extensions.py
@@ -62,6 +62,7 @@ EXTENSIONS = {
'gypi': {'text', 'gyp', 'python'},
'gz': {'binary', 'gzip'},
'h': {'text', 'header', 'c', 'c++'},
+ 'hcl': {'text', 'hcl'},
'hh': {'text', 'header', 'c++'},
'hpp': {'text', 'header', 'c++'},
'hs': {'text', 'haskell'},
diff --git a/identify/identify.py b/identify/identify.py
index 59bc6ba..4d1b555 100644
--- a/identify/identify.py
+++ b/identify/identify.py
@@ -193,7 +193,11 @@ def parse_shebang(bytesio: IO[bytes]) -> Tuple[str, ...]:
cmd = tuple(_shebang_split(first_line.strip()))
if cmd and cmd[0] == '/usr/bin/env':
- cmd = cmd[1:]
+ if cmd[1] == '-S':
+ cmd = cmd[2:]
+ else:
+ cmd = cmd[1:]
+
if cmd == ('nix-shell',):
return _parse_nix_shebang(bytesio, cmd)
return cmd
diff --git a/setup.cfg b/setup.cfg
index 0388d74..48ea6f5 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = identify
-version = 2.2.14
+version = 2.3.0
description = File identification library for Python
long_description = file: README.md
long_description_content_type = text/markdown
diff --git a/tests/identify_test.py b/tests/identify_test.py
index ec40cdf..5a8bbcc 100644
--- a/tests/identify_test.py
+++ b/tests/identify_test.py
@@ -314,6 +314,8 @@ def test_file_is_text_does_not_exist(tmpdir):
(b'\xf9\x93\x01\x42\xcd', ()),
(b'#!\xf9\x93\x01\x42\xcd', ()),
(b'#!\x00\x00\x00\x00', ()),
+ # shebang lines with multiple arguments
+ (b'#!/usr/bin/env -S python -u', ('python', '-u')),
),
)
def test_parse_shebang(s, expected):