[chore] removed onedev buildscpec
[fix] use subprocess instead of execvp

using execvp means that we have to add the messages before git-add
switching to subprocess allows us to check whether git-add was successfull
and if it was, then add the message.

ondev buildspec was removed as we have switched to gittea
This commit is contained in:
Adwaith-Rajesh 2025-08-19 22:30:59 +05:30
parent 376f5ac101
commit bd77cd3676
No known key found for this signature in database
GPG Key ID: 07AE7AA27444C4DB
2 changed files with 9 additions and 39 deletions

View File

@ -1,35 +0,0 @@
version: 39
jobs:
- name: Upload to Pypi
steps:
- !CheckoutStep
name: Checkout Code
cloneCredential: !DefaultCredential {}
withLfs: false
withSubmodules: false
cloneDepth: 1
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
- !CommandStep
name: Publish to Pypi
runInContainer: true
image: python:3.12-bullseye
interpreter: !DefaultInterpreter
commands: |
cat << EOF > $HOME/.pypirc
[pypi]
username=__token__
password=@secret:access-token@
EOF
pip3 install build twine
python3 -m build
python3 -m twine upload dist/*
useTTY: true
condition: ALL_PREVIOUS_STEPS_WERE_SUCCESSFUL
triggers:
- !TagCreateTrigger
branches: dev
retryCondition: never
maxRetries: 3
retryDelay: 30
timeout: 14400

View File

@ -4,9 +4,9 @@ import argparse
import configparser
import os
import stat
import subprocess
import sys
from pathlib import Path
from typing import NoReturn
GIT_DIR = Path('.git')
@ -77,16 +77,21 @@ def _reset_commit_msg_file() -> None:
GIT_COMMIT_MSG_FILE.write_text('')
def git_add() -> NoReturn:
def _run_git_add(args: list[str]) -> int:
git_add = subprocess.run(['git', 'add', *args])
return git_add.returncode
def git_add() -> int:
add_parser = argparse.ArgumentParser()
add_parser.add_argument('-m', '--message', required=True, help='Message to add')
add_parser.add_argument('--type', choices=COMMIT_TYPES, default='feat', help='The type of the change')
args, rest = add_parser.parse_known_args()
if args.message:
if args.message and (_run_git_add(rest) == 0):
print(_add_msg_to_file(args.message, args.type))
os.execvp('git', ('git', 'add', *rest))
return 0
def show_messages() -> int: