mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 00:54:42 +04:00
make an exe stub for windows
This commit is contained in:
parent
bc198b89ca
commit
fbd529204b
4 changed files with 35 additions and 8 deletions
|
|
@ -33,7 +33,8 @@ def _ensure_cache(zipf: zipfile.ZipFile, cache_key: str) -> str:
|
|||
try:
|
||||
zipf.extractall(tmpdir)
|
||||
# zip doesn't maintain permissions
|
||||
_make_executable(os.path.join(tmpdir, 'fakepython'))
|
||||
_make_executable(os.path.join(tmpdir, 'python'))
|
||||
_make_executable(os.path.join(tmpdir, 'python.exe'))
|
||||
os.rename(tmpdir, cache_dest)
|
||||
except BaseException:
|
||||
shutil.rmtree(tmpdir)
|
||||
|
|
@ -49,8 +50,12 @@ def main() -> int:
|
|||
|
||||
cache_dest = _ensure_cache(zipf, cache_key)
|
||||
|
||||
fakepython = os.path.join(cache_dest, 'fakepython')
|
||||
cmd = (sys.executable, fakepython, '-mpre_commit', *sys.argv[1:])
|
||||
if sys.platform != 'win32':
|
||||
exe = os.path.join(cache_dest, 'python')
|
||||
else:
|
||||
exe = os.path.join(cache_dest, 'python.exe')
|
||||
|
||||
cmd = (exe, '-mpre_commit', *sys.argv[1:])
|
||||
if sys.platform == 'win32': # https://bugs.python.org/issue19124
|
||||
import subprocess
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue