forked from platformio/platformio-core
Initial support for Eclipse Che
This commit is contained in:
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
VERSION = (3, 2, "0a5")
|
VERSION = (3, 2, "0a6")
|
||||||
__version__ = ".".join([str(s) for s in VERSION])
|
__version__ = ".".join([str(s) for s in VERSION])
|
||||||
|
|
||||||
__title__ = "platformio"
|
__title__ = "platformio"
|
||||||
|
@ -21,6 +21,7 @@ from os import environ, getenv, listdir, remove
|
|||||||
from os.path import dirname, getmtime, isdir, isfile, join
|
from os.path import dirname, getmtime, isdir, isfile, join
|
||||||
from time import time
|
from time import time
|
||||||
|
|
||||||
|
import requests
|
||||||
from lockfile import LockFile
|
from lockfile import LockFile
|
||||||
|
|
||||||
from platformio import __version__, util
|
from platformio import __version__, util
|
||||||
@ -261,9 +262,18 @@ def is_disabled_progressbar():
|
|||||||
def get_cid():
|
def get_cid():
|
||||||
cid = get_state_item("cid")
|
cid = get_state_item("cid")
|
||||||
if not cid:
|
if not cid:
|
||||||
|
_uid = None
|
||||||
|
if getenv("C9_UID"):
|
||||||
|
_uid = getenv("C9_UID")
|
||||||
|
elif getenv("CHE_API_ENDPOINT"):
|
||||||
|
try:
|
||||||
|
_uid = requests.get("{api}/user?token={token}".format(
|
||||||
|
api=getenv("CHE_API_ENDPOINT"), token=getenv(
|
||||||
|
"USER_TOKEN"))).json().get("id")
|
||||||
|
except: # pylint: disable=bare-except
|
||||||
|
pass
|
||||||
cid = str(
|
cid = str(
|
||||||
uuid.UUID(bytes=hashlib.md5(
|
uuid.UUID(bytes=hashlib.md5(str(_uid if _uid else uuid.getnode()))
|
||||||
str(getenv("C9_UID")
|
.digest()))
|
||||||
if getenv("C9_UID") else uuid.getnode())).digest()))
|
|
||||||
set_state_item("cid", cid)
|
set_state_item("cid", cid)
|
||||||
return cid
|
return cid
|
||||||
|
@ -56,6 +56,8 @@ def on_platformio_start(ctx, force, caller):
|
|||||||
caller = "C9"
|
caller = "C9"
|
||||||
elif getenv("USER") == "cabox":
|
elif getenv("USER") == "cabox":
|
||||||
caller = "CA"
|
caller = "CA"
|
||||||
|
elif getenv("CHE_API_ENDPOINT"):
|
||||||
|
caller = "Che"
|
||||||
|
|
||||||
app.set_session_var("command_ctx", ctx)
|
app.set_session_var("command_ctx", ctx)
|
||||||
app.set_session_var("force_option", force)
|
app.set_session_var("force_option", force)
|
||||||
|
Reference in New Issue
Block a user