mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 00:04:42 +04:00
Add utility for parsing shebangs and resolving PATH
This commit is contained in:
parent
a932315a15
commit
82369fd99f
6 changed files with 267 additions and 13 deletions
|
|
@ -5,10 +5,10 @@ import io
|
|||
import logging
|
||||
import os
|
||||
import os.path
|
||||
import stat
|
||||
import sys
|
||||
|
||||
from pre_commit.logging_handler import LoggingHandler
|
||||
from pre_commit.util import make_executable
|
||||
from pre_commit.util import mkdirp
|
||||
from pre_commit.util import resource_filename
|
||||
|
||||
|
|
@ -42,14 +42,6 @@ def is_previous_pre_commit(filename):
|
|||
return any(hash in contents for hash in PREVIOUS_IDENTIFYING_HASHES)
|
||||
|
||||
|
||||
def make_executable(filename):
|
||||
original_mode = os.stat(filename).st_mode
|
||||
os.chmod(
|
||||
filename,
|
||||
original_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH,
|
||||
)
|
||||
|
||||
|
||||
def install(runner, overwrite=False, hooks=False, hook_type='pre-commit'):
|
||||
"""Install the pre-commit hooks."""
|
||||
hook_path = runner.get_hook_path(hook_type)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue