mirror of
https://github.com/Chia-Network/chia-blockchain.git
synced 2026-08-24 02:24:23 -05:00
add poetry check ... well, check (#18357)
* add poetry check ... well, check * add poetry check to pre-commit * touchup * Update activated.sh * Update activated.ps1
This commit is contained in:
@@ -136,6 +136,9 @@ jobs:
|
||||
command: |
|
||||
python3 -m chia._tests.util.build_network_protocol_files
|
||||
git diff --exit-code
|
||||
- name: poetry
|
||||
command: |
|
||||
.penv/bin/poetry check
|
||||
|
||||
steps:
|
||||
- uses: chia-network/actions/clean-workspace@main
|
||||
|
||||
@@ -28,6 +28,13 @@ repos:
|
||||
language: system
|
||||
require_serial: true
|
||||
types_or: [python, pyi]
|
||||
- repo: local
|
||||
hooks:
|
||||
- id: poetry
|
||||
name: poetry
|
||||
entry: ./activated.py --poetry poetry check
|
||||
language: system
|
||||
pass_filenames: false
|
||||
- repo: https://github.com/pre-commit/mirrors-prettier
|
||||
rev: v3.1.0
|
||||
hooks:
|
||||
|
||||
+4
-2
@@ -2,11 +2,13 @@ $ErrorActionPreference = "Stop"
|
||||
|
||||
$script_directory = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
$command = $args[0]
|
||||
$env_directory = $args[0]
|
||||
$command = $args[1]
|
||||
$parameters = [System.Collections.ArrayList]$args
|
||||
$parameters.RemoveAt(0)
|
||||
$parameters.RemoveAt(0)
|
||||
|
||||
& $script_directory/.venv/Scripts/Activate.ps1
|
||||
& $script_directory/$env_directory/Scripts/Activate.ps1
|
||||
& $command @parameters
|
||||
|
||||
exit $LASTEXITCODE
|
||||
|
||||
+13
-2
@@ -2,6 +2,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import enum
|
||||
import os
|
||||
import pathlib
|
||||
import subprocess
|
||||
@@ -10,17 +11,27 @@ import sys
|
||||
here = pathlib.Path(__file__).parent.absolute()
|
||||
|
||||
|
||||
class Env(enum.Enum):
|
||||
chia = ".venv"
|
||||
poetry = ".penv"
|
||||
|
||||
|
||||
def main(*args: str) -> int:
|
||||
if len(args) == 0:
|
||||
print("Parameters required")
|
||||
return 1
|
||||
|
||||
env = Env.chia
|
||||
if args[0].startswith("--"):
|
||||
env = Env[args[0][2:]]
|
||||
args = args[1:]
|
||||
|
||||
if sys.platform == "win32":
|
||||
script = "activated.ps1"
|
||||
command = ["powershell", os.fspath(here.joinpath(script)), *args]
|
||||
command = ["powershell", os.fspath(here.joinpath(script)), env.value, *args]
|
||||
else:
|
||||
script = "activated.sh"
|
||||
command = ["sh", os.fspath(here.joinpath(script)), *args]
|
||||
command = ["sh", os.fspath(here.joinpath(script)), env.value, *args]
|
||||
|
||||
completed_process = subprocess.run(command)
|
||||
|
||||
|
||||
+6
-2
@@ -6,7 +6,11 @@ SCRIPT_DIRECTORY=$(
|
||||
cd -- "$(dirname -- "$0")"
|
||||
pwd
|
||||
)
|
||||
# shellcheck disable=SC1091
|
||||
. "${SCRIPT_DIRECTORY}/.venv/bin/activate"
|
||||
|
||||
ENV_DIRECTORY="$1"
|
||||
shift
|
||||
|
||||
# shellcheck disable=SC1090,SC1091
|
||||
. "${SCRIPT_DIRECTORY}/${ENV_DIRECTORY}/bin/activate"
|
||||
|
||||
"$@"
|
||||
|
||||
Reference in New Issue
Block a user