Visitar URL original
add zipapp support by asottile · Pull Request #1616 · pre-commit/pre-commit · GitHub
The Wayback Machine - https://web.archive.org/web/20201130222607/https://github.com/pre-commit/pre-commit/pull/1616
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

@asottile asottile commented Sep 23, 2020

seems to work!

$ ./pre-commit-2.7.1.pyz run flake8 --all-files
flake8...................................................................Passed
@asottile
Copy link
Member Author

@asottile asottile commented Sep 23, 2020

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 asottile commented Sep 24, 2020 •

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

@asottile asottile force-pushed the zipapp branch from 0d81545 to 379bc82 Sep 24, 2020
@asottile
Copy link
Member Author

@asottile asottile commented Sep 24, 2020

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 asottile force-pushed the zipapp branch 2 times, most recently from 0b40d1b to 4e18f65 Sep 25, 2020
@asottile
Copy link
Member Author

@asottile asottile commented Sep 25, 2020

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 asottile force-pushed the zipapp branch from 4e18f65 to fbd5292 Sep 29, 2020
@asottile
Copy link
Member Author

@asottile asottile commented Sep 29, 2020

made a shim .exe and it seems to work!

@asottile asottile merged commit 9e4754f into master Oct 17, 2020
1 check passed
1 check passed
pre-commit.pre-commit #20200929.1 succeeded
Details
@asottile asottile deleted the zipapp branch Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

1 participant
You can’t perform that action at this time.