File tree Expand file tree Collapse file tree 2 files changed +30
-9
lines changed Expand file tree Collapse file tree 2 files changed +30
-9
lines changed Original file line number Diff line number Diff line change 77
88from jupyter_server .base .handlers import APIHandler
99from jupyter_server .utils import url_path_join
10- from jupyterlab ._version import __version__ as jlab_version
1110import tornado
1211
13- from ._version import __version__ as extension_version
14-
15- HOME_FOLDER = os .path .realpath (
16- os .environ .get ("WAKATIME_HOME" ) or os .path .expanduser ("~" )
17- )
18- RESOURCES_FOLDER = os .path .join (HOME_FOLDER , ".wakatime" )
19- WAKATIME_CLI = os .path .join (RESOURCES_FOLDER , "wakatime-cli" )
20- USER_AGENT = f"jupyterlab/{ jlab_version } jupyterlab-wakatime/{ extension_version } "
12+ from .wakatime import USER_AGENT , WAKATIME_CLI
2113
2214
2315class RequestData (TypedDict ):
Original file line number Diff line number Diff line change 1+ import os
2+ import platform
3+
4+ from jupyterlab ._version import __version__ as jlab_version
5+
6+ from ._version import __version__ as extension_version
7+
8+
9+ def get_os_name ():
10+ name = platform .system ().lower ()
11+ if (
12+ name .startswith ("cygwin" )
13+ or name .startswith ("mingw" )
14+ or name .startswith ("msys" )
15+ ):
16+ return "windows"
17+ if name == "linux" and "ANDROID_DATA" in os .environ :
18+ return "android"
19+ return name
20+
21+
22+ USER_AGENT = f"jupyterlab/{ jlab_version } jupyterlab-wakatime/{ extension_version } "
23+ HOME_FOLDER = os .path .realpath (
24+ os .environ .get ("WAKATIME_HOME" ) or os .path .expanduser ("~" )
25+ )
26+ RESOURCES_FOLDER = os .path .join (HOME_FOLDER , ".wakatime" )
27+ WAKATIME_CLI = os .path .join (RESOURCES_FOLDER , "wakatime-cli" )
28+ if get_os_name () == "windows" :
29+ WAKATIME_CLI += ".exe"
You can’t perform that action at this time.
0 commit comments