Make a simpler installer script
This commit is contained in:
39
resources/ci/common/get_get_pip.py
Normal file
39
resources/ci/common/get_get_pip.py
Normal file
@@ -0,0 +1,39 @@
|
||||
import common
|
||||
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")
|
||||
|
||||
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"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
import pip
|
||||
except ImportError:
|
||||
get_get_pip()
|
||||
@@ -1,27 +1,30 @@
|
||||
import common
|
||||
import os # for env vars
|
||||
import subprocess # do stuff at the shell level
|
||||
|
||||
env = common.prepare_env()
|
||||
|
||||
# get executables
|
||||
# python
|
||||
# linux/windows: python
|
||||
# macosx: python3
|
||||
# pip
|
||||
# linux/macosx: pip3
|
||||
# windows: pip
|
||||
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
|
||||
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
|
||||
def run_install():
|
||||
# get executables
|
||||
# python
|
||||
# linux/windows: python
|
||||
# macosx: python3
|
||||
# pip
|
||||
# linux/macosx: pip3
|
||||
# windows: pip
|
||||
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
|
||||
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"])
|
||||
# upgrade pip
|
||||
subprocess.check_call([PYTHON_EXECUTABLE,"-m","pip","install","--upgrade","pip"])
|
||||
|
||||
# pip version
|
||||
subprocess.check_call([PIP_EXECUTABLE,"--version"])
|
||||
# if pip3, install wheel
|
||||
if PIP_EXECUTABLE == "pip3":
|
||||
subprocess.check_call([PIP_EXECUTABLE,"install","-U","wheel"])
|
||||
# install listed dependencies
|
||||
subprocess.check_call([PIP_EXECUTABLE,"install","-r","./resources/app/meta/manifests/pip_requirements.txt"])
|
||||
# pip version
|
||||
subprocess.check_call([PIP_EXECUTABLE,"--version"])
|
||||
# if pip3, install wheel
|
||||
if PIP_EXECUTABLE == "pip3":
|
||||
subprocess.check_call([PIP_EXECUTABLE,"install","-U","wheel"])
|
||||
# install listed dependencies
|
||||
subprocess.check_call([PIP_EXECUTABLE,"install","-r","./resources/app/meta/manifests/pip_requirements.txt"])
|
||||
|
||||
if __name__ == "__main__":
|
||||
run_install()
|
||||
|
||||
8
resources/ci/common/local_install.py
Normal file
8
resources/ci/common/local_install.py
Normal file
@@ -0,0 +1,8 @@
|
||||
import install
|
||||
import get_get_pip
|
||||
|
||||
# get & install pip
|
||||
get_get_pip.get_get_pip()
|
||||
|
||||
# run installer
|
||||
install.run_install()
|
||||
Reference in New Issue
Block a user