Python tooling improvements #44

Merged
MartinFouilleul merged 4 commits from python-improvements into main 2023-08-18 14:50:32 +00:00
2 changed files with 17 additions and 2 deletions
Showing only changes of commit 570a33a0e1 - Show all commits

View File

@ -1,4 +1,3 @@
import argparse
from datetime import datetime from datetime import datetime
import glob import glob
import os import os
@ -506,12 +505,25 @@ def install(args):
bin_dir = os.path.join(dest, "bin") bin_dir = os.path.join(dest, "bin")
yeet(bin_dir) yeet(bin_dir)
# The MS Store version of Python does some really stupid stuff with AppData:
# https://git.handmade.network/hmn/orca/issues/32
#
# Any new files and folders created in AppData actually get created in a special
# folder specific to the Python version. However, if the files or folders already
# exist, the redirect does not happen. So, if we first use the shell to create the
# paths we need, the following scripts work regardless of Python install.
#
# Also apparently you can't just do mkdir in a subprocess call here, hence the
# trivial batch script.
if platform.system() == "Windows":
subprocess.run(["scripts\\mkdir.bat", bin_dir], check=True)
shutil.copytree("scripts", os.path.join(bin_dir, "sys_scripts")) shutil.copytree("scripts", os.path.join(bin_dir, "sys_scripts"))
shutil.copy("orca", bin_dir) shutil.copy("orca", bin_dir)
if platform.system() == "Windows": if platform.system() == "Windows":
shutil.copy("orca.bat", bin_dir) shutil.copy("orca.bat", bin_dir)
# TODO: Customize these instructions for Windows
print() print()
if platform.system() == "Windows": if platform.system() == "Windows":
print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by") print("The Orca tools have been installed. Make sure the Orca tools are on your PATH by")

3
scripts/mkdir.bat Normal file
View File

@ -0,0 +1,3 @@
@echo off
mkdir %1
exit /b %errorlevel%