Skip to content
This repository has been archived by the owner on May 30, 2021. It is now read-only.

Commit

Permalink
Merge pull request #19 from sotetsuk/cross-platform-support
Browse files Browse the repository at this point in the history
Cross platform support
  • Loading branch information
sotetsuk authored Jul 6, 2018
2 parents 90b7265 + 9fd31f6 commit a768337
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
8 changes: 5 additions & 3 deletions paicli/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
except NameError:
FileNotFoundError = IOError

HOME = os.path.expanduser("~")


class Config(object):

Expand All @@ -26,8 +28,8 @@ class Config(object):
_accesstoken = ".token_{}"

# paths
path_to_configdir = os.path.join(os.environ['HOME'], _paicli_dirname)
path_to_configfile = os.path.join(os.environ['HOME'], _paicli_dirname, _configfile)
path_to_configdir = os.path.join(HOME, _paicli_dirname)
path_to_configfile = os.path.join(HOME, _paicli_dirname, _configfile)

def __init__(self, profile="default"):
self.profile = to_str(profile)
Expand All @@ -37,7 +39,7 @@ def __init__(self, profile="default"):
self.access_token = to_str("")
self.api_version = to_str("v1")

self.path_to_accesstoken = os.path.join(os.environ['HOME'],
self.path_to_accesstoken = os.path.join(HOME,
self._paicli_dirname, self._accesstoken.format(self.profile))

def add_profile(self):
Expand Down
6 changes: 6 additions & 0 deletions paicli/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,18 @@
Author: Sotetsu KOYAMADA
"""
from __future__ import division
import sys
from datetime import datetime
import json
from prettytable import PrettyTable
from termcolor import colored
from .utils import to_str

if sys.platform.lower()[:3] == "win":
import colorama
colorama.init()


class Jobs(object):

def __init__(self, api, username=""):
Expand Down
4 changes: 4 additions & 0 deletions paicli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
except NameError:
FileNotFoundError = IOError

if sys.platform.lower()[:3] == "win":
import colorama
colorama.init()


def _load(config):
try:
Expand Down
3 changes: 2 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='paicli',
version="0.3.2",
version="0.3.4",
description='Client for PAI',
author='Sotetsu KOYAMADA',
url='',
Expand All @@ -13,6 +13,7 @@
"prompt_toolkit==1.0.9",
"prettytable",
"termcolor",
"colorama",
"click",
],
packages=find_packages(),
Expand Down

0 comments on commit a768337

Please sign in to comment.