|
7 | 7 | from time import sleep |
8 | 8 |
|
9 | 9 | sys.path.append(Path.cwd().parent.as_posix()) |
10 | | -os.chdir("..") |
| 10 | + |
| 11 | +if not Path("setup.py").exists(): |
| 12 | + print("You're not in the right directory. Run this script from the " |
| 13 | + r"project's root directory, e.g. 'C:\users\your_user\projects\pyttman'.") |
| 14 | + exit(-1) |
11 | 15 |
|
12 | 16 | LAB_ENV_PATH = Path.cwd() / Path("dev_env") |
13 | 17 | BUILD_OUTPUT_PATH = Path.cwd() / "dist" |
|
17 | 21 | shutil.rmtree((LAB_ENV_PATH / "venv").as_posix()) |
18 | 22 |
|
19 | 23 | if not Path("dist").exists(): |
20 | | - print("\nCannot create local testing environment as there is no " |
21 | | - "build generated for the current local version of Pyttman.", |
22 | | - "Run 'build.py' to create one.") |
23 | | - exit(-1) |
| 24 | + subprocess.check_call("python devtools/build.py".split()) |
24 | 25 |
|
25 | 26 | LAB_ENV_PATH.mkdir(exist_ok=True) |
26 | 27 | os.chdir(LAB_ENV_PATH.as_posix()) |
|
39 | 40 | subprocess.run(f"{venv_python} -m pip install multidict".split()) |
40 | 41 | subprocess.run(f"{venv_python} -m pip install {package_file}".split()) |
41 | 42 |
|
42 | | - print("\nFinished! You can now create an app and start testing in " |
43 | | - f"{LAB_ENV_PATH.as_posix()}.") |
| 43 | + clear_sc = "clear" if os.name == "posix" else "cls" |
| 44 | + os.system(clear_sc) |
| 45 | + |
| 46 | + os.system("cls") |
| 47 | + print("\nFinished! Here's how to get started:", |
| 48 | + f"1. Activate the virtual environment:\n\tcd dev_env\n\tvenv/scripts/activate", |
| 49 | + f"2. Run the command 'pyttman' to see available commands to the Pyttman CLI", |
| 50 | + "3. If it's the first time you're running Pyttman, run 'pyttman new app {app_name}' to create a new project." |
| 51 | + "4. Run 'pyttman dev {app_name}' to start the development server.", |
| 52 | + "5. If you've made changes to the Pyttman framework which you want to test in your testing project, " |
| 53 | + "run this script again. Your app will be left untouched, but the Pyttman version is upgraded to " |
| 54 | + "your current HEAD in the Pyttman repo.", |
| 55 | + sep="\n") |
0 commit comments