forked from akabarki76/bugster-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdev.py
More file actions
executable file
·80 lines (61 loc) · 2.23 KB
/
Copy pathdev.py
File metadata and controls
executable file
·80 lines (61 loc) · 2.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/env python3
"""
Development script for Bugster CLI.
Helps with local development, testing, and installation.
PURPOSE: This script is for developers working on the Bugster CLI project.
USAGE: python scripts/dev.py [command]
Commands: setup, test, build, all
"""
import argparse
import os
import subprocess
import sys
def run_command(command, description=None):
"""Run a shell command and print its output."""
if description:
print(f"\n{description}...\n")
result = subprocess.run(command, shell=True, capture_output=True, text=True)
if result.stdout:
print(result.stdout)
if result.stderr:
print(result.stderr, file=sys.stderr)
if result.returncode != 0:
print(f"Command failed with exit code {result.returncode}")
sys.exit(result.returncode)
return result
def setup_dev():
"""Set up the development environment."""
run_command("pip install -e .", "Installing in development mode")
def run_tests():
"""Run tests for the project."""
# You can replace this with proper test command once you have tests
run_command("python -m bugster.cli --help", "Running basic CLI test")
def build_local():
"""Build the project locally using PyInstaller."""
run_command("python scripts/build.py", "Building executable")
def main():
parser = argparse.ArgumentParser(description="Development tools for Bugster CLI")
subparsers = parser.add_subparsers(dest="command", help="Command to run")
# Setup development environment
subparsers.add_parser("setup", help="Install package in development mode")
# Run tests
subparsers.add_parser("test", help="Run tests")
# Build executable
subparsers.add_parser("build", help="Build executable")
# All-in-one command
subparsers.add_parser("all", help="Run setup, tests, and build")
args = parser.parse_args()
if args.command == "setup":
setup_dev()
elif args.command == "test":
run_tests()
elif args.command == "build":
build_local()
elif args.command == "all":
setup_dev()
run_tests()
build_local()
else:
parser.print_help()
if __name__ == "__main__":
main()