wip deepseek r1
This commit is contained in:
64
scripts/setup_binaries.py
Normal file
64
scripts/setup_binaries.py
Normal file
@@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Script to extract binary names from setup.py files and create placeholder files.
|
||||
Usage: setup_binaries.py /path/to/setup.py
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
import re
|
||||
|
||||
def extract_setup_binaries(setup_path):
|
||||
"""Extract binary names from a setup.py file and create placeholder files."""
|
||||
try:
|
||||
# Read the setup.py file
|
||||
with open(setup_path, 'r') as f:
|
||||
setup_content = f.read()
|
||||
|
||||
# Find all references to scripts in bin/ directory
|
||||
scripts = re.findall(r"'bin/[^']+?'|\"bin/[^\"]+?\"", setup_content)
|
||||
if not scripts:
|
||||
print(f"No bin scripts found in {setup_path}")
|
||||
return True # Not an error, just no scripts
|
||||
|
||||
# Clean up the extracted script names
|
||||
scripts = [script.strip('\'"') for script in scripts]
|
||||
|
||||
# Create placeholder files
|
||||
base_dir = os.path.dirname(setup_path)
|
||||
created_count = 0
|
||||
|
||||
for script in scripts:
|
||||
script_path = os.path.join(base_dir, script)
|
||||
script_dir = os.path.dirname(script_path)
|
||||
|
||||
# Create directory if it doesn't exist
|
||||
os.makedirs(script_dir, exist_ok=True)
|
||||
|
||||
# Create an empty file
|
||||
with open(script_path, 'w') as f:
|
||||
pass
|
||||
|
||||
# Make the file executable
|
||||
os.chmod(script_path, 0o755)
|
||||
created_count += 1
|
||||
|
||||
print(f"Created {created_count} placeholder binary files from {setup_path}")
|
||||
return True
|
||||
|
||||
except Exception as e:
|
||||
print(f"Error processing {setup_path}: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print(f"Usage: {sys.argv[0]} /path/to/setup.py")
|
||||
sys.exit(1)
|
||||
|
||||
setup_path = sys.argv[1]
|
||||
if not os.path.exists(setup_path):
|
||||
print(f"Error: {setup_path} not found")
|
||||
sys.exit(1)
|
||||
|
||||
success = extract_setup_binaries(setup_path)
|
||||
sys.exit(0 if success else 1)
|
||||
Reference in New Issue
Block a user