firefly-viewer/build.py
2025-04-11 22:45:43 -05:00

38 lines
1.0 KiB
Python

import os
import subprocess
import shutil
def clean_build():
"""Clean up build artifacts"""
dirs_to_clean = ['build', 'dist', '*.egg-info']
for dir_pattern in dirs_to_clean:
for item in glob.glob(dir_pattern):
if os.path.isdir(item):
shutil.rmtree(item)
else:
os.remove(item)
def build_package():
"""Build the package"""
clean_build()
subprocess.check_call(['python', 'setup.py', 'sdist', 'bdist_wheel'])
def install_package():
"""Install the package in development mode"""
subprocess.check_call(['pip', 'install', '-e', '.'])
if __name__ == '__main__':
import sys
import glob
command = sys.argv[1] if len(sys.argv) > 1 else 'build'
if command == 'clean':
clean_build()
elif command == 'build':
build_package()
elif command == 'install':
install_package()
else:
print(f"Unknown command: {command}")
print("Available commands: clean, build, install")