fix: Use venv Python for scripts, fix import order in figma-sync
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
Some checks failed
DSS Project Analysis / dss-context-update (push) Has been cancelled
- Move sys.path modification before dss imports in figma-sync.py - Add missing Dict type hint import - Add PYTHON variable to dss-init.sh using venv if available - Update script calls to use $PYTHON instead of python3 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -17,6 +17,13 @@ set -e
|
||||
DSS_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
||||
cd "$DSS_ROOT"
|
||||
|
||||
# Use venv Python if available
|
||||
if [ -f "$DSS_ROOT/.venv/bin/python3" ]; then
|
||||
PYTHON="$DSS_ROOT/.venv/bin/python3"
|
||||
else
|
||||
PYTHON="python3"
|
||||
fi
|
||||
|
||||
# Parse arguments
|
||||
RESET=false
|
||||
SKIP_ANALYSIS=false
|
||||
@@ -392,7 +399,7 @@ fi
|
||||
# Run validation if available
|
||||
if [ -f "scripts/validate-theme.py" ] && [ -f ".dss/schema/skin-contract.json" ]; then
|
||||
log_info "Running theme/skin validation..."
|
||||
if python3 scripts/validate-theme.py --validate-skin --quiet 2>&1 | while read line; do
|
||||
if $PYTHON scripts/validate-theme.py --validate-skin --quiet 2>&1 | while read line; do
|
||||
echo " $line"
|
||||
done; then
|
||||
log_ok "All validations passed"
|
||||
@@ -421,7 +428,7 @@ if [ "$FIGMA_AVAILABLE" = true ] && [ "$TOKEN_STATUS" = "empty" ]; then
|
||||
log_info "File: $FIGMA_FILE_KEY"
|
||||
|
||||
# Run Figma sync script
|
||||
if python3 "$DSS_ROOT/scripts/figma-sync.py" --file-key "$FIGMA_FILE_KEY" 2>&1 | while read line; do
|
||||
if $PYTHON "$DSS_ROOT/scripts/figma-sync.py" --file-key "$FIGMA_FILE_KEY" 2>&1 | while read line; do
|
||||
echo " $line"
|
||||
done; then
|
||||
log_ok "Figma sync complete"
|
||||
@@ -450,7 +457,7 @@ HAS_SKINS=$([ -d ".dss/skins/shadcn" ] && echo "yes" || echo "no")
|
||||
|
||||
if [ "$HAS_PRIMITIVES" = "yes" ] && [ "$HAS_SKINS" = "yes" ]; then
|
||||
log_info "Resolving: Core → Skin → Theme"
|
||||
if python3 scripts/resolve-tokens.py 2>&1 | while read line; do
|
||||
if $PYTHON scripts/resolve-tokens.py 2>&1 | while read line; do
|
||||
echo " $line"
|
||||
done; then
|
||||
log_ok "Token cascade resolved"
|
||||
@@ -523,7 +530,7 @@ log_step "11. Generating Storybook stories..."
|
||||
|
||||
if [ "$HAS_TOKENS" = "yes" ] && [ -f "scripts/generate-storybook.py" ]; then
|
||||
log_info "Building stories from tokens..."
|
||||
if python3 scripts/generate-storybook.py 2>&1 | while read line; do
|
||||
if $PYTHON scripts/generate-storybook.py 2>&1 | while read line; do
|
||||
echo " $line"
|
||||
done; then
|
||||
STORY_COUNT=$(find admin-ui/src/stories -name "*.stories.js" 2>/dev/null | wc -l)
|
||||
|
||||
@@ -16,15 +16,16 @@ import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Dict
|
||||
|
||||
from dss.ingest.base import TokenCollection
|
||||
from dss.ingest.sources.figma import FigmaTokenSource
|
||||
|
||||
# Ensure the project root is in the Python path
|
||||
# Ensure the project root is in the Python path BEFORE importing dss modules
|
||||
DSS_ROOT = Path(__file__).parent.parent
|
||||
if str(DSS_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(DSS_ROOT))
|
||||
|
||||
from dss.ingest.base import TokenCollection
|
||||
from dss.ingest.sources.figma import FigmaTokenSource
|
||||
|
||||
|
||||
# =============================================================================
|
||||
# CONFIGURATION
|
||||
|
||||
Reference in New Issue
Block a user