Skip to content

Commit 1275466

Browse files
authored
Merge pull request #511 from kapilkd13/py3_window
Python 3 support on Windows
2 parents a6dc84b + 02f3c85 commit 1275466

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

appveyor.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
version: .{build}-{branch}
22

33
environment:
4+
SYSTEMROOT: "C:\\WINDOWS"
45

56
matrix:
67
- PYTHON: "C:\\Python27"
@@ -11,28 +12,26 @@ environment:
1112
PYTHON_VERSION: "2.7.x"
1213
PYTHON_ARCH: "64"
1314

14-
- PYTHON: "C:\\Python33_64"
15-
PYTHON_VERSION: "3.3"
15+
- PYTHON: "C:\\Python33-x64"
16+
PYTHON_VERSION: "3.3.x"
1617
PYTHON_ARCH: "64"
1718

18-
- PYTHON: "C:\\Python34_64"
19-
PYTHON_VERSION: "3.4"
19+
- PYTHON: "C:\\Python34-x64"
20+
PYTHON_VERSION: "3.4.x"
2021
PYTHON_ARCH: "64"
2122

22-
- PYTHON: "C:\\Python35_64"
23-
PYTHON_VERSION: "3.5"
23+
- PYTHON: "C:\\Python35-x64"
24+
PYTHON_VERSION: "3.5.x"
2425
PYTHON_ARCH: "64"
2526

2627

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

3433
build_script:
35-
- "%CMD_IN_ENV% python setup.py install"
34+
- "%CMD_IN_ENV% pip install ."
3635

3736

3837
test_script:

cwltool/builder.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,8 @@ def __init__(self): # type: () -> None
6262
self.job_script_provider = None # type: Any
6363

6464
def build_job_script(self, commands):
65-
# type: (List[bytes]) -> Text
66-
build_job_script_method = getattr(self.job_script_provider, "build_job_script", None) # type: Callable[[Builder, List[bytes]], Text]
65+
# type: (List[Text]) -> Text
66+
build_job_script_method = getattr(self.job_script_provider, "build_job_script", None) # type: Callable[[Builder, Union[List[str],List[Text]]], Text]
6767
if build_job_script_method:
6868
return build_job_script_method(self, commands)
6969
else:

cwltool/job.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _execute(self, runtime, env, rm_tmpdir=True, move_outputs="move"):
207207
os.makedirs(dn)
208208
stdout_path = absout
209209

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

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

423425

424426
def _job_popen(
425-
commands, # type: List[bytes]
427+
commands, # type: List[Text]
426428
stdin_path, # type: Text
427429
stdout_path, # type: Text
428430
stderr_path, # type: Text

cwltool/sandboxjs.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@ def new_js_proc(force_docker_pull=False):
5757
# type: (bool) -> subprocess.Popen
5858

5959
res = resource_stream(__name__, 'cwlNodeEngine.js')
60-
nodecode = res.read()
60+
nodecode = res.read().decode('utf-8')
61+
6162
required_node_version, docker = (False,)*2
6263
nodejs = None
6364
trynodes = ("nodejs", "node")
@@ -238,7 +239,7 @@ def get_error(error_queue):
238239
no_more_error.release()
239240
output_thread.join()
240241
error_thread.join()
241-
if stdout_buf.getvalue().endswith("\n"):
242+
if stdout_buf.getvalue().endswith("\n".encode()):
242243
rselect = []
243244
no_more_output.release()
244245
no_more_error.release()

0 commit comments

Comments
 (0)