Skip to content

Commit c843ed4

Browse files
committed
set root folder for WDL imports
1 parent 855b684 commit c843ed4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

wdl2cwl/main.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
"""Main entrypoint for WDL2CWL."""
22
import argparse
3-
import os
43
import re
54
import sys
65
import textwrap
6+
from pathlib import Path
77
from typing import (
88
Any,
99
Dict,
1010
Iterator,
1111
List,
1212
Optional,
13-
Mapping,
1413
Sequence,
1514
Set,
1615
Tuple,
@@ -26,8 +25,8 @@
2625
import WDL._parser # delete when reloading bug is fixed upstream
2726
import WDL.CLI
2827
from ruamel.yaml import scalarstring
29-
from ruamel.yaml.main import YAML
3028
from ruamel.yaml.comments import CommentedMap
29+
from ruamel.yaml.main import YAML
3130

3231
from wdl2cwl import _logger
3332
from wdl2cwl.errors import WDLSourceLine
@@ -53,9 +52,10 @@ class ConversionException(Exception):
5352
def convert(doc: str) -> Dict[str, Any]:
5453
"""Convert a WDL workflow, reading the file, into a CWL workflow Python object."""
5554
WDL._parser._lark_comments_buffer.clear()
55+
root_folder = str(Path(doc).parent)
5656
try:
5757
doc_tree = WDL.load(
58-
doc, [], read_source=WDL.CLI.make_read_source(False), check_quant=True # type: ignore[no-untyped-call]
58+
doc, [root_folder], read_source=WDL.CLI.make_read_source(False), check_quant=True # type: ignore[no-untyped-call]
5959
)
6060
except (
6161
WDL.Error.SyntaxError,

0 commit comments

Comments
 (0)