sublime-wakatime/packages/wakatime/cli.py
Alan Hamlett 01c0e7758e Partially revert "Use wakatime-cli standalone" to support both
standalone and Python source wakatime-cli versions.

This partially reverts commit d588451468.
2020-12-28 18:42:00 -08:00

36 lines
888 B
Python

# -*- coding: utf-8 -*-
"""
wakatime.cli
~~~~~~~~~~~~
Command-line entry point.
:copyright: (c) 2013 Alan Hamlett.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
# get path to local wakatime package
package_folder = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# add local wakatime package to sys.path
sys.path.insert(0, package_folder)
# import local wakatime package
try:
import wakatime
except (TypeError, ImportError):
# on Windows, non-ASCII characters in import path can be fixed using
# the script path from sys.argv[0].
# More info at https://github.com/wakatime/wakatime/issues/32
package_folder = os.path.dirname(os.path.dirname(os.path.abspath(sys.argv[0])))
sys.path.insert(0, package_folder)
import wakatime
if __name__ == '__main__':
sys.exit(wakatime.execute(sys.argv[1:]))