mirror of
https://github.com/clearml/clearml
synced 2025-01-31 09:07:00 +00:00
Python 2.7 support
This commit is contained in:
parent
783b0b99c9
commit
600bbbf535
@ -1,6 +1,6 @@
|
|||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
|
|
||||||
import six
|
from six.moves import input
|
||||||
from pyhocon import ConfigFactory
|
from pyhocon import ConfigFactory
|
||||||
from pathlib2 import Path
|
from pathlib2 import Path
|
||||||
from six.moves.urllib.parse import urlparse
|
from six.moves.urllib.parse import urlparse
|
||||||
@ -30,9 +30,6 @@ Enter the url of the trains-server's api service, example: http://localhost:8008
|
|||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
if six.PY2:
|
|
||||||
input = raw_input
|
|
||||||
|
|
||||||
print('TRAINS SDK setup process')
|
print('TRAINS SDK setup process')
|
||||||
conf_file = Path(LOCAL_CONFIG_FILES[0]).absolute()
|
conf_file = Path(LOCAL_CONFIG_FILES[0]).absolute()
|
||||||
if conf_file.exists() and conf_file.is_file() and conf_file.stat().st_size > 0:
|
if conf_file.exists() and conf_file.is_file() and conf_file.stat().st_size > 0:
|
||||||
@ -46,6 +43,7 @@ def main():
|
|||||||
parse_input = input()
|
parse_input = input()
|
||||||
if not parse_input:
|
if not parse_input:
|
||||||
parse_input = def_host
|
parse_input = def_host
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
if not parse_input.startswith('http://') and not parse_input.startswith('https://'):
|
if not parse_input.startswith('http://') and not parse_input.startswith('https://'):
|
||||||
parse_input = 'http://'+parse_input
|
parse_input = 'http://'+parse_input
|
||||||
@ -102,6 +100,7 @@ def main():
|
|||||||
parse_input = input()
|
parse_input = input()
|
||||||
# check if these are valid credentials
|
# check if these are valid credentials
|
||||||
credentials = None
|
credentials = None
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
parsed = ConfigFactory.parse_string(parse_input)
|
parsed = ConfigFactory.parse_string(parse_input)
|
||||||
if parsed:
|
if parsed:
|
||||||
@ -120,7 +119,7 @@ def main():
|
|||||||
|
|
||||||
print('Detected credentials key=\"{}\" secret=\"{}\"'.format(credentials['access_key'],
|
print('Detected credentials key=\"{}\" secret=\"{}\"'.format(credentials['access_key'],
|
||||||
credentials['secret_key'], ))
|
credentials['secret_key'], ))
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
default_sdk_conf = Path(__file__).parent.absolute() / 'sdk.conf'
|
default_sdk_conf = Path(__file__).parent.absolute() / 'sdk.conf'
|
||||||
with open(str(default_sdk_conf), 'rt') as f:
|
with open(str(default_sdk_conf), 'rt') as f:
|
||||||
@ -128,7 +127,7 @@ def main():
|
|||||||
except Exception:
|
except Exception:
|
||||||
print('Error! Could not read default configuration file')
|
print('Error! Could not read default configuration file')
|
||||||
return
|
return
|
||||||
|
# noinspection PyBroadException
|
||||||
try:
|
try:
|
||||||
with open(str(conf_file), 'wt') as f:
|
with open(str(conf_file), 'wt') as f:
|
||||||
header = '# TRAINS SDK configuration file\n' \
|
header = '# TRAINS SDK configuration file\n' \
|
||||||
|
Loading…
Reference in New Issue
Block a user