Skip to content

Python 3 support on Windows #511

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 12, 2017
17 changes: 8 additions & 9 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: .{build}-{branch}

environment:
SYSTEMROOT: "C:\\WINDOWS"

matrix:
- PYTHON: "C:\\Python27"
Expand All @@ -11,28 +12,26 @@ environment:
PYTHON_VERSION: "2.7.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python33_64"
PYTHON_VERSION: "3.3"
- PYTHON: "C:\\Python33-x64"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kapilkd13 you can drop Python 3.3, in my opinion. It is of little use and it's slowing down builds

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can keep it, for parity with Linux/OSX

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure. 👍

PYTHON_VERSION: "3.3.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python34_64"
PYTHON_VERSION: "3.4"
- PYTHON: "C:\\Python34-x64"
PYTHON_VERSION: "3.4.x"
PYTHON_ARCH: "64"

- PYTHON: "C:\\Python35_64"
PYTHON_VERSION: "3.5"
- PYTHON: "C:\\Python35-x64"
PYTHON_VERSION: "3.5.x"
PYTHON_ARCH: "64"


install:
- "SET PATH=%PYTHON%;%PYTHON%\\Scripts;%PATH%"
- "python --version"
- "python -c \"import struct; print(struct.calcsize('P') * 8)\""
- "pip install --disable-pip-version-check --user --upgrade pip"
- "pip install --upgrade --no-deps --force-reinstall git+git://github.com/kapilkd13/schema_salad@windows#egg=schema_salad-2.4.201706261942"

build_script:
- "%CMD_IN_ENV% python setup.py install"
- "%CMD_IN_ENV% pip install ."


test_script:
Expand Down
4 changes: 2 additions & 2 deletions cwltool/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ def __init__(self): # type: () -> None
self.job_script_provider = None # type: Any

def build_job_script(self, commands):
# type: (List[bytes]) -> Text
build_job_script_method = getattr(self.job_script_provider, "build_job_script", None) # type: Callable[[Builder, List[bytes]], Text]
# type: (List[Text]) -> Text
build_job_script_method = getattr(self.job_script_provider, "build_job_script", None) # type: Callable[[Builder, Union[List[str],List[Text]]], Text]
if build_job_script_method:
return build_job_script_method(self, commands)
else:
Expand Down
6 changes: 4 additions & 2 deletions cwltool/job.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def _execute(self, runtime, env, rm_tmpdir=True, move_outputs="move"):
os.makedirs(dn)
stdout_path = absout

commands = [Text(x).encode('utf-8') for x in runtime + self.command_line]
commands = [Text(x) for x in (runtime + self.command_line)]
job_script_contents = None # type: Text
builder = getattr(self, "builder", None) # type: Builder
if builder is not None:
Expand Down Expand Up @@ -297,6 +297,8 @@ def run(self, pull_image=True, rm_container=True,
env["TMPDIR"] = str(self.tmpdir) if onWindows() else self.tmpdir
if "PATH" not in env:
env["PATH"] = str(os.environ["PATH"]) if onWindows() else os.environ["PATH"]
if "SYSTEMROOT" not in env and "SYSTEMROOT" in os.environ:
env["SYSTEMROOT"] = str(os.environ["SYSTEMROOT"]) if onWindows() else os.environ["SYSTEMROOT"]

stageFiles(self.pathmapper, ignoreWritable=True, symLink=True)
if self.generatemapper:
Expand Down Expand Up @@ -422,7 +424,7 @@ def run(self, pull_image=True, rm_container=True,


def _job_popen(
commands, # type: List[bytes]
commands, # type: List[Text]
stdin_path, # type: Text
stdout_path, # type: Text
stderr_path, # type: Text
Expand Down
5 changes: 3 additions & 2 deletions cwltool/sandboxjs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def new_js_proc(force_docker_pull=False):
# type: (bool) -> subprocess.Popen

res = resource_stream(__name__, 'cwlNodeEngine.js')
nodecode = res.read()
nodecode = res.read().decode('utf-8')

required_node_version, docker = (False,)*2
nodejs = None
trynodes = ("nodejs", "node")
Expand Down Expand Up @@ -238,7 +239,7 @@ def get_error(error_queue):
no_more_error.release()
output_thread.join()
error_thread.join()
if stdout_buf.getvalue().endswith("\n"):
if stdout_buf.getvalue().endswith("\n".encode()):
rselect = []
no_more_output.release()
no_more_error.release()
Expand Down