Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zipapp support #1616

Merged
merged 2 commits into from Oct 17, 2020
Merged

add zipapp support #1616

merged 2 commits into from Oct 17, 2020

Conversation

asottile
Copy link
Member

seems to work!

$ ./pre-commit-2.7.1.pyz run flake8 --all-files
flake8...................................................................Passed

@asottile
Copy link
Member Author

doesn't quite work on windows yet -- I probably need the shebang code here as well:

C:\Users\Anthony\workspace\babi>python E:\VMs\Ubuntu20.04_shared\pre-commit-2.7.1.pyz run --all-files
[INFO] Initializing environment for https://gitlab.com/pycqa/flake8.
[INFO] Initializing environment for https://gitlab.com/pycqa/flake8:flake8-typing-imports==1.7.0.
[INFO] Initializing environment for https://github.com/pre-commit/mirrors-autopep8.
[INFO] Initializing environment for https://github.com/asottile/reorder_python_imports.
[INFO] Initializing environment for https://github.com/asottile/pyupgrade.
[INFO] Initializing environment for https://github.com/asottile/setup-cfg-fmt.
[INFO] Installing environment for https://gitlab.com/pycqa/flake8.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('C:\\Users\\Anthony\\.cache\\pre-commit-zipapp\\SuNk3yXatwvuqrztl46R2--u3qyqevT15p2e3M1XeSM\\fakepython', '-mvirtualenv', 'C:\\Users\\Anthony\\.cache\\pre-commit\\repo0di586bv\\py_env-python3.7', '-p', 'C:\\Users\\Anthony\\.cache\\pre-commit-zipapp\\SuNk3yXatwvuqrztl46R2--u3qyqevT15p2e3M1XeSM\\fakepython')
return code: 1
expected return code: 0
stdout:
    Executable `python3` not found
stderr: (none)
Check the log at C:\Users\Anthony\.cache\pre-commit\pre-commit.log

@asottile
Copy link
Member Author

asottile commented Sep 24, 2020

looks like this is going to need #1617 on windows :(

@asottile
Copy link
Member Author

windows needs more work as well, probably need to write a shim python.bat (I couldn't get python.py via python to work for whatever reason -- though it works from cmd.exe)

@asottile
Copy link
Member Author

looks like a .bat isn't going to work either, so I should probably attempt to do this with a .exe :(

almost everything works, like out.pyz run --all-files works fine and dandy

but running from git commit does not work on windows:

C:\Users\Anthony\workspace\babi>git commit -m "foo"
Traceback (most recent call last):
  File ".git/hooks/pre-commit", line 42, in <module>
    raise SystemExit(subprocess.call(CMD))
  File "C:\Python37\lib\subprocess.py", line 323, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Python37\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
  File "C:\Python37\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
OSError: [WinError 193] %1 is not a valid Win32 application

and I feel like that's kinda important :)

@asottile
Copy link
Member Author

made a shim .exe and it seems to work!

@asottile asottile merged commit 9e4754f into master Oct 17, 2020
@asottile asottile deleted the zipapp branch October 17, 2020 18:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant