Skip to content

Commit cfb0425

Browse files
committed
last fix for tonight
1 parent 30e5eb5 commit cfb0425

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

python_workflow_definition/src/python_workflow_definition/cwl/__main__.py

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
import sys
2-
import os
3-
import shutil
42
import pickle
53
from ast import literal_eval
6-
from importlib import import_module
4+
import importlib.util
75

86

97
def load_function(funct):
108
p, m = funct.rsplit(".", 1)
11-
return getattr(import_module(p), m)
9+
spec = importlib.util.spec_from_file_location(p, p + ".py")
10+
module = importlib.util.module_from_spec(spec)
11+
sys.modules[p] = module
12+
spec.loader.exec_module(module)
13+
return getattr(module, m)
1214

1315

1416
def convert_argument(arg):
@@ -27,12 +29,6 @@ def convert_argument(arg):
2729
for arg in argument_lst
2830
if "--function=" in arg
2931
][0]
30-
file = [
31-
load_function(funct=arg.split("=")[-1])
32-
for arg in argument_lst
33-
if "--workflowfile=" in arg
34-
][0]
35-
shutil.copyfile(file, os.curdir)
3632
kwargs = {
3733
arg.split("=")[0][6:]: convert_argument(arg=arg.split("=")[-1])
3834
for arg in argument_lst

python_workflow_definition/src/python_workflow_definition/cwl/export.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ def _write_function_cwl(workflow):
9898
},
9999
"workflowfile": {
100100
"type": "File",
101-
"inputBinding": {"position": 2, "prefix": "--workflowfile=", "separate": False},
101+
"inputBinding": {
102+
"position": 2,
103+
"prefix": "--workflowfile=",
104+
"separate": False,
105+
},
102106
"default": {"class": "File", "location": "workflow.py"},
103107
},
104108
},

0 commit comments

Comments
 (0)