Skip to content

Commit

Permalink
guard import pwd for windows (#1822)
Browse files Browse the repository at this point in the history
Co-authored-by: Jake Fennick <[email protected]>
Co-authored-by: Michael R. Crusoe <[email protected]>
  • Loading branch information
3 people authored Mar 25, 2023
1 parent 86f96a4 commit 7ba69ab
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 22 deletions.
3 changes: 2 additions & 1 deletion cwltool/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@
from cwl_utils.file_formats import check_format
from mypy_extensions import mypyc_attr
from rdflib import Graph
from ruamel.yaml.comments import CommentedMap
from schema_salad.avro.schema import Names, Schema, make_avsc_object
from schema_salad.exceptions import ValidationException
from schema_salad.sourceline import SourceLine
from schema_salad.utils import convert_to_dict, json_dumps
from schema_salad.validate import validate

from ruamel.yaml.comments import CommentedMap

from .errors import WorkflowException
from .loghandler import _logger
from .mutation import MutationManager
Expand Down
3 changes: 2 additions & 1 deletion cwltool/command_line_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,15 @@

import shellescape
from mypy_extensions import mypyc_attr
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.avro.schema import Schema
from schema_salad.exceptions import ValidationException
from schema_salad.ref_resolver import file_uri, uri_file_path
from schema_salad.sourceline import SourceLine
from schema_salad.utils import json_dumps
from schema_salad.validate import validate_ex

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .builder import (
INPUT_OBJ_VOCAB,
Builder,
Expand Down
3 changes: 2 additions & 1 deletion cwltool/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@
Union,
)

from ruamel.yaml.comments import CommentedMap
from schema_salad.avro.schema import Names
from schema_salad.ref_resolver import Loader
from schema_salad.utils import FetcherCallableType
from typing_extensions import Literal

from ruamel.yaml.comments import CommentedMap

from .mpi import MpiConfig
from .pathmapper import PathMapper
from .stdfsaccess import StdFsAccess
Expand Down
3 changes: 2 additions & 1 deletion cwltool/cwlrdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

from rdflib import Graph
from rdflib.query import ResultRow
from ruamel.yaml.comments import CommentedMap
from schema_salad.jsonld_context import makerdf
from schema_salad.utils import ContextType

from ruamel.yaml.comments import CommentedMap

from .cwlviewer import CWLViewer
from .process import Process

Expand Down
3 changes: 2 additions & 1 deletion cwltool/load_tool.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
)

from cwl_utils.parser import cwl_v1_2, cwl_v1_2_utils
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.exceptions import ValidationException
from schema_salad.fetcher import Fetcher
from schema_salad.ref_resolver import Loader, file_uri
Expand All @@ -35,6 +34,8 @@
json_dumps,
)

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from . import CWL_CONTENT_TYPES, process, update
from .context import LoadingContext
from .errors import GraphTargetMissingException
Expand Down
7 changes: 4 additions & 3 deletions cwltool/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@
import argcomplete
import coloredlogs
import pkg_resources # part of setuptools
import ruamel.yaml
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from ruamel.yaml.main import YAML
from schema_salad.exceptions import ValidationException
from schema_salad.ref_resolver import Loader, file_uri, uri_file_path
from schema_salad.sourceline import cmap, strip_dup_lineno
Expand All @@ -48,6 +45,10 @@
yaml_no_ts,
)

import ruamel.yaml
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from ruamel.yaml.main import YAML

from . import CWL_CONTENT_TYPES, workflow
from .argparser import arg_parser, generate_parser, get_default_args
from .context import LoadingContext, RuntimeContext, getdefault
Expand Down
3 changes: 2 additions & 1 deletion cwltool/pack.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@
cast,
)

from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.ref_resolver import Loader, SubLoader
from schema_salad.utils import ResolveType

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .context import LoadingContext
from .load_tool import fetch_document, resolve_and_validate_document
from .process import shortname, uniquename
Expand Down
3 changes: 2 additions & 1 deletion cwltool/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
from mypy_extensions import mypyc_attr
from pkg_resources import resource_stream
from rdflib import Graph
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.avro.schema import (
Names,
Schema,
Expand All @@ -50,6 +49,8 @@
from schema_salad.utils import convert_to_dict
from schema_salad.validate import avro_type_name, validate_ex

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .builder import INPUT_OBJ_VOCAB, Builder
from .context import LoadingContext, RuntimeContext, getdefault
from .errors import UnsupportedRequirement, WorkflowException
Expand Down
3 changes: 2 additions & 1 deletion cwltool/procgenerator.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import copy
from typing import Dict, Optional, Tuple, cast

from ruamel.yaml.comments import CommentedMap
from schema_salad.exceptions import ValidationException
from schema_salad.sourceline import indent

from ruamel.yaml.comments import CommentedMap

from .context import LoadingContext, RuntimeContext
from .errors import WorkflowException
from .load_tool import load_tool
Expand Down
8 changes: 7 additions & 1 deletion cwltool/provenance.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
import datetime
import hashlib
import os
import pwd

try:
import pwd
except ImportError:
# Guard against `from .provenance import ...` on windows.
# See windows_check() in main.py
pass
import re
import shutil
import tempfile
Expand Down
3 changes: 2 additions & 1 deletion cwltool/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@
cast,
)

from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.exceptions import ValidationException
from schema_salad.ref_resolver import Loader
from schema_salad.sourceline import SourceLine

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .loghandler import _logger
from .utils import CWLObjectType, CWLOutputType, aslist, visit_class, visit_field

Expand Down
3 changes: 2 additions & 1 deletion cwltool/validate_js.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
from cwl_utils.expression import scanner as scan_expression
from cwl_utils.sandboxjs import code_fragment_to_js, exec_js_process
from pkg_resources import resource_stream
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.avro.schema import (
ArraySchema,
EnumSchema,
Expand All @@ -31,6 +30,8 @@
from schema_salad.utils import json_dumps
from schema_salad.validate import validate_ex

from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .errors import WorkflowException
from .loghandler import _logger

Expand Down
3 changes: 2 additions & 1 deletion cwltool/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
)
from uuid import UUID

from ruamel.yaml.comments import CommentedMap
from schema_salad.exceptions import ValidationException
from schema_salad.sourceline import SourceLine, indent

from ruamel.yaml.comments import CommentedMap

from . import command_line_tool, context, procgenerator
from .checker import circular_dependency_checker, loop_checker, static_checker
from .context import LoadingContext, RuntimeContext, getdefault
Expand Down
2 changes: 1 addition & 1 deletion tests/test_anon_types.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from typing import cast

import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.sourceline import cmap

from cwltool.command_line_tool import CommandLineTool
from cwltool.context import LoadingContext
from ruamel.yaml.comments import CommentedMap

snippet = cast(
CommentedMap,
Expand Down
2 changes: 1 addition & 1 deletion tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import pytest
from cwl_utils.errors import JavascriptException
from cwl_utils.sandboxjs import param_re
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.exceptions import ValidationException

import cwltool.checker
Expand All @@ -29,6 +28,7 @@
from cwltool.main import main
from cwltool.process import CWL_IANA
from cwltool.utils import CWLObjectType, dedup
from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .util import get_data, get_main_output, needs_docker, working_directory

Expand Down
2 changes: 1 addition & 1 deletion tests/test_mpi.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

import pkg_resources
import pytest
from ruamel.yaml.comments import CommentedMap, CommentedSeq
from schema_salad.avro.schema import Names
from schema_salad.utils import yaml_no_ts

Expand All @@ -19,6 +18,7 @@
from cwltool.context import LoadingContext, RuntimeContext
from cwltool.main import main
from cwltool.mpi import MpiConfig, MPIRequirementName
from ruamel.yaml.comments import CommentedMap, CommentedSeq

from .util import get_data, working_directory

Expand Down
2 changes: 1 addition & 1 deletion tests/test_path_checks.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import IO, Any, List, cast

import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.sourceline import cmap

from cwltool.command_line_tool import CommandLineTool
Expand All @@ -13,6 +12,7 @@
from cwltool.stdfsaccess import StdFsAccess
from cwltool.update import INTERNAL_VERSION
from cwltool.utils import CWLObjectType
from ruamel.yaml.comments import CommentedMap

from .util import needs_docker

Expand Down
2 changes: 1 addition & 1 deletion tests/test_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from typing import cast

import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.sourceline import cmap

from cwltool.command_line_tool import CommandLineTool
Expand All @@ -13,6 +12,7 @@
from cwltool.job import JobBase
from cwltool.update import INTERNAL_VERSION, ORIGINAL_CWLVERSION
from cwltool.utils import CWLObjectType
from ruamel.yaml.comments import CommentedMap

from .util import get_data

Expand Down
2 changes: 1 addition & 1 deletion tests/test_subclass_mypyc.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import pickle

import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.avro import schema

from cwltool.builder import Builder
from cwltool.command_line_tool import CommandLineTool, ExpressionTool
from cwltool.context import LoadingContext, RuntimeContext
from cwltool.stdfsaccess import StdFsAccess
from cwltool.update import INTERNAL_VERSION
from ruamel.yaml.comments import CommentedMap

from .test_anon_types import snippet

Expand Down
2 changes: 1 addition & 1 deletion tests/test_tmpdir.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from typing import List, cast

import pytest
from ruamel.yaml.comments import CommentedMap
from schema_salad.avro import schema
from schema_salad.sourceline import cmap

Expand All @@ -19,6 +18,7 @@
from cwltool.stdfsaccess import StdFsAccess
from cwltool.update import INTERNAL_VERSION, ORIGINAL_CWLVERSION
from cwltool.utils import create_tmp_dir
from ruamel.yaml.comments import CommentedMap

from .util import get_data, needs_docker

Expand Down

0 comments on commit 7ba69ab

Please sign in to comment.