Make local install a little smarter
This commit is contained in:
@@ -13,3 +13,7 @@
|
|||||||
|Platform|Command line|Image|
|
|Platform|Command line|Image|
|
||||||
| :----: |------------|-----|
|
| :----: |------------|-----|
|
||||||
|Windows |`resources/ci/common/local_install.py`|
|
|Windows |`resources/ci/common/local_install.py`|
|
||||||
|
|`py` Launcher: 3.9 |`resources/ci/common/local_install.py --py 3.9`|
|
||||||
|
|`py` Launcher: 3.8 |`resources/ci/common/local_install.py --py 3.8`|
|
||||||
|
|`py` Launcher: 3.7 |`resources/ci/common/local_install.py --py 3.7`|
|
||||||
|
|`py` Launcher: 3.6 |`resources/ci/common/local_install.py --py 3.6`|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import os # for env vars
|
import os # for env vars
|
||||||
import stat # file statistics
|
import stat # file statistics
|
||||||
|
import sys # default system info
|
||||||
|
|
||||||
global UBUNTU_VERSIONS
|
global UBUNTU_VERSIONS
|
||||||
global DEFAULT_EVENT
|
global DEFAULT_EVENT
|
||||||
@@ -75,10 +76,19 @@ def prepare_env():
|
|||||||
env["BUILD_NUMBER"] = os.getenv("TRAVIS_BUILD_NUMBER",env["GITHUB_RUN_NUMBER"])
|
env["BUILD_NUMBER"] = os.getenv("TRAVIS_BUILD_NUMBER",env["GITHUB_RUN_NUMBER"])
|
||||||
|
|
||||||
GITHUB_TAG = os.getenv("TRAVIS_TAG",os.getenv("GITHUB_TAG",""))
|
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_DIST = os.getenv("TRAVIS_DIST","notset")
|
||||||
OS_VERSION = ""
|
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:
|
if '-' in OS_NAME:
|
||||||
OS_VERSION = OS_NAME[OS_NAME.find('-')+1:]
|
OS_VERSION = OS_NAME[OS_NAME.find('-')+1:]
|
||||||
OS_NAME = OS_NAME[:OS_NAME.find('-')]
|
OS_NAME = OS_NAME[:OS_NAME.find('-')]
|
||||||
|
|||||||
@@ -1,10 +1,14 @@
|
|||||||
import common
|
import common
|
||||||
|
import argparse
|
||||||
import urllib.request, ssl
|
import urllib.request, ssl
|
||||||
import subprocess # do stuff at the shell level
|
import subprocess # do stuff at the shell level
|
||||||
|
|
||||||
env = common.prepare_env()
|
env = common.prepare_env()
|
||||||
|
|
||||||
def get_get_pip():
|
def get_get_pip(PY_VERSION):
|
||||||
|
try:
|
||||||
|
import pip
|
||||||
|
except ImportError:
|
||||||
print("Getting pip getter!")
|
print("Getting pip getter!")
|
||||||
#make the request!
|
#make the request!
|
||||||
url = "https://bootstrap.pypa.io/get-pip.py"
|
url = "https://bootstrap.pypa.io/get-pip.py"
|
||||||
@@ -29,11 +33,26 @@ def get_get_pip():
|
|||||||
# linux/windows: python
|
# linux/windows: python
|
||||||
# macosx: python3
|
# macosx: python3
|
||||||
PYTHON_EXECUTABLE = "python3" if "osx" in env["OS_NAME"] else "python"
|
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!")
|
print("Getting pip!")
|
||||||
subprocess.check_call([PYTHON_EXECUTABLE,"get-pip.py"])
|
args = [
|
||||||
|
PYTHON_EXECUTABLE,
|
||||||
|
'-' + str(PY_VERSION),
|
||||||
|
"get-pip.py"
|
||||||
|
]
|
||||||
|
if PY_VERSION == 0:
|
||||||
|
del args[1]
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
try:
|
parser = argparse.ArgumentParser(add_help=False)
|
||||||
import pip
|
parser.add_argument('--py', default=0)
|
||||||
except ImportError:
|
command_line_args = parser.parse_args()
|
||||||
get_get_pip()
|
PY_VERSION = vars(command_line_args)["py"]
|
||||||
|
|
||||||
|
get_get_pip(PY_VERSION)
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import common
|
import common
|
||||||
|
import argparse
|
||||||
import subprocess # do stuff at the shell level
|
import subprocess # do stuff at the shell level
|
||||||
|
|
||||||
env = common.prepare_env()
|
env = common.prepare_env()
|
||||||
|
|
||||||
def run_install():
|
def run_install(PY_VERSION,USER):
|
||||||
# get executables
|
# get executables
|
||||||
# python
|
# python
|
||||||
# linux/windows: python
|
# linux/windows: python
|
||||||
@@ -15,16 +16,66 @@ def run_install():
|
|||||||
PIP_EXECUTABLE = "pip" if "windows" in env["OS_NAME"] else "pip3"
|
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
|
PIP_EXECUTABLE = "pip" if "osx" in env["OS_NAME"] and "actions" in env["CI_SYSTEM"] else PIP_EXECUTABLE
|
||||||
|
|
||||||
|
if PY_VERSION == None:
|
||||||
|
PY_VERSION = 0
|
||||||
|
if USER == None:
|
||||||
|
USER = False
|
||||||
|
|
||||||
|
if float(PY_VERSION) > 0:
|
||||||
|
PYTHON_EXECUTABLE = "py"
|
||||||
|
print("Installing to Python %.1f" % float(PY_VERSION))
|
||||||
|
if USER:
|
||||||
|
print("Installing packages at User level")
|
||||||
|
|
||||||
# upgrade pip
|
# upgrade pip
|
||||||
subprocess.check_call([PYTHON_EXECUTABLE,"-m","pip","install","--upgrade","pip"])
|
args = [
|
||||||
|
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
|
# pip version
|
||||||
subprocess.check_call([PIP_EXECUTABLE,"--version"])
|
subprocess.check_call([PIP_EXECUTABLE,"--version"])
|
||||||
# if pip3, install wheel
|
# if pip3, install wheel
|
||||||
if PIP_EXECUTABLE == "pip3":
|
if PIP_EXECUTABLE == "pip3":
|
||||||
subprocess.check_call([PIP_EXECUTABLE,"install","-U","wheel"])
|
args = [
|
||||||
|
PIP_EXECUTABLE,
|
||||||
|
"install",
|
||||||
|
"--user",
|
||||||
|
"-U",
|
||||||
|
"wheel"
|
||||||
|
]
|
||||||
|
if not USER:
|
||||||
|
args.remove("--user")
|
||||||
|
subprocess.check_call(args)
|
||||||
# install listed dependencies
|
# install listed dependencies
|
||||||
subprocess.check_call([PIP_EXECUTABLE,"install","-r","./resources/app/meta/manifests/pip_requirements.txt"])
|
args = [
|
||||||
|
PIP_EXECUTABLE,
|
||||||
|
"install",
|
||||||
|
"--user",
|
||||||
|
"-r",
|
||||||
|
"./resources/app/meta/manifests/pip_requirements.txt"
|
||||||
|
]
|
||||||
|
if not USER:
|
||||||
|
args.remove("--user")
|
||||||
|
subprocess.check_call(args)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
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)
|
||||||
|
|||||||
@@ -1,8 +1,17 @@
|
|||||||
import install
|
import install
|
||||||
import get_get_pip
|
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 & install pip
|
||||||
get_get_pip.get_get_pip()
|
get_get_pip.get_get_pip(PY_VERSION)
|
||||||
|
|
||||||
# run installer
|
# run installer
|
||||||
install.run_install()
|
install.run_install(PY_VERSION,USER)
|
||||||
|
|||||||
Reference in New Issue
Block a user