summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-13 10:55:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-07-13 10:55:09 +0000
commit85f251a54f9a6b4a1bccdcbaec8784e32da8df38 (patch)
tree55b2661dc5b9a8cfacdd9c817c3c842736d69d4b
parentReleasing debian version 2.5.36-1. (diff)
downloadidentify-85f251a54f9a6b4a1bccdcbaec8784e32da8df38.tar.xz
identify-85f251a54f9a6b4a1bccdcbaec8784e32da8df38.zip
Merging upstream version 2.6.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r--.pre-commit-config.yaml10
-rw-r--r--identify/extensions.py1
-rw-r--r--identify/identify.py14
-rw-r--r--setup.cfg2
-rw-r--r--tests/identify_test.py2
5 files changed, 16 insertions, 13 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 6f61d88..e096a03 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -14,7 +14,7 @@ repos:
hooks:
- id: setup-cfg-fmt
- repo: https://github.com/asottile/reorder-python-imports
- rev: v3.12.0
+ rev: v3.13.0
hooks:
- id: reorder-python-imports
args: [--py38-plus, --add-import, 'from __future__ import annotations']
@@ -23,20 +23,20 @@ repos:
hooks:
- id: add-trailing-comma
- repo: https://github.com/asottile/pyupgrade
- rev: v3.15.2
+ rev: v3.16.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/hhatto/autopep8
- rev: v2.1.0
+ rev: v2.3.1
hooks:
- id: autopep8
- repo: https://github.com/PyCQA/flake8
- rev: 7.0.0
+ rev: 7.1.0
hooks:
- id: flake8
exclude: ^identify/vendor/licenses\.py$
- repo: https://github.com/pre-commit/mirrors-mypy
- rev: v1.9.0
+ rev: v1.10.1
hooks:
- id: mypy
diff --git a/identify/extensions.py b/identify/extensions.py
index d427f67..cc9d95c 100644
--- a/identify/extensions.py
+++ b/identify/extensions.py
@@ -56,6 +56,7 @@ EXTENSIONS = {
'ear': {'binary', 'zip', 'jar'},
'edn': {'text', 'clojure', 'edn'},
'ejs': {'text', 'ejs'},
+ 'ejson': {'text', 'json', 'ejson'},
'env': {'text', 'dotenv'},
'eot': {'binary', 'eot'},
'eps': {'binary', 'eps'},
diff --git a/identify/identify.py b/identify/identify.py
index 2bf2125..0279ba8 100644
--- a/identify/identify.py
+++ b/identify/identify.py
@@ -191,14 +191,14 @@ def parse_shebang(bytesio: IO[bytes]) -> tuple[str, ...]:
return ()
cmd = tuple(_shebang_split(first_line.strip()))
- if cmd and cmd[0] == '/usr/bin/env':
- if cmd[1] == '-S':
- cmd = cmd[2:]
- else:
- cmd = cmd[1:]
+ if cmd[:2] == ('/usr/bin/env', '-S'):
+ cmd = cmd[2:]
+ elif cmd[:1] == ('/usr/bin/env',):
+ cmd = cmd[1:]
+
+ if cmd == ('nix-shell',):
+ return _parse_nix_shebang(bytesio, cmd)
- if cmd == ('nix-shell',):
- return _parse_nix_shebang(bytesio, cmd)
return cmd
diff --git a/setup.cfg b/setup.cfg
index 9455e58..05f502b 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,6 +1,6 @@
[metadata]
name = identify
-version = 2.5.36
+version = 2.6.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 bb8aba5..c0e5410 100644
--- a/tests/identify_test.py
+++ b/tests/identify_test.py
@@ -325,6 +325,8 @@ def test_file_is_text_does_not_exist(tmpdir):
(b'#!\x00\x00\x00\x00', ()),
# shebang lines with multiple arguments
(b'#!/usr/bin/env -S python -u', ('python', '-u')),
+ (b'#!/usr/bin/env', ()),
+ (b'#!/usr/bin/env -S', ()),
),
)
def test_parse_shebang(s, expected):