Skip to content

Commit

Permalink
Fix minimal and React examples (maybe)
Browse files Browse the repository at this point in the history
  • Loading branch information
EdwinWiseOne committed Apr 8, 2024
1 parent ae08f6a commit f3a1077
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 2 deletions.
66 changes: 66 additions & 0 deletions Minimal/bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Enthought product code
#
# (C) Copyright 2010-2022 Enthought, Inc., Austin, TX
# All rights reserved.
#
# This file and its contents are confidential information and NOT open source.
# Distribution is prohibited.

"""
Bootstrap file, which builds the local EDM development environment for this
example.
"""

import argparse
import subprocess

ENV_NAME = "edge-minimal-example"
EDM_DEPS = ["click", "pip", "setuptools"]


def bootstrap(ci_mode):
"""Create and populate dev env.
Will automatically activate the environment, unless ci_mode is True.
"""

if ENV_NAME not in _list_edm_envs():
print(f"Creating development environment {ENV_NAME}...")
cmd = ["edm", "envs", "create", ENV_NAME, "--version", "3.8", "--force"]
subprocess.run(cmd, check=True)

cmd = ["edm", "install", "-e", ENV_NAME, "-y"] + EDM_DEPS
subprocess.run(cmd, check=True)

print("Bootstrap complete.")

else:
print("Environment already exists; reusing.")

if not ci_mode:
print(f"Activating dev environment {ENV_NAME}")
subprocess.run(["edm", "shell", "-e", ENV_NAME])


def _list_edm_envs():
cmd = ["edm", "envs", "list"]
proc = subprocess.run(
cmd, check=True, capture_output=True, encoding="utf-8", errors="ignore"
)
envs = []
for line in proc.stdout.split("\n"):
parts = line.split()
if len(parts) < 6:
continue
if parts[0] == "*":
envs.append(parts[1])
else:
envs.append(parts[0])
return envs


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ci", action="store_true")
args = parser.parse_args()
bootstrap(args.ci)
4 changes: 2 additions & 2 deletions React/ci/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
SRC_ROOT = op.abspath(op.join(op.dirname(__file__), ".."))

# Docker image will be tagged "IMAGE:VERSION"
IMAGE = "quay.io/enthought/edge-react-example"
VERSION = "1.2.0"
IMAGE = "quay.io/enthought/edge-native-app-flask-demo"
VERSION = "1.1.0"

# These will go into the built Docker image. You may wish to modify this
# minimal example to pin the dependencies, or use a bundle file to define them.
Expand Down

0 comments on commit f3a1077

Please sign in to comment.