Remove dependency on Unix tools in Windows
This commit is contained in:
@@ -43,7 +43,7 @@ def test(tmp_path):
|
|||||||
project_dir,
|
project_dir,
|
||||||
add_env={
|
add_env={
|
||||||
"CIBW_ENVIRONMENT": """CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH=$PATH:/opt/cibw_test_path""",
|
"CIBW_ENVIRONMENT": """CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH=$PATH:/opt/cibw_test_path""",
|
||||||
"CIBW_ENVIRONMENT_WINDOWS": '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(echo 'test string 3')" PATH="$PATH;/opt/cibw_test_path"''',
|
"CIBW_ENVIRONMENT_WINDOWS": '''CIBW_TEST_VAR="a b c" CIBW_TEST_VAR_2=1 CIBW_TEST_VAR_3="$(cmd /C echo test string 3)" PATH="$PATH;/opt/cibw_test_path"''',
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import sys
|
||||||
|
|
||||||
from cibuildwheel.environment import parse_environment
|
from cibuildwheel.environment import parse_environment
|
||||||
|
|
||||||
@@ -28,7 +29,11 @@ def test_inheritance():
|
|||||||
|
|
||||||
|
|
||||||
def test_shell_eval():
|
def test_shell_eval():
|
||||||
environment_recipe = parse_environment('VAR="$(echo "a test" string)"')
|
if sys.platform == "win32":
|
||||||
|
env_string = 'VAR="$(cmd /C "echo a test string")"'
|
||||||
|
else:
|
||||||
|
env_string = 'VAR="$(echo "a test" string)"'
|
||||||
|
environment_recipe = parse_environment(env_string)
|
||||||
|
|
||||||
env_copy = os.environ.copy()
|
env_copy = os.environ.copy()
|
||||||
env_copy.pop("VAR", None)
|
env_copy.pop("VAR", None)
|
||||||
@@ -39,7 +44,11 @@ def test_shell_eval():
|
|||||||
|
|
||||||
|
|
||||||
def test_shell_eval_and_env():
|
def test_shell_eval_and_env():
|
||||||
environment_recipe = parse_environment('VAR="$(echo "$PREV_VAR" string)"')
|
if sys.platform == "win32":
|
||||||
|
env_string = 'VAR="$(cmd /C "echo $PREV_VAR string")"'
|
||||||
|
else:
|
||||||
|
env_string = 'VAR="$(echo "$PREV_VAR" string)"'
|
||||||
|
environment_recipe = parse_environment(env_string)
|
||||||
|
|
||||||
environment_dict = environment_recipe.as_dictionary(prev_environment={"PREV_VAR": "1 2 3"})
|
environment_dict = environment_recipe.as_dictionary(prev_environment={"PREV_VAR": "1 2 3"})
|
||||||
|
|
||||||
@@ -73,7 +82,11 @@ def test_no_vars_pass_through():
|
|||||||
|
|
||||||
|
|
||||||
def test_operators_inside_eval():
|
def test_operators_inside_eval():
|
||||||
environment_recipe = parse_environment('SOMETHING="$(echo a; echo b; echo c)"')
|
if sys.platform == "win32":
|
||||||
|
env_string = 'SOMETHING="$(cmd /C echo a; cmd /C echo b; cmd /C echo c)"'
|
||||||
|
else:
|
||||||
|
env_string = 'SOMETHING="$(echo a; echo b; echo c)"'
|
||||||
|
environment_recipe = parse_environment(env_string)
|
||||||
|
|
||||||
# pass the existing process env so PATH is available
|
# pass the existing process env so PATH is available
|
||||||
environment_dict = environment_recipe.as_dictionary(os.environ.copy())
|
environment_dict = environment_recipe.as_dictionary(os.environ.copy())
|
||||||
@@ -91,9 +104,13 @@ def test_substitution_with_backslash():
|
|||||||
|
|
||||||
|
|
||||||
def test_awkwardly_quoted_variable():
|
def test_awkwardly_quoted_variable():
|
||||||
environment_recipe = parse_environment(
|
if sys.platform == "win32":
|
||||||
'VAR2=something"like this""$VAR1"$VAR1$(echo "there is more")"$(echo "and more!")"'
|
env_string = 'VAR2=something"like this""$VAR1"$VAR1$(cmd /C echo there is more)"$(cmd /C echo and more!)"'
|
||||||
)
|
else:
|
||||||
|
env_string = (
|
||||||
|
'VAR2=something"like this""$VAR1"$VAR1$(echo "there is more")"$(echo "and more!")"'
|
||||||
|
)
|
||||||
|
environment_recipe = parse_environment(env_string)
|
||||||
|
|
||||||
# pass the existing process env so PATH is available
|
# pass the existing process env so PATH is available
|
||||||
environment_dict = environment_recipe.as_dictionary({"VAR1": "but wait"})
|
environment_dict = environment_recipe.as_dictionary({"VAR1": "but wait"})
|
||||||
|
|||||||
Reference in New Issue
Block a user