mirror of
https://github.com/frappe/bench.git
synced 2024-11-12 00:06:36 +00:00
fix(easy-install): compatibility for easy install on PY2 (#937)
* fix: compatibility for easy install on PY2 * test: remove python-distutils from travis * chore: handle specific CalledProcessError for setuptools Co-authored-by: Chinmay Pai <chinmaydpai@gmail.com>
This commit is contained in:
parent
d701fe86a7
commit
495a038c45
@ -8,7 +8,7 @@ install:
|
||||
- sudo pip install urllib3 pyOpenSSL ndg-httpsclient pyasn1
|
||||
- sudo apt-get purge -y mysql-common mysql-server mysql-client
|
||||
- sudo apt-get install --only-upgrade -y git
|
||||
- sudo apt-get install hhvm python-distutils && rm -rf /home/travis/.kiex/
|
||||
- sudo apt-get install hhvm && rm -rf /home/travis/.kiex/
|
||||
- mkdir -p ~/.bench
|
||||
- mkdir -p /tmp/.bench
|
||||
- cp -r $TRAVIS_BUILD_DIR/* ~/.bench
|
||||
|
@ -406,17 +406,21 @@ def parse_commandline_args():
|
||||
|
||||
if __name__ == '__main__':
|
||||
if sys.version[0] == '2':
|
||||
try:
|
||||
from disutils.spawn import find_executable
|
||||
except ImportError:
|
||||
print("Please install distutils or use Python3 to run the script")
|
||||
print("$ pip install distutils")
|
||||
sys.exit(1)
|
||||
shutil.which = find_executable
|
||||
if not os.environ.get('CI'):
|
||||
if not raw_input("It is recommended to run this script with Python 3\nDo you still wish to continue? [Y/n]: ").lower() == "y":
|
||||
sys.exit()
|
||||
|
||||
try:
|
||||
from distutils.spawn import find_executable
|
||||
except ImportError:
|
||||
try:
|
||||
subprocess.check_call('pip install --upgrade setuptools')
|
||||
except subprocess.CalledProcessError:
|
||||
print("Install distutils or use Python3 to run the script")
|
||||
sys.exit(1)
|
||||
|
||||
shutil.which = find_executable
|
||||
|
||||
if not is_sudo_user():
|
||||
log("Please run this script as a non-root user with sudo privileges", level=3)
|
||||
sys.exit()
|
||||
|
Loading…
Reference in New Issue
Block a user