Skip to content

Commit 7ba69ab

Browse files
jfennickmr-c
andauthored
guard import pwd for windows (#1822)
Co-authored-by: Jake Fennick <[email protected]> Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent 86f96a4 commit 7ba69ab

20 files changed

+40
-22
lines changed

cwltool/builder.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@
2121
from cwl_utils.file_formats import check_format
2222
from mypy_extensions import mypyc_attr
2323
from rdflib import Graph
24-
from ruamel.yaml.comments import CommentedMap
2524
from schema_salad.avro.schema import Names, Schema, make_avsc_object
2625
from schema_salad.exceptions import ValidationException
2726
from schema_salad.sourceline import SourceLine
2827
from schema_salad.utils import convert_to_dict, json_dumps
2928
from schema_salad.validate import validate
3029

30+
from ruamel.yaml.comments import CommentedMap
31+
3132
from .errors import WorkflowException
3233
from .loghandler import _logger
3334
from .mutation import MutationManager

cwltool/command_line_tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,15 @@
3333

3434
import shellescape
3535
from mypy_extensions import mypyc_attr
36-
from ruamel.yaml.comments import CommentedMap, CommentedSeq
3736
from schema_salad.avro.schema import Schema
3837
from schema_salad.exceptions import ValidationException
3938
from schema_salad.ref_resolver import file_uri, uri_file_path
4039
from schema_salad.sourceline import SourceLine
4140
from schema_salad.utils import json_dumps
4241
from schema_salad.validate import validate_ex
4342

43+
from ruamel.yaml.comments import CommentedMap, CommentedSeq
44+
4445
from .builder import (
4546
INPUT_OBJ_VOCAB,
4647
Builder,

cwltool/context.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@
1818
Union,
1919
)
2020

21-
from ruamel.yaml.comments import CommentedMap
2221
from schema_salad.avro.schema import Names
2322
from schema_salad.ref_resolver import Loader
2423
from schema_salad.utils import FetcherCallableType
2524
from typing_extensions import Literal
2625

26+
from ruamel.yaml.comments import CommentedMap
27+
2728
from .mpi import MpiConfig
2829
from .pathmapper import PathMapper
2930
from .stdfsaccess import StdFsAccess

cwltool/cwlrdf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
from rdflib import Graph
66
from rdflib.query import ResultRow
7-
from ruamel.yaml.comments import CommentedMap
87
from schema_salad.jsonld_context import makerdf
98
from schema_salad.utils import ContextType
109

10+
from ruamel.yaml.comments import CommentedMap
11+
1112
from .cwlviewer import CWLViewer
1213
from .process import Process
1314

cwltool/load_tool.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
)
2222

2323
from cwl_utils.parser import cwl_v1_2, cwl_v1_2_utils
24-
from ruamel.yaml.comments import CommentedMap, CommentedSeq
2524
from schema_salad.exceptions import ValidationException
2625
from schema_salad.fetcher import Fetcher
2726
from schema_salad.ref_resolver import Loader, file_uri
@@ -35,6 +34,8 @@
3534
json_dumps,
3635
)
3736

37+
from ruamel.yaml.comments import CommentedMap, CommentedSeq
38+
3839
from . import CWL_CONTENT_TYPES, process, update
3940
from .context import LoadingContext
4041
from .errors import GraphTargetMissingException

cwltool/main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,6 @@
3434
import argcomplete
3535
import coloredlogs
3636
import pkg_resources # part of setuptools
37-
import ruamel.yaml
38-
from ruamel.yaml.comments import CommentedMap, CommentedSeq
39-
from ruamel.yaml.main import YAML
4037
from schema_salad.exceptions import ValidationException
4138
from schema_salad.ref_resolver import Loader, file_uri, uri_file_path
4239
from schema_salad.sourceline import cmap, strip_dup_lineno
@@ -48,6 +45,10 @@
4845
yaml_no_ts,
4946
)
5047

48+
import ruamel.yaml
49+
from ruamel.yaml.comments import CommentedMap, CommentedSeq
50+
from ruamel.yaml.main import YAML
51+
5152
from . import CWL_CONTENT_TYPES, workflow
5253
from .argparser import arg_parser, generate_parser, get_default_args
5354
from .context import LoadingContext, RuntimeContext, getdefault

cwltool/pack.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,11 @@
1414
cast,
1515
)
1616

17-
from ruamel.yaml.comments import CommentedMap, CommentedSeq
1817
from schema_salad.ref_resolver import Loader, SubLoader
1918
from schema_salad.utils import ResolveType
2019

20+
from ruamel.yaml.comments import CommentedMap, CommentedSeq
21+
2122
from .context import LoadingContext
2223
from .load_tool import fetch_document, resolve_and_validate_document
2324
from .process import shortname, uniquename

cwltool/process.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
from mypy_extensions import mypyc_attr
3737
from pkg_resources import resource_stream
3838
from rdflib import Graph
39-
from ruamel.yaml.comments import CommentedMap, CommentedSeq
4039
from schema_salad.avro.schema import (
4140
Names,
4241
Schema,
@@ -50,6 +49,8 @@
5049
from schema_salad.utils import convert_to_dict
5150
from schema_salad.validate import avro_type_name, validate_ex
5251

52+
from ruamel.yaml.comments import CommentedMap, CommentedSeq
53+
5354
from .builder import INPUT_OBJ_VOCAB, Builder
5455
from .context import LoadingContext, RuntimeContext, getdefault
5556
from .errors import UnsupportedRequirement, WorkflowException

cwltool/procgenerator.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import copy
22
from typing import Dict, Optional, Tuple, cast
33

4-
from ruamel.yaml.comments import CommentedMap
54
from schema_salad.exceptions import ValidationException
65
from schema_salad.sourceline import indent
76

7+
from ruamel.yaml.comments import CommentedMap
8+
89
from .context import LoadingContext, RuntimeContext
910
from .errors import WorkflowException
1011
from .load_tool import load_tool

cwltool/provenance.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,13 @@
88
import datetime
99
import hashlib
1010
import os
11-
import pwd
11+
12+
try:
13+
import pwd
14+
except ImportError:
15+
# Guard against `from .provenance import ...` on windows.
16+
# See windows_check() in main.py
17+
pass
1218
import re
1319
import shutil
1420
import tempfile

0 commit comments

Comments
 (0)