2
0
mirror of https://github.com/frappe/bench.git synced 2024-11-12 00:06:36 +00:00

Merge pull request #1048 from adamtang79/develop-adamtang

fix: ubuntu 20.04 easy install hang half way
This commit is contained in:
gavin 2020-08-14 20:12:52 +05:30 committed by GitHub
commit 78eb208abc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 3 deletions

View File

@ -1,4 +1,4 @@
---
- name: Restart network manager
- name: restart network manager
service: name=NetworkManager state=restarted
...

View File

@ -78,7 +78,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, 10],
'centos': [7]
}
@ -93,11 +93,36 @@ def check_distribution_compatibility():
else:
log("Sorry, the installer doesn't support {0}. Aborting installation!".format(dist_name), level=2)
def import_with_install(package):
# copied from https://discuss.erpnext.com/u/nikunj_patel
# https://discuss.erpnext.com/t/easy-install-setup-guide-for-erpnext-installation-on-ubuntu-20-04-lts-with-some-modification-of-course/62375/5
# need to move to top said v13 for fully python3 era
import importlib
try:
importlib.import_module(package)
except ImportError:
# caveat : pip3 must be installed
import pip
pip.main(['install', package])
finally:
globals()[package] = importlib.import_module(package)
def get_distribution_info():
# return distribution name and major version
if platform.system() == "Linux":
current_dist = platform.dist()
if sys.version_info.major == 3 and sys.version_info.minor > 7:
install_package('pip3', 'python3-pip')
import_with_install('distro')
current_dist = distro.linux_distribution(full_distribution_name=True)
else:
current_dist = platform.dist()
return current_dist[0].lower(), current_dist[1].rsplit('.')[0]
elif platform.system() == "Darwin":
@ -403,6 +428,7 @@ def parse_commandline_args():
parser.add_argument('--python', dest='python', default='python3', help=argparse.SUPPRESS)
# LXC Support
parser.add_argument('--container', dest='container', default=False, action='store_true', help='Use if you\'re creating inside LXC')
args = parser.parse_args()
return args
@ -440,3 +466,4 @@ if __name__ == '__main__':
install_bench(args)
log("Bench + Frappe + ERPNext has been successfully installed!")