From f5509a4268d9726946aaede3b5cd58e317860f6c Mon Sep 17 00:00:00 2001 From: David Lord Date: Sun, 12 Mar 2023 08:13:26 -0700 Subject: [PATCH] try waiting for postCreateCommand --- .devcontainer/devcontainer.json | 33 +++++++++++----------------- .devcontainer/post-create-command.sh | 16 ++++---------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index 18125c7d..c83246b6 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,26 +1,19 @@ -// For format details, see https://aka.ms/devcontainer.json { "name": "pallets/flask", - "image": "mcr.microsoft.com/vscode/devcontainers/python:3", - - // Configure tool-specific properties. - "customizations": { - // Configure properties specific to VS Code. - "vscode": { - // Set *default* container specific settings.json values on container create. - "settings": { - // Settings for the python extension. + "image": "mcr.microsoft.com/devcontainers/python:3", + "customizations": { + "vscode": { + "settings": { "python.defaultInterpreterPath": "${workspaceFolder}/.venv", - "python.terminal.activateEnvInCurrentTerminal": true, - // Prevent the terminal from refreshing on extension load. - "terminal.integrated.environmentChangesRelaunch": false + "python.terminal.activateEnvInCurrentTerminal": true, + "python.terminal.launchArgs": [ + "-X", + "dev" + ] } } - }, - - // Displays a custom welcome message. - "onCreateCommand": "sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt", - - // Runs the initial setup commands after the container is created. - "postCreateCommand": "sudo chmod +x .devcontainer/post-create-command.sh && .devcontainer/post-create-command.sh" + }, + // "onCreateCommand": "sudo cp .devcontainer/welcome-message.txt /usr/local/etc/vscode-dev-containers/first-run-notice.txt", + "postCreateCommand": "sudo chmod +x .devcontainer/post-create-command.sh && .devcontainer/post-create-command.sh", + "waitFor": "postCreateCommand" } diff --git a/.devcontainer/post-create-command.sh b/.devcontainer/post-create-command.sh index b41648c3..679bd3e9 100755 --- a/.devcontainer/post-create-command.sh +++ b/.devcontainer/post-create-command.sh @@ -2,20 +2,12 @@ set -e # Add user's fork as a remote -if ! git remote | grep -q "fork"; then - git remote add fork https://github.com/${GITHUB_USER}/flask -fi +# if ! git remote | grep -q "fork"; then +# git remote add fork https://github.com/${GITHUB_USER}/flask +# fi -# Create and activate a virtualenv python3 -m venv .venv . .venv/bin/activate - -# Upgrade pip and setuptools -python -m pip install --upgrade pip setuptools - -# Install the development dependencies, then install Flask in editable mode +pip install --upgrade pip setuptools pip install -r requirements/dev.txt && pip install -e . - -# Install pre-commit hooks and coverage pre-commit install -pip install coverage