Merge remote-tracking branch 'upstream/DoorDevUnstable' into OverworldShuffle

This commit is contained in:
codemann8
2021-04-12 13:32:14 -05:00
62 changed files with 2829 additions and 380 deletions

View File

@@ -5,13 +5,13 @@
"type": "bool"
},
"create_spoiler": {
"action": "store_true",
"type": "bool"
"action": "store_false",
"dest": "suppress_spoiler",
"type": "bool",
"help": "suppress"
},
"suppress_spoiler": {
"action": "store_false",
"dest": "create_spoiler",
"help": "suppress"
"action": "store_true"
},
"logic": {
"choices": [
@@ -226,6 +226,13 @@
"usestartinventory": {
"type": "bool"
},
"triforce_pool": {},
"triforce_goal": {},
"triforce_pool_min": {},
"triforce_pool_max": {},
"triforce_goal_min": {},
"triforce_goal_max": {},
"triforce_min_difference": {},
"custom": {
"type": "bool",
"help": "suppress"

View File

@@ -1,3 +1,6 @@
aenum
fast-enum
python-bps-continued
python-bps-continued
colorama
aioconsole
websockets

View File

@@ -1,5 +1,7 @@
import os # for env vars
import stat # file statistics
import sys # default system info
from my_path import get_py_path
global UBUNTU_VERSIONS
global DEFAULT_EVENT
@@ -44,6 +46,8 @@ def prepare_env():
APP_VERSION = f.readlines()[0].strip()
# ci data
env["CI_SYSTEM"] = os.getenv("CI_SYSTEM","")
# py data
(env["PYTHON_EXE_PATH"],env["PY_EXE_PATH"],env["PIP_EXE_PATH"]) = get_py_path()
# git data
env["BRANCH"] = os.getenv("TRAVIS_BRANCH","")
env["GITHUB_ACTOR"] = os.getenv("GITHUB_ACTOR","MegaMan.EXE")
@@ -75,10 +79,19 @@ def prepare_env():
env["BUILD_NUMBER"] = os.getenv("TRAVIS_BUILD_NUMBER",env["GITHUB_RUN_NUMBER"])
GITHUB_TAG = os.getenv("TRAVIS_TAG",os.getenv("GITHUB_TAG",""))
OS_NAME = os.getenv("TRAVIS_OS_NAME",os.getenv("OS_NAME","")).replace("macOS","osx")
OS_NAME = os.getenv("TRAVIS_OS_NAME",os.getenv("OS_NAME",sys.platform)).replace("macOS","osx")
OS_DIST = os.getenv("TRAVIS_DIST","notset")
OS_VERSION = ""
if "win32" in OS_NAME or \
"cygwin" in OS_NAME or \
"msys" in OS_NAME:
OS_NAME = "windows"
elif "darwin" in OS_NAME:
OS_NAME = "osx"
elif "linux2" in OS_NAME:
OS_NAME = "linux"
if '-' in OS_NAME:
OS_VERSION = OS_NAME[OS_NAME.find('-')+1:]
OS_NAME = OS_NAME[:OS_NAME.find('-')]

View File

@@ -1,39 +1,63 @@
import common
import argparse
import os
import urllib.request, ssl
import subprocess # do stuff at the shell level
env = common.prepare_env()
def get_get_pip():
print("Getting pip getter!")
#make the request!
url = "https://bootstrap.pypa.io/get-pip.py"
context = ssl._create_unverified_context()
req = urllib.request.urlopen(url, context=context)
got_pip = req.read().decode("utf-8")
def get_get_pip(PY_VERSION):
try:
import pip
except ImportError:
print("Getting pip getter!")
#make the request!
url = "https://bootstrap.pypa.io/get-pip.py"
context = ssl._create_unverified_context()
req = urllib.request.urlopen(url, context=context)
got_pip = req.read().decode("utf-8")
with open("get-pip.py", "w") as g:
req = urllib.request.Request(
url,
data=None,
headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
}
)
req = urllib.request.urlopen(req, context=context)
data = req.read().decode("utf-8")
g.write(data)
with open("get-pip.py", "w") as g:
req = urllib.request.Request(
url,
data=None,
headers={
"User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36"
}
)
req = urllib.request.urlopen(req, context=context)
data = req.read().decode("utf-8")
g.write(data)
# get executables
# python
# linux/windows: python
# macosx: python3
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
print("Getting pip!")
subprocess.check_call([PYTHON_EXECUTABLE,"get-pip.py"])
# get executables
# python
# linux/windows: python
# macosx: python3
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
if PY_VERSION == None:
PY_VERSION = 0
if float(PY_VERSION) > 0:
PYTHON_EXECUTABLE = "py"
print("Getting pip!")
args = [
env["PYTHON_EXE_PATH"] + PYTHON_EXECUTABLE,
'-' + str(PY_VERSION),
"get-pip.py"
]
if PY_VERSION == 0:
del args[1]
subprocess.check_call(args)
if __name__ == "__main__":
try:
import pip
except ImportError:
get_get_pip()
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--py', default=0)
command_line_args = parser.parse_args()
PY_VERSION = vars(command_line_args)["py"]
try:
import pip
print("pip is installed")
except ImportError:
get_get_pip(PY_VERSION)

View File

@@ -1,9 +1,14 @@
import common
import argparse
import os
import platform
import subprocess # do stuff at the shell level
env = common.prepare_env()
def run_install():
pip_requirements = os.path.join(".","resources","app","meta","manifests","pip_requirements.txt")
def run_install(PY_VERSION,USER):
# get executables
# python
# linux/windows: python
@@ -11,20 +16,79 @@ def run_install():
# pip
# linux/macosx: pip3
# windows: pip
PYTHON_PATH = env["PYTHON_EXE_PATH"]
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
PIP_PATH = env["PIP_EXE_PATH"]
PIP_EXECUTABLE = "pip" if "windows" in env["OS_NAME"] else "pip3"
PIP_EXECUTABLE = "pip" if "osx" in env["OS_NAME"] and "actions" in env["CI_SYSTEM"] else PIP_EXECUTABLE
# upgrade pip
subprocess.check_call([PYTHON_EXECUTABLE,"-m","pip","install","--upgrade","pip"])
if PY_VERSION == None:
PY_VERSION = 0
if USER == None:
USER = False
if float(PY_VERSION) > 0:
PYTHON_EXECUTABLE = "py"
PYTHON_PATH = env["PY_EXE_PATH"]
print("Installing to Python %.1f via Py Launcher" % float(PY_VERSION))
else:
print("Installing to Python %s" % platform.python_version())
print("Installing packages at %s level" % ("User" if USER else "Global"))
print()
print("Upgrading pip-")
# upgrade pip
args = [
PYTHON_PATH + PYTHON_EXECUTABLE,
'-' + str(PY_VERSION),
"-m",
"pip",
"install",
"--upgrade",
"--user",
"pip"
]
if not USER:
args.remove("--user")
if PY_VERSION == 0:
del args[1]
subprocess.check_call(args)
# pip version
subprocess.check_call([PIP_EXECUTABLE,"--version"])
# if pip3, install wheel
if PIP_EXECUTABLE == "pip3":
subprocess.check_call([PIP_EXECUTABLE,"install","-U","wheel"])
print("Installing Wheel!")
args = [
PIP_PATH + PIP_EXECUTABLE,
"install",
"--user",
"-U",
"wheel"
]
if not USER:
args.remove("--user")
subprocess.check_call(args)
print()
# install listed dependencies
subprocess.check_call([PIP_EXECUTABLE,"install","-r","./resources/app/meta/manifests/pip_requirements.txt"])
print("Installing dependencies")
print("-----------------------")
args = [
PIP_PATH + PIP_EXECUTABLE,
"install",
"--user",
"-r",
pip_requirements
]
if not USER:
args.remove("--user")
subprocess.check_call(args)
if __name__ == "__main__":
run_install()
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--py', default=0)
parser.add_argument('--user', default=False, action="store_true")
command_line_args = parser.parse_args()
PY_VERSION = vars(command_line_args)["py"]
USER = vars(command_line_args)["user"]
run_install(PY_VERSION,USER)

View File

@@ -1,8 +1,17 @@
import install
import get_get_pip
import argparse
parser = argparse.ArgumentParser(add_help=False)
parser.add_argument('--py', default=0)
parser.add_argument('--user', default=False, action="store_true")
command_line_args = parser.parse_args()
PY_VERSION = vars(command_line_args)["py"]
USER = vars(command_line_args)["user"]
# get & install pip
get_get_pip.get_get_pip()
get_get_pip.get_get_pip(PY_VERSION)
# run installer
install.run_install()
install.run_install(PY_VERSION,USER)

View File

@@ -0,0 +1,33 @@
import os
import sys
def get_py_path():
user_paths = os.environ["PATH"].split(os.pathsep)
(python,py) = ("","")
for path in user_paths:
parts = path.split(os.sep)
part = parts[len(parts) - 1].lower()
if ("python" in part) and ('.' not in part):
path.replace(os.sep,os.sep + os.sep)
if path not in user_paths:
py = path
for path in sys.path:
parts = path.split(os.sep)
part = parts[len(parts) - 1].lower()
if ("python" in part) and ('.' not in part):
path.replace(os.sep,os.sep + os.sep)
if path not in user_paths:
python = path
paths = (
os.path.join(python,"") if python != "" else "",
os.path.join(py,"") if py != "" else "",
os.path.join(python,"Scripts","") if python != "" else ""
)
# print(paths)
return paths
if __name__ == "__main__":
get_py_path()