Spaces:
Running
Running
from git import Repo | |
import os | |
import subprocess | |
GITHUB_PAT = os.getenv('GITHUB_PAT') | |
GIT_USER = os.getenv('GIT_USER') | |
GIT_REPO = os.getenv('GIT_REPO') | |
if GITHUB_PAT: | |
print("GITHUB_PAT set") | |
if not os.path.exists('cloned_repo'): | |
Repo.clone_from(f'https://github.com/zihanxing/decorx-rowe-tool', './cloned_repo') | |
# Install Python dependencies | |
subprocess.run(['pip', 'install', '-r', 'cloned_repo/requirements.txt']) | |
# Install system-level dependencies if packages.txt exists | |
if os.path.exists('cloned_repo/packages.txt'): | |
with open('cloned_repo/packages.txt') as f: | |
packages = f.read().splitlines() | |
if packages: | |
subprocess.run(['apt-get', 'update']) | |
subprocess.run(['apt-get', 'install', '-y'] + packages) | |
import cloned_repo.main as main | |
from cloned_repo.main import * | |