Add release workflow (#961)

## Summary

This PR adds a release workflow powered by `cargo-dist`. It's similar to
the version that's PR'd in Ruff
(https://github.com/astral-sh/ruff/pull/9559), with the exception that
it doesn't include the Docker build or the "update dependents" step for
pre-commit.
This commit is contained in:
Charlie Marsh
2024-01-18 15:44:11 -05:00
committed by GitHub
parent a883de4fb0
commit f9154e8297
14 changed files with 834 additions and 9 deletions

View File

39
python/puffin/__main__.py Normal file
View File

@@ -0,0 +1,39 @@
import os
import sys
import sysconfig
def find_puffin_bin() -> str:
"""Return the puffin binary path."""
puffin_exe = "puffin" + sysconfig.get_config_var("EXE")
path = os.path.join(sysconfig.get_path("scripts"), puffin_exe)
if os.path.isfile(path):
return path
if sys.version_info >= (3, 10):
user_scheme = sysconfig.get_preferred_scheme("user")
elif os.name == "nt":
user_scheme = "nt_user"
elif sys.platform == "darwin" and sys._framework:
user_scheme = "osx_framework_user"
else:
user_scheme = "posix_user"
path = os.path.join(sysconfig.get_path("scripts", scheme=user_scheme), puffin_exe)
if os.path.isfile(path):
return path
raise FileNotFoundError(path)
if __name__ == "__main__":
puffin = os.fsdecode(find_puffin_bin())
if sys.platform == "win32":
import subprocess
completed_process = subprocess.run([puffin, *sys.argv[1:]])
sys.exit(completed_process.returncode)
else:
os.execvp(puffin, [puffin, *sys.argv[1:]])