File tree Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Expand file tree Collapse file tree 3 files changed +56
-2
lines changed Original file line number Diff line number Diff line change 12
12
import sys
13
13
import time
14
14
import urllib
15
+ import warnings
15
16
from codecs import StreamWriter , getwriter
16
17
from collections .abc import MutableMapping , MutableSequence
17
18
from typing import (
@@ -1323,9 +1324,25 @@ def find_default_container(
1323
1324
return default_container
1324
1325
1325
1326
1326
- def run (* args , ** kwargs ):
1327
- # type: (*Any, **Any) -> None
1327
+ def windows_check () -> None :
1328
+ """See if we are running on MS Windows and warn about the lack of support."""
1329
+ if os .name == "nt" :
1330
+ warnings .warn (
1331
+ "The CWL reference runner (cwltool) no longer supports running "
1332
+ "CWL workflows natively on MS Windows as its previous MS Windows "
1333
+ "support was incomplete and untested. Instead, please see "
1334
+ "https://pypi.org/project/cwltool/#ms-windows-users "
1335
+ "for instructions on running cwltool via "
1336
+ "Windows Subsystem for Linux 2 (WSL2). If don't need to execute "
1337
+ "CWL documents, then you can ignore this warning, but please "
1338
+ "consider migrating to https://pypi.org/project/cwl-utils/ "
1339
+ "for your CWL document processing needs."
1340
+ )
1341
+
1342
+
1343
+ def run (* args : Any , ** kwargs : Any ) -> None :
1328
1344
"""Run cwltool."""
1345
+ windows_check ()
1329
1346
signal .signal (signal .SIGTERM , _signal_handler )
1330
1347
try :
1331
1348
sys .exit (main (* args , ** kwargs ))
Original file line number Diff line number Diff line change 2
2
"""Setup for the reference implementation of the CWL standards."""
3
3
import os
4
4
import sys
5
+ import warnings
5
6
6
7
import setuptools .command .egg_info as egg_info_cmd
7
8
from setuptools import setup
8
9
10
+ if os .name == "nt" :
11
+ warnings .warn (
12
+ "The CWL reference runner (cwltool) no longer supports running "
13
+ "CWL workflows natively on MS Windows as its previous MS Windows "
14
+ "support was incomplete and untested. Instead, please see "
15
+ "https://pypi.org/project/cwltool/#ms-windows-users "
16
+ "for instructions on running cwltool via "
17
+ "Windows Subsystem for Linux 2 (WSL2). If don't need to execute "
18
+ "CWL documents, then you can ignore this warning, but please "
19
+ "consider migrating to https://pypi.org/project/cwl-utils/ "
20
+ "for your CWL document processing needs."
21
+ )
22
+
9
23
SETUP_DIR = os .path .dirname (__file__ )
10
24
README = os .path .join (SETUP_DIR , "README.rst" )
11
25
Original file line number Diff line number Diff line change
1
+ """Test user experience running on MS Windows."""
2
+
3
+ import os
4
+ import warnings
5
+
6
+ import pytest
7
+
8
+ from cwltool import main
9
+
10
+ # Can't be just "import cwltool ; … cwltool.main.windows_check()"
11
+ # needs a direct import to avoid path traversal after os.name is set to "nt"
12
+
13
+
14
+ def test_windows_warning (monkeypatch : pytest .MonkeyPatch ) -> None :
15
+ """Confirm that the windows warning is given."""
16
+ with pytest .warns (UserWarning , match = r"Windows Subsystem for Linux 2" ):
17
+ # would normally just use the MonkeyPatch object directly
18
+ # but if we don't use a context then os.name being "nt" causes problems
19
+ # for pytest on non-Windows systems. So the context unravels the change
20
+ # to os.name quickly, and then pytest will check for the desired warning
21
+ with monkeypatch .context () as m :
22
+ m .setattr (os , "name" , "nt" )
23
+ main .windows_check ()
You can’t perform that action at this time.
0 commit comments