From 51b021e08a90d9d235cd5c14852c50b7bec6b9a8 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Sun, 18 Jul 2021 17:19:41 +0200 Subject: [PATCH 1/5] Add an example of PATH customisation on Windows On Windows you often find directories containing spaces. The relation between quotes and escaping is not intuitive, see #765. --- docs/options.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/options.md b/docs/options.md index f3624660..c4dc99a4 100644 --- a/docs/options.md +++ b/docs/options.md @@ -499,6 +499,10 @@ Platform-specific environment variables are also available:
# Append a directory to the PATH variable (this is expanded in the build environment) CIBW_ENVIRONMENT: "PATH=$PATH:/usr/local/bin" + # Prepend a directory containing spaces on Windows. + CIBW_ENVIRONMENT_WINDOWS: >- + PATH="C:\\Program Files\\PostgreSQL\\13\\bin;$PATH" + # Set BUILD_TIME to the output of the `date` command CIBW_ENVIRONMENT: "BUILD_TIME=$(date)" From b306ab4ac7f77d4d88f2407509b2a467ce451556 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 19 Jul 2021 14:00:11 +0200 Subject: [PATCH 2/5] Simplify yaml env vars examples Don't use yaml double quotes because they imply a round of escaping (unlike single quotes or multiline strings). --- docs/options.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/options.md b/docs/options.md index c4dc99a4..132eecc3 100644 --- a/docs/options.md +++ b/docs/options.md @@ -494,23 +494,23 @@ Platform-specific environment variables are also available:
```yaml # Set some compiler flags - CIBW_ENVIRONMENT: "CFLAGS='-g -Wall' CXXFLAGS='-Wall'" + CIBW_ENVIRONMENT: CFLAGS='-g -Wall' CXXFLAGS='-Wall' # Append a directory to the PATH variable (this is expanded in the build environment) - CIBW_ENVIRONMENT: "PATH=$PATH:/usr/local/bin" + CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/bin # Prepend a directory containing spaces on Windows. CIBW_ENVIRONMENT_WINDOWS: >- PATH="C:\\Program Files\\PostgreSQL\\13\\bin;$PATH" # Set BUILD_TIME to the output of the `date` command - CIBW_ENVIRONMENT: "BUILD_TIME=$(date)" + CIBW_ENVIRONMENT: BUILD_TIME=$(date) # Supply options to `pip` to affect how it downloads dependencies - CIBW_ENVIRONMENT: "PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple" + CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple # Set two flags on linux only - CIBW_ENVIRONMENT_LINUX: "BUILD_TIME=$(date) SAMPLE_TEXT=\"sample text\"" + CIBW_ENVIRONMENT_LINUX: BUILD_TIME=$(date) SAMPLE_TEXT="sample text" ``` Separate multiple values with a space. From 3e712f1a6cf6c948f92f1c42fd4f0cca1025278c Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 19 Jul 2021 15:24:39 +0200 Subject: [PATCH 3/5] No need to strip trailing eol in multiline environment example --- docs/options.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/options.md b/docs/options.md index 132eecc3..239a50b8 100644 --- a/docs/options.md +++ b/docs/options.md @@ -500,7 +500,7 @@ Platform-specific environment variables are also available:
CIBW_ENVIRONMENT: PATH=$PATH:/usr/local/bin # Prepend a directory containing spaces on Windows. - CIBW_ENVIRONMENT_WINDOWS: >- + CIBW_ENVIRONMENT_WINDOWS: > PATH="C:\\Program Files\\PostgreSQL\\13\\bin;$PATH" # Set BUILD_TIME to the output of the `date` command From 976173f6e1c6bcfc1e41f05fcceeb9ad23c5de75 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 19 Jul 2021 17:13:40 +0200 Subject: [PATCH 4/5] Add example of Windows PATH manipulation in pyproject.toml too --- docs/options.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/options.md b/docs/options.md index 239a50b8..1d627c74 100644 --- a/docs/options.md +++ b/docs/options.md @@ -528,6 +528,10 @@ Platform-specific environment variables are also available:
# Append a directory to the PATH variable (this is expanded in the build environment) environment = { PATH="$PATH:/usr/local/bin" } + # Prepend a directory containing spaces on Windows. + [tool.cibuildwheel.windows] + environment = { PATH='C:\\Program Files\\PostgreSQL\\13\\bin;$PATH' } + # Set BUILD_TIME to the output of the `date` command environment = { BUILD_TIME="$(date)" } From 413c9f30dd52f8a2c4a27492dd676b113705e1f5 Mon Sep 17 00:00:00 2001 From: Daniele Varrazzo Date: Mon, 19 Jul 2021 17:14:04 +0200 Subject: [PATCH 5/5] Quote the $(date) in the yaml example for consistency with pyproject.toml --- docs/options.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/options.md b/docs/options.md index 1d627c74..f57b9a63 100644 --- a/docs/options.md +++ b/docs/options.md @@ -504,13 +504,13 @@ Platform-specific environment variables are also available:
PATH="C:\\Program Files\\PostgreSQL\\13\\bin;$PATH" # Set BUILD_TIME to the output of the `date` command - CIBW_ENVIRONMENT: BUILD_TIME=$(date) + CIBW_ENVIRONMENT: BUILD_TIME="$(date)" # Supply options to `pip` to affect how it downloads dependencies CIBW_ENVIRONMENT: PIP_EXTRA_INDEX_URL=https://pypi.myorg.com/simple # Set two flags on linux only - CIBW_ENVIRONMENT_LINUX: BUILD_TIME=$(date) SAMPLE_TEXT="sample text" + CIBW_ENVIRONMENT_LINUX: BUILD_TIME="$(date)" SAMPLE_TEXT="sample text" ``` Separate multiple values with a space.