mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix: use sys version info instead of user entry
This commit is contained in:
parent
9bdff524cd
commit
ff48ceda91
21
install.py
21
install.py
@ -74,8 +74,8 @@ def check_system_package_managers():
|
|||||||
raise Exception('Cannot find any compatible package manager!')
|
raise Exception('Cannot find any compatible package manager!')
|
||||||
|
|
||||||
|
|
||||||
def check_distribution_compatibility(args):
|
def check_distribution_compatibility():
|
||||||
dist_name, dist_version = get_distribution_info(args)
|
dist_name, dist_version = get_distribution_info()
|
||||||
supported_dists = {
|
supported_dists = {
|
||||||
'macos': [10.9, 10.10, 10.11, 10.12],
|
'macos': [10.9, 10.10, 10.11, 10.12],
|
||||||
'ubuntu': [14, 15, 16, 18, 19, 20],
|
'ubuntu': [14, 15, 16, 18, 19, 20],
|
||||||
@ -112,10 +112,10 @@ def import_with_install(package):
|
|||||||
globals()[package] = importlib.import_module(package)
|
globals()[package] = importlib.import_module(package)
|
||||||
|
|
||||||
|
|
||||||
def get_distribution_info(args):
|
def get_distribution_info():
|
||||||
# return distribution name and major version
|
# return distribution name and major version
|
||||||
if platform.system() == "Linux":
|
if platform.system() == "Linux":
|
||||||
if args.python_version == "3":
|
if sys.version_info.major == 3 and sys.version_info.minor > 7:
|
||||||
install_package('pip3', 'python3-pip')
|
install_package('pip3', 'python3-pip')
|
||||||
|
|
||||||
import_with_install('distro')
|
import_with_install('distro')
|
||||||
@ -216,7 +216,7 @@ def install_bench(args):
|
|||||||
raise Exception('Please run this script as a non-root user with sudo privileges, but without using sudo or pass --user=USER')
|
raise Exception('Please run this script as a non-root user with sudo privileges, but without using sudo or pass --user=USER')
|
||||||
|
|
||||||
# Python executable
|
# Python executable
|
||||||
dist_name, dist_version = get_distribution_info(args)
|
dist_name, dist_version = get_distribution_info()
|
||||||
if dist_name=='centos':
|
if dist_name=='centos':
|
||||||
args.python = 'python3.6'
|
args.python = 'python3.6'
|
||||||
else:
|
else:
|
||||||
@ -429,15 +429,6 @@ def parse_commandline_args():
|
|||||||
# LXC Support
|
# LXC Support
|
||||||
parser.add_argument('--container', dest='container', default=False, action='store_true', help='Use if you\'re creating inside LXC')
|
parser.add_argument('--container', dest='container', default=False, action='store_true', help='Use if you\'re creating inside LXC')
|
||||||
|
|
||||||
# for detecting dist; backward compatible if specify 2
|
|
||||||
|
|
||||||
parser.add_argument(
|
|
||||||
'--python-version',
|
|
||||||
dest='python_version',
|
|
||||||
default='3',
|
|
||||||
help='For detecting dist. Backward compatible if specify 2. Default is 3.'
|
|
||||||
)
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
return args
|
return args
|
||||||
@ -468,7 +459,7 @@ if __name__ == '__main__':
|
|||||||
with warnings.catch_warnings():
|
with warnings.catch_warnings():
|
||||||
warnings.simplefilter("ignore")
|
warnings.simplefilter("ignore")
|
||||||
setup_log_stream(args)
|
setup_log_stream(args)
|
||||||
check_distribution_compatibility(args)
|
check_distribution_compatibility()
|
||||||
check_system_package_managers()
|
check_system_package_managers()
|
||||||
check_environment()
|
check_environment()
|
||||||
install_prerequisites()
|
install_prerequisites()
|
||||||
|
Loading…
Reference in New Issue
Block a user