Skip to content

Commit

Permalink
Fixes for Python 2.x; updates for Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
willsmythe committed Nov 9, 2017
1 parent 822815d commit 8bc4321
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
#---------------------------------------------------------------------------------------------

FROM python:3.6.3-alpine
FROM python:2.7.14-alpine
# Alternatively, FROM python:2.7.14-alpine

ARG CLI_VERSION
ARG BUILD_DATE
Expand Down
20 changes: 10 additions & 10 deletions scripts/curl_install/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ def install_cli(install_dir, tmp_dir):
exec_command(fixupcmd)

def create_executable(exec_dir, install_dir):
actual_exec_filepath = os.path.join(install_dir, 'bin', EXECUTABLE_NAME)

create_dir(exec_dir)
exec_filepath = os.path.join(exec_dir, EXECUTABLE_NAME)
with open(exec_filepath, 'w') as exec_file:
exec_file.write(CLI_DISPATCH_TEMPLATE.format(install_dir=install_dir))

os.symlink(actual_exec_filepath, exec_filepath)

cur_stat = os.stat(exec_filepath)
os.chmod(exec_filepath, cur_stat.st_mode | stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH)
print_status("The executable is available at '{}'.".format(exec_filepath))
Expand Down Expand Up @@ -365,16 +368,13 @@ def main():
verify_install_dir_exec_path_conflict(install_dir, exec_path)
create_virtualenv(tmp_dir, install_dir)
install_cli(install_dir, tmp_dir)
#exec_filepath = create_executable(exec_dir, install_dir)

exec_filepath = "vsts"

exec_filepath = create_executable(exec_dir, install_dir)
completion_file_path = os.path.join(install_dir, COMPLETION_FILENAME)
create_tab_completion_file(completion_file_path)
#try:
# handle_path_and_tab_completion(completion_file_path, exec_filepath, exec_dir)
#except Exception as e:
# print_status("Unable to set up tab completion. ERROR: {}".format(str(e)))
try:
handle_path_and_tab_completion(completion_file_path, exec_filepath, exec_dir)
except Exception as e:
print_status("Unable to set up tab completion. ERROR: {}".format(str(e)))

shutil.rmtree(tmp_dir)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@
import keyring

from knack.util import CLIError
from urllib.parse import urlparse
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from vsts._file_cache import get_cache


Expand Down
7 changes: 5 additions & 2 deletions src/common_modules/vsts-cli-common/vsts/cli/common/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import logging
import subprocess
import sys
import urllib.parse
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse


try:
Expand Down Expand Up @@ -63,7 +66,7 @@ def get_remote_url(validation_function=None):


def get_git_credentials(team_instance):
parse_result = urllib.parse.urlparse(team_instance)
parse_result = urlparse(team_instance)
protocol = parse_result.scheme
host = parse_result.netloc
standard_in = bytes('protocol={protocol}\nhost={host}'.format(protocol=protocol, host=host), 'utf-8')
Expand Down
5 changes: 4 additions & 1 deletion src/common_modules/vsts-cli-common/vsts/cli/common/vsts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
import threading

from collections import OrderedDict
from urllib.parse import urlparse
try:
from urllib.parse import urlparse
except ImportError:
from urlparse import urlparse
from knack.util import CLIError
from msrest.authentication import BasicAuthentication
from msrest.serialization import Model
Expand Down
2 changes: 2 additions & 0 deletions src/vsts-cli/vsts/cli/vsts_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------------------------------

from __future__ import print_function

from .vsts_cli_help import VstsCLIHelp
from .vsts_commands_loader import VstsCommandsLoader
from knack import CLI
Expand Down

0 comments on commit 8bc4321

Please sign in to comment.