Fix PIO installation using get-platformio script

This commit is contained in:
Ivan Kravets
2016-10-10 23:06:09 +03:00
parent c2ee36a4d7
commit b09526a248
2 changed files with 12 additions and 15 deletions

View File

@ -22,9 +22,9 @@ from os.path import dirname, getmtime, isdir, isfile, join
from time import time from time import time
import requests import requests
from lockfile import LockFile from lockfile import LockFailed, LockFile
from platformio import __version__, util from platformio import __version__, exception, util
from platformio.exception import InvalidSettingName, InvalidSettingValue from platformio.exception import InvalidSettingName, InvalidSettingValue
DEFAULT_SETTINGS = { DEFAULT_SETTINGS = {
@ -106,7 +106,16 @@ class State(object):
(time() - getmtime(self._lockfile.lock_file)) > 10: (time() - getmtime(self._lockfile.lock_file)) > 10:
self._lockfile.break_lock() self._lockfile.break_lock()
self._lockfile.acquire() try:
self._lockfile.acquire()
except LockFailed:
raise exception.PlatformioException(
"The directory `{0}` or its parent directory is not owned by "
"the current user and PlatformIO can not store configuration "
"data. \nPlease check the permissions and owner of that "
"directory. Otherwise, please remove manually `{0}` "
"directory and PlatformIO will create new from the current "
"user.".format(dirname(self.path)))
def _unlock_state_file(self): def _unlock_state_file(self):
if self._lockfile: if self._lockfile:

View File

@ -176,18 +176,6 @@ https://raw.githubusercontent.com/platformio/platformio/master/scripts/get-platf
else: else:
print("\n ==> Installation process has been " print("\n ==> Installation process has been "
"successfully FINISHED! <==\n") "successfully FINISHED! <==\n")
try:
print_exec_result(exec_command("platformio"))
except:
try:
print_exec_result(exec_python_cmd([
"-m",
"platformio.__main__" if sys.version_info < (2, 7, 0) else
"platformio"]))
except:
pass
finally:
print (""" print ("""
---------------------------------------- ----------------------------------------