From a104b491479199fe9650d4a3dd51071467e6c0cf Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:24:04 -0700 Subject: [PATCH 01/84] Started iqsharp recipe. --- conda-recipes/iqsharp/bld.bat | 1 + conda-recipes/iqsharp/build.ps1 | 41 +++++++++++++++++++++++++++++++++ conda-recipes/iqsharp/build.sh | 1 + conda-recipes/iqsharp/meta.yaml | 28 ++++++++++++++++++++++ 4 files changed, 71 insertions(+) create mode 100644 conda-recipes/iqsharp/bld.bat create mode 100644 conda-recipes/iqsharp/build.ps1 create mode 100644 conda-recipes/iqsharp/build.sh create mode 100644 conda-recipes/iqsharp/meta.yaml diff --git a/conda-recipes/iqsharp/bld.bat b/conda-recipes/iqsharp/bld.bat new file mode 100644 index 0000000000..2ed345f84c --- /dev/null +++ b/conda-recipes/iqsharp/bld.bat @@ -0,0 +1 @@ +pwsh iqsharp/conda-recipes/iqsharp/build.ps1 diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 new file mode 100644 index 0000000000..bef27505e2 --- /dev/null +++ b/conda-recipes/iqsharp/build.ps1 @@ -0,0 +1,41 @@ +#!/usr/bin/env pwsh +param( + [string] + $Configuration = "Release" +); + +if ($IsWindows) { + # NOTE: Building this package is ★only★ supported for Windows 10. + $RuntimeID = "win10-x$Env:ARCH"; +} elseif ($IsLinux) { + $RuntimeID = "linux-x$Env:ARCH"; +} elseif ($IsMacOS) { + $RuntimeID = "osx-x$Env:ARCH"; +} + +$TargetDirectory = (Join-Path $Env:PREFIX "iqsharp"); +$RepoRoot = Resolve-Path iqsharp; + +Write-Host "## Diagnostic Information ##" +@{ + "Prefix" = $Env:PREFIX; + "Runtime ID" = $RuntimeID; + "Target directory" = $TargetDirectory; + "Path to Jupyter" = (Get-Command jupyter -ErrorAction SilentlyContinue); + "Repo root" = $RepoRoot; +} | Format-Table | Write-Host + +Write-Host "## Building IQ#. ##" +Push-Location (Join-Path $RepoRoot src/Tool) + dotnet publish --self-contained -c $Configuration -r $RuntimeID -o $TargetDirectory +Pop-Location + +Write-Host "## Installing IQ# into Jupyter. ##" +Push-Location $TargetDirectory + $BaseName = "Microsoft.Quantum.IQSharp"; + if ($IsWindows) { + $BaseName = "${BaseName}.exe"; + } + $PathToTool = Resolve-Path "./$BaseName"; + & $PathToTool install --path-to-tool $PathToTool --sys-prefix +Pop-Location diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh new file mode 100644 index 0000000000..2ed345f84c --- /dev/null +++ b/conda-recipes/iqsharp/build.sh @@ -0,0 +1 @@ +pwsh iqsharp/conda-recipes/iqsharp/build.ps1 diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml new file mode 100644 index 0000000000..e40c7b7c4b --- /dev/null +++ b/conda-recipes/iqsharp/meta.yaml @@ -0,0 +1,28 @@ +package: + name: iqsharp + version: "0.8" + +source: + - path: ../../ + folder: iqsharp + +requirements: + build: + - python + - setuptools + # TODO: List dotnet-sdk as a build requirement. + # For now, we assume it is present locally + # (that is, not through conda). + # TODO: List pwsh as a build requirement. + - jupyter + + run: + - python + - jupyter + +# test: +# imports: +# - + +about: + home: https://docs.microsoft.com/quantum From fb7339a143e7990c60c3efd0b24874cb840e3ce5 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:24:19 -0700 Subject: [PATCH 02/84] Update Jupyter.Core dependency to get --sys-prefix. --- src/Jupyter/Jupyter.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Jupyter/Jupyter.csproj b/src/Jupyter/Jupyter.csproj index 6e31de6db4..e23dd034f6 100644 --- a/src/Jupyter/Jupyter.csproj +++ b/src/Jupyter/Jupyter.csproj @@ -22,7 +22,7 @@ - + From 820fe055cb1afd3467a1ca619fb5ef4816791abc Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:34:22 -0700 Subject: [PATCH 03/84] Started work on packing new recipe. --- build/pack.ps1 | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/build/pack.ps1 b/build/pack.ps1 index c4b272966d..246e922968 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -80,6 +80,25 @@ function Pack-Image() { } } +function Pack-CondaRecipe() { + param( + [string] $Path + ); + + if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { + Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` + "Will skip creation of conda package for $Path."; + return; + } + + conda build (Resolve-Path $Path); + + if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False + } +} + Write-Host "##[info]Packing IQ# library..." Pack-Nuget '../src/Core/Core.csproj' @@ -93,6 +112,9 @@ Pack-Wheel '../src/Python/' Write-Host "##[info]Packing Docker image..." Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' +Write-Host "##[info]Packing conda recipe..." +Pack-CondaRecipe -Path "../conda-recipes/iqsharp" + if (-not $all_ok) { throw "At least one package failed to build. Check the logs." } From 22426b6d1864d8ed074d0ca95b094b4e19a988cf Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:42:49 -0700 Subject: [PATCH 04/84] Modify steps to use conda env instead. --- build/steps.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/build/steps.yml b/build/steps.yml index c5ea8e6716..63253c1b55 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -6,12 +6,11 @@ steps: ## # Pre-reqs ## -- task: UsePythonVersion@0 +- task: CondaEnvironment@1 inputs: - versionSpec: '3.6' - architecture: 'x64' + packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" displayName: 'Use Python 3.6' - + - script: pip install setuptools wheel pytest jupyter displayName: 'Install Python tools' From 4b637967c5648009e64c36c50b8c744ee0a1c827 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:49:45 -0700 Subject: [PATCH 05/84] Remove redundant step. --- build/steps.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/build/steps.yml b/build/steps.yml index 63253c1b55..4ce13c10ea 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -11,9 +11,6 @@ steps: packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" displayName: 'Use Python 3.6' -- script: pip install setuptools wheel pytest jupyter - displayName: 'Install Python tools' - ## # Build, test & pack ## From 1c810890479ff5618b722598bab1e798caf0f0c2 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:50:05 -0700 Subject: [PATCH 06/84] Updated description. --- build/steps.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps.yml b/build/steps.yml index 4ce13c10ea..ca72059969 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -9,7 +9,7 @@ steps: - task: CondaEnvironment@1 inputs: packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" - displayName: 'Use Python 3.6' + displayName: 'Use conda environment w/ Python 3.6' ## # Build, test & pack From 51c3c0b732d5cfb2805c8ab960c67bd36acc972c Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 8 Aug 2019 17:58:17 -0700 Subject: [PATCH 07/84] Add conda package to drop. --- build/pack.ps1 | 4 +++- build/set-env.ps1 | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 246e922968..bd9306a7b8 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -93,9 +93,11 @@ function Pack-CondaRecipe() { conda build (Resolve-Path $Path); - if ($LastExitCode -ne 0) { + if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False + } else { + Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR; } } diff --git a/build/set-env.ps1 b/build/set-env.ps1 index bda149b02a..a40d4cdfbe 100644 --- a/build/set-env.ps1 +++ b/build/set-env.ps1 @@ -21,6 +21,9 @@ If (-not (Test-Path -Path $Env:NUGET_OUTDIR)) { [IO.Directory]::CreateDirectory( If ($Env:PYTHON_OUTDIR -eq $null) { $Env:PYTHON_OUTDIR = (Join-Path $Env:DROPS_DIR "wheels") } If (-not (Test-Path -Path $Env:PYTHON_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:PYTHON_OUTDIR) } +If ($Env:CONDA_OUTDIR -eq $null) { $Env:CONDA_OUTDIR = (Join-Path $Env:DROPS_DIR "conda") } +If (-not (Test-Path -Path $Env:CONDA_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:CONDA_OUTDIR) } + If ($Env:DOCS_OUTDIR -eq $null) { $Env:DOCS_OUTDIR = (Join-Path $Env:DROPS_DIR "docs") } If (-not (Test-Path -Path $Env:DOCS_OUTDIR)) { [IO.Directory]::CreateDirectory($Env:DOCS_OUTDIR) } From ab170a4fe115189ef8e2fcd19d6a0efffad92504 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 10:34:26 -0700 Subject: [PATCH 08/84] Some very painful shell scripting. --- conda-recipes/dotnetcore-sdk/bld.bat | 51 ++++++++++++++++++++++++++ conda-recipes/dotnetcore-sdk/build.sh | 39 ++++++++++++++++++++ conda-recipes/dotnetcore-sdk/meta.yaml | 14 +++++++ 3 files changed, 104 insertions(+) create mode 100644 conda-recipes/dotnetcore-sdk/bld.bat create mode 100644 conda-recipes/dotnetcore-sdk/build.sh create mode 100644 conda-recipes/dotnetcore-sdk/meta.yaml diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat new file mode 100644 index 0000000000..3e716eb1f3 --- /dev/null +++ b/conda-recipes/dotnetcore-sdk/bld.bat @@ -0,0 +1,51 @@ +set DOTNET_HOME=%PREFIX%\opt\dotnet + +@REM We use powershell.exe and not pwsh.exe to invoke the downloaded script, +@REM as we do not know whether or not the build agent has PowerShell 6 or later +@REM installed. +powershell.exe -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_HOME%" + +@REM We can save environment variables into the new package using the technique +@REM demonstrated at: +@REM https://github.com/conda-forge/staged-recipes/pull/2002/files +@REM We do so here to ensure that the new install of .NET Core SDK is added +@REM to %PATH%, and that the %DOTNET_HOME% variable is set for use with global +@REM tools. + +@REM Since the activate.d mechanism is shell-dependent, we will also need to +@REM provide activation and deactivation scripts for cmd.exe, PowerShell, and +@REM for POSIX-style shells. + +@REM In the future, we should transition this mechanism over to use what is +@REM implemented to resolve the shell-dependence of the current activate.d +@REM system. See also: +@REM https://github.com/conda/conda/issues/6820. + +set ACT_D=%PREFIX%\etc\conda\activate.d +md %ACT_D% +set DEACT_D=%PREFIX%\etc\conda\deactivate.d +md %DEACT_D% + +@REM -- cmd activation/deactivation -- +echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\dotnet_home.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_HOME=%%DOTNET_HOME%% >> %ACT_D%\dotnet_home.cmd +echo set DOTNET_HOME=%DOTNET_HOME% >> %ACT_D%\dotnet_home.cmd +echo set PATH=%PATH%;%DOTNET_HOME% >> %ACT_D%\dotnet_home.cmd +echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\dotnet_home.cmd +echo set DOTNET_HOME=%%_CONDA_PKG_BACKUP_DOTNET_HOME%% >> %DEACT_D%\dotnet_home.cmd + +@REM -- pwsh activation/deactivation -- +echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\dotnet_home.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_HOME = "$Env:DOTNET_HOME"; >> %ACT_D%\dotnet_home.ps1 +echo $Env:DOTNET_HOME = "%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.ps1 +echo $Env:PATH = "%PATH%;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.ps1 +echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\dotnet_home.ps1 +echo $Env:DOTNET_HOME = "$Env:_CONDA_PKG_BACKUP_DOTNET_HOME"; >> %DEACT_D%\dotnet_home.ps1 + +@REM -- posix-style activation/deactivation -- +echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_home.sh +echo export _CONDA_PKG_BACKUP_DOTNET_HOME="$DOTNET_HOME"; >> %ACT_D%\dotnet_home.sh +echo export DOTNET_HOME="%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh +echo export PATH="%PATH%;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh +echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_home.sh +echo export DOTNET_HOME="$_CONDA_PKG_BACKUP_DOTNET_HOME" >> %DEACT_D%\dotnet_home.sh diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh new file mode 100644 index 0000000000..a16f37a173 --- /dev/null +++ b/conda-recipes/dotnetcore-sdk/build.sh @@ -0,0 +1,39 @@ +DOTNET_HOME=$PREFIX/opt/dotnet +/bin/sh ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_HOME + +# We can save environment variables into the new package using the technique +# demonstrated at: +# https://github.com/conda-forge/staged-recipes/pull/2002/files +# We do so here to ensure that the new install of .NET Core SDK is added +# to %PATH%, and that the %DOTNET_HOME% variable is set for use with global +# tools. + +# Since the activate.d mechanism is shell-dependent, we will also need to +# provide activation and deactivation scripts for PowerShell and +# for POSIX-style shells. + +# In the future, we should transition this mechanism over to use what is +# implemented to resolve the shell-dependence of the current activate.d +# system. See also: +# https://github.com/conda/conda/issues/6820. + +ACT_D=$PREFIX/etc/conda/activate.d +mkdir -p $ACT_D +DEACT_D=$PREFIX/etc/conda/deactivate.d +mkdir -p $DEACT_D + +# -- pwsh activation/deactivation -- +echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME = \"\$Env:DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:DOTNET_HOME = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:PATH = \"$PATH:$DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.ps1 +echo "\$Env:DOTNET_HOME = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.ps1 + +# -- posix-style activation/deactivation -- +echo "export _CONDA_PKG_BACKUP_PATH=\"$PATH\";" >> $ACT_D/dotnet_home.sh +echo "export _CONDA_PKG_BACKUP_DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh +echo "export DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh +echo "export PATH=\"$PATH:$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh +echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.sh +echo "export DOTNET_HOME=\"\$_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.sh diff --git a/conda-recipes/dotnetcore-sdk/meta.yaml b/conda-recipes/dotnetcore-sdk/meta.yaml new file mode 100644 index 0000000000..cbaa899914 --- /dev/null +++ b/conda-recipes/dotnetcore-sdk/meta.yaml @@ -0,0 +1,14 @@ +package: + name: dotnetcore-sdk + version: "2.2.401" + +source: + - url: https://dot.net/v1/dotnet-install.sh # [not win] + - url: https://dot.net/v1/dotnet-install.ps1 # [win] + +# test: +# imports: +# - + +about: + home: https://docs.microsoft.com/dotnet/core/ From 78587b60c78a0d67f02ecab2a7c04bb733c9a9b5 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 10:34:44 -0700 Subject: [PATCH 09/84] Move iqsharp conda install to opt. --- conda-recipes/iqsharp/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index bef27505e2..e28fa2ece8 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -13,7 +13,7 @@ if ($IsWindows) { $RuntimeID = "osx-x$Env:ARCH"; } -$TargetDirectory = (Join-Path $Env:PREFIX "iqsharp"); +$TargetDirectory = (Join-Path $Env:PREFIX "opt" "iqsharp"); $RepoRoot = Resolve-Path iqsharp; Write-Host "## Diagnostic Information ##" From 614bcda75c8989acbf073bc076ef2647936a1423 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:10:04 -0700 Subject: [PATCH 10/84] Fix order in which we add to path. --- conda-recipes/dotnetcore-sdk/bld.bat | 29 +++++++++++++++++++-------- conda-recipes/dotnetcore-sdk/build.sh | 6 +++--- 2 files changed, 24 insertions(+), 11 deletions(-) diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat index 3e716eb1f3..695ab94644 100644 --- a/conda-recipes/dotnetcore-sdk/bld.bat +++ b/conda-recipes/dotnetcore-sdk/bld.bat @@ -21,6 +21,13 @@ powershell.exe -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -In @REM system. See also: @REM https://github.com/conda/conda/issues/6820. +@REM Known issues: +@REM - Does not support recursive entry into environments, as the +@REM _CONDA_PKG_BACKUP_* variables are overwritten by activate.d calls. +@REM - POSIX-style shells are not yet supported on Windows, as it is not clear +@REM how to convert Windows paths visible to cmd.exe to a format expected by +@REM Git Bash or msys2 bash. + set ACT_D=%PREFIX%\etc\conda\activate.d md %ACT_D% set DEACT_D=%PREFIX%\etc\conda\deactivate.d @@ -30,22 +37,28 @@ md %DEACT_D% echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\dotnet_home.cmd echo set _CONDA_PKG_BACKUP_DOTNET_HOME=%%DOTNET_HOME%% >> %ACT_D%\dotnet_home.cmd echo set DOTNET_HOME=%DOTNET_HOME% >> %ACT_D%\dotnet_home.cmd -echo set PATH=%PATH%;%DOTNET_HOME% >> %ACT_D%\dotnet_home.cmd +echo set PATH=%DOTNET_HOME%;%%PATH%% >> %ACT_D%\dotnet_home.cmd echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\dotnet_home.cmd echo set DOTNET_HOME=%%_CONDA_PKG_BACKUP_DOTNET_HOME%% >> %DEACT_D%\dotnet_home.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_HOME= >> %DEACT_D%\dotnet_home.cmd +echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\dotnet_home.cmd @REM -- pwsh activation/deactivation -- echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\dotnet_home.ps1 echo $Env:_CONDA_PKG_BACKUP_DOTNET_HOME = "$Env:DOTNET_HOME"; >> %ACT_D%\dotnet_home.ps1 echo $Env:DOTNET_HOME = "%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.ps1 -echo $Env:PATH = "%PATH%;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.ps1 +echo $Env:PATH = "%DOTNET_HOME%;$Env:PATH"; >> %ACT_D%\dotnet_home.ps1 echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\dotnet_home.ps1 echo $Env:DOTNET_HOME = "$Env:_CONDA_PKG_BACKUP_DOTNET_HOME"; >> %DEACT_D%\dotnet_home.ps1 +echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\dotnet_home.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_HOME = $null; >> %DEACT_D%\dotnet_home.ps1 @REM -- posix-style activation/deactivation -- -echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_home.sh -echo export _CONDA_PKG_BACKUP_DOTNET_HOME="$DOTNET_HOME"; >> %ACT_D%\dotnet_home.sh -echo export DOTNET_HOME="%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh -echo export PATH="%PATH%;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh -echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_home.sh -echo export DOTNET_HOME="$_CONDA_PKG_BACKUP_DOTNET_HOME" >> %DEACT_D%\dotnet_home.sh +@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_home.sh +@REM echo export _CONDA_PKG_BACKUP_DOTNET_HOME="$DOTNET_HOME"; >> %ACT_D%\dotnet_home.sh +@REM echo export DOTNET_HOME="%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh +@REM echo export PATH="$PATH;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh +@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_home.sh +@REM echo export DOTNET_HOME="$_CONDA_PKG_BACKUP_DOTNET_HOME" >> %DEACT_D%\dotnet_home.sh +@REM echo unset _CONDA_PKG_BACKUP_DOTNET_HOME >> %DEACT_D%\dotnet_home.sh +@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\dotnet_home.sh diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh index a16f37a173..62dc4578e8 100644 --- a/conda-recipes/dotnetcore-sdk/build.sh +++ b/conda-recipes/dotnetcore-sdk/build.sh @@ -26,14 +26,14 @@ mkdir -p $DEACT_D echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME = \"\$Env:DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:DOTNET_HOME = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:PATH = \"$PATH:$DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:PATH = \"\$DOTNET_HOME:$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.ps1 echo "\$Env:DOTNET_HOME = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.ps1 # -- posix-style activation/deactivation -- -echo "export _CONDA_PKG_BACKUP_PATH=\"$PATH\";" >> $ACT_D/dotnet_home.sh +echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/dotnet_home.sh echo "export _CONDA_PKG_BACKUP_DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh echo "export DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh -echo "export PATH=\"$PATH:$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh +echo "export PATH=\"\$DOTNET_HOME:$PATH\";" >> $ACT_D/dotnet_home.sh echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.sh echo "export DOTNET_HOME=\"\$_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.sh From 72146b2ad36c7a9e3585ab9f1a37b0ae315d171e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:33:10 -0700 Subject: [PATCH 11/84] Fix some bugs building dotnetcore-sdk from Linux. --- conda-recipes/dotnetcore-sdk/build.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh index 62dc4578e8..dbf0e3e9a6 100644 --- a/conda-recipes/dotnetcore-sdk/build.sh +++ b/conda-recipes/dotnetcore-sdk/build.sh @@ -1,5 +1,7 @@ DOTNET_HOME=$PREFIX/opt/dotnet -/bin/sh ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_HOME +# The dotnet-install script uses non-POSIX compilant set commands, so we need +# to explicitly use bash. +/bin/bash ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_HOME # We can save environment variables into the new package using the technique # demonstrated at: @@ -26,7 +28,7 @@ mkdir -p $DEACT_D echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME = \"\$Env:DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:DOTNET_HOME = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:PATH = \"\$DOTNET_HOME:$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 +echo "\$Env:PATH = \"$DOTNET_HOME:\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.ps1 echo "\$Env:DOTNET_HOME = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.ps1 @@ -34,6 +36,6 @@ echo "\$Env:DOTNET_HOME = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/ echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/dotnet_home.sh echo "export _CONDA_PKG_BACKUP_DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh echo "export DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh -echo "export PATH=\"\$DOTNET_HOME:$PATH\";" >> $ACT_D/dotnet_home.sh +echo "export PATH=\"$DOTNET_HOME:\$PATH\";" >> $ACT_D/dotnet_home.sh echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.sh echo "export DOTNET_HOME=\"\$_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.sh From 56296928904818a4d9ba79a8f8cc95b50ad7db97 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:33:26 -0700 Subject: [PATCH 12/84] Use powershell instead of pwsh when building from Windows. --- conda-recipes/iqsharp/bld.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/bld.bat b/conda-recipes/iqsharp/bld.bat index 2ed345f84c..09ff6eb218 100644 --- a/conda-recipes/iqsharp/bld.bat +++ b/conda-recipes/iqsharp/bld.bat @@ -1 +1 @@ -pwsh iqsharp/conda-recipes/iqsharp/build.ps1 +powershell -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 From 0c2c32bfae3eeb269fda73e1525d743d8c0d0512 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:33:48 -0700 Subject: [PATCH 13/84] Suppress profile when building iqsharp on POSIX. --- conda-recipes/iqsharp/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh index 2ed345f84c..6ce2fac1e3 100644 --- a/conda-recipes/iqsharp/build.sh +++ b/conda-recipes/iqsharp/build.sh @@ -1 +1 @@ -pwsh iqsharp/conda-recipes/iqsharp/build.ps1 +pwsh -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 From fa9e256ff8bd3ffb4a03ab0c0800d9c6f06707e8 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:34:03 -0700 Subject: [PATCH 14/84] Made pwsh dependency from iqsharp POSIX-only. --- conda-recipes/iqsharp/meta.yaml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index e40c7b7c4b..e3f050f96f 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -10,10 +10,8 @@ requirements: build: - python - setuptools - # TODO: List dotnet-sdk as a build requirement. - # For now, we assume it is present locally - # (that is, not through conda). - # TODO: List pwsh as a build requirement. + - dotnetcore-sdk=2.2.401 + - pwsh>=6.2.2 # [not win] - jupyter run: From 2fe1e672141f6637299fbedc93a3da2743978b64 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:35:46 -0700 Subject: [PATCH 15/84] Started working on pwsh package. --- conda-recipes/pwsh/build.sh | 1 + conda-recipes/pwsh/meta.yaml | 13 +++++++++++++ 2 files changed, 14 insertions(+) create mode 100644 conda-recipes/pwsh/build.sh create mode 100644 conda-recipes/pwsh/meta.yaml diff --git a/conda-recipes/pwsh/build.sh b/conda-recipes/pwsh/build.sh new file mode 100644 index 0000000000..ef215f400f --- /dev/null +++ b/conda-recipes/pwsh/build.sh @@ -0,0 +1 @@ +dotnet tool install PowerShell --tool-path $PREFIX/bin --version $PKG_VERSION diff --git a/conda-recipes/pwsh/meta.yaml b/conda-recipes/pwsh/meta.yaml new file mode 100644 index 0000000000..1ad1da578a --- /dev/null +++ b/conda-recipes/pwsh/meta.yaml @@ -0,0 +1,13 @@ +package: + name: pwsh + version: "6.2.2" + +requirements: + build: + - dotnetcore-sdk + + run: + - dotnetcore-sdk + +about: + home: https://docs.microsoft.com/dotnet/core/ From 21f4b6e5eebab5b015c6fc39aaa4c5f9a77af6d9 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:36:44 -0700 Subject: [PATCH 16/84] Only pack pwsh on non-Windows hosts. --- build/pack.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index bd9306a7b8..9d48b6dcd0 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -114,7 +114,11 @@ Pack-Wheel '../src/Python/' Write-Host "##[info]Packing Docker image..." Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' -Write-Host "##[info]Packing conda recipe..." +Write-Host "##[info]Packing conda recipes..." +Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" +if (-not $IsWindows) { + Pack-CondaRecipe -Path "../conda-recipes/pwsh" +} Pack-CondaRecipe -Path "../conda-recipes/iqsharp" if (-not $all_ok) { From 5cf641ad52b0912129539ab684157428aee80a12 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 11:49:19 -0700 Subject: [PATCH 17/84] Prevent pwsh from capturing NuGet cache. --- conda-recipes/pwsh/build.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/conda-recipes/pwsh/build.sh b/conda-recipes/pwsh/build.sh index ef215f400f..2036fcab08 100644 --- a/conda-recipes/pwsh/build.sh +++ b/conda-recipes/pwsh/build.sh @@ -1 +1,6 @@ +# The user may not have run .NET Core SDK before, so we disable first-time +# experience to avoid capturing the NuGet cache. +export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true +export NUGET_XMLDOC_MODE=skip + dotnet tool install PowerShell --tool-path $PREFIX/bin --version $PKG_VERSION From a3eeb5f8b174ca5b9b0e9e7cb9efb9716e2bd828 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 12:08:10 -0700 Subject: [PATCH 18/84] Fix PowerShell 5.1 vs 6.2 issues. --- conda-recipes/iqsharp/build.ps1 | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index e28fa2ece8..b2d3e11084 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -13,7 +13,10 @@ if ($IsWindows) { $RuntimeID = "osx-x$Env:ARCH"; } -$TargetDirectory = (Join-Path $Env:PREFIX "opt" "iqsharp"); +# On PowerShell 6 (Core) and later, Join-Path takes multiple child paths, +# but we don't use that for compatability with Windows PowerShell (5.1 and +# earlier). +$TargetDirectory = (Join-Path (Join-Path $Env:PREFIX "opt") "iqsharp"); $RepoRoot = Resolve-Path iqsharp; Write-Host "## Diagnostic Information ##" @@ -23,7 +26,7 @@ Write-Host "## Diagnostic Information ##" "Target directory" = $TargetDirectory; "Path to Jupyter" = (Get-Command jupyter -ErrorAction SilentlyContinue); "Repo root" = $RepoRoot; -} | Format-Table | Write-Host +} | Format-Table | Out-String | Write-Host Write-Host "## Building IQ#. ##" Push-Location (Join-Path $RepoRoot src/Tool) From 36030bbe613b5cfee46695839aff95681663ce8c Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 12:08:53 -0700 Subject: [PATCH 19/84] Fixed name of DOTNET_ROOT env var. --- conda-recipes/dotnetcore-sdk/bld.bat | 54 +++++++++++++-------------- conda-recipes/dotnetcore-sdk/build.sh | 30 +++++++-------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat index 695ab94644..898871a946 100644 --- a/conda-recipes/dotnetcore-sdk/bld.bat +++ b/conda-recipes/dotnetcore-sdk/bld.bat @@ -1,15 +1,15 @@ -set DOTNET_HOME=%PREFIX%\opt\dotnet +set DOTNET_ROOT=%PREFIX%\opt\dotnet @REM We use powershell.exe and not pwsh.exe to invoke the downloaded script, @REM as we do not know whether or not the build agent has PowerShell 6 or later @REM installed. -powershell.exe -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_HOME%" +powershell.exe -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_ROOT%" @REM We can save environment variables into the new package using the technique @REM demonstrated at: @REM https://github.com/conda-forge/staged-recipes/pull/2002/files @REM We do so here to ensure that the new install of .NET Core SDK is added -@REM to %PATH%, and that the %DOTNET_HOME% variable is set for use with global +@REM to %PATH%, and that the %DOTNET_ROOT% variable is set for use with global @REM tools. @REM Since the activate.d mechanism is shell-dependent, we will also need to @@ -34,31 +34,31 @@ set DEACT_D=%PREFIX%\etc\conda\deactivate.d md %DEACT_D% @REM -- cmd activation/deactivation -- -echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\dotnet_home.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_HOME=%%DOTNET_HOME%% >> %ACT_D%\dotnet_home.cmd -echo set DOTNET_HOME=%DOTNET_HOME% >> %ACT_D%\dotnet_home.cmd -echo set PATH=%DOTNET_HOME%;%%PATH%% >> %ACT_D%\dotnet_home.cmd -echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\dotnet_home.cmd -echo set DOTNET_HOME=%%_CONDA_PKG_BACKUP_DOTNET_HOME%% >> %DEACT_D%\dotnet_home.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_HOME= >> %DEACT_D%\dotnet_home.cmd -echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\dotnet_home.cmd +echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\DOTNET_ROOT.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_ROOT=%%DOTNET_ROOT%% >> %ACT_D%\DOTNET_ROOT.cmd +echo set DOTNET_ROOT=%DOTNET_ROOT% >> %ACT_D%\DOTNET_ROOT.cmd +echo set PATH=%DOTNET_ROOT%;%%PATH%% >> %ACT_D%\DOTNET_ROOT.cmd +echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\DOTNET_ROOT.cmd +echo set DOTNET_ROOT=%%_CONDA_PKG_BACKUP_DOTNET_ROOT%% >> %DEACT_D%\DOTNET_ROOT.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_ROOT= >> %DEACT_D%\DOTNET_ROOT.cmd +echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\DOTNET_ROOT.cmd @REM -- pwsh activation/deactivation -- -echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\dotnet_home.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_HOME = "$Env:DOTNET_HOME"; >> %ACT_D%\dotnet_home.ps1 -echo $Env:DOTNET_HOME = "%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.ps1 -echo $Env:PATH = "%DOTNET_HOME%;$Env:PATH"; >> %ACT_D%\dotnet_home.ps1 -echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\dotnet_home.ps1 -echo $Env:DOTNET_HOME = "$Env:_CONDA_PKG_BACKUP_DOTNET_HOME"; >> %DEACT_D%\dotnet_home.ps1 -echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\dotnet_home.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_HOME = $null; >> %DEACT_D%\dotnet_home.ps1 +echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\DOTNET_ROOT.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = "$Env:DOTNET_ROOT"; >> %ACT_D%\DOTNET_ROOT.ps1 +echo $Env:DOTNET_ROOT = "%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.ps1 +echo $Env:PATH = "%DOTNET_ROOT%;$Env:PATH"; >> %ACT_D%\DOTNET_ROOT.ps1 +echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\DOTNET_ROOT.ps1 +echo $Env:DOTNET_ROOT = "$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT"; >> %DEACT_D%\DOTNET_ROOT.ps1 +echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\DOTNET_ROOT.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = $null; >> %DEACT_D%\DOTNET_ROOT.ps1 @REM -- posix-style activation/deactivation -- -@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_home.sh -@REM echo export _CONDA_PKG_BACKUP_DOTNET_HOME="$DOTNET_HOME"; >> %ACT_D%\dotnet_home.sh -@REM echo export DOTNET_HOME="%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh -@REM echo export PATH="$PATH;%DOTNET_HOME%"; >> %ACT_D%\dotnet_home.sh -@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_home.sh -@REM echo export DOTNET_HOME="$_CONDA_PKG_BACKUP_DOTNET_HOME" >> %DEACT_D%\dotnet_home.sh -@REM echo unset _CONDA_PKG_BACKUP_DOTNET_HOME >> %DEACT_D%\dotnet_home.sh -@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\dotnet_home.sh +@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\DOTNET_ROOT.sh +@REM echo export _CONDA_PKG_BACKUP_DOTNET_ROOT="$DOTNET_ROOT"; >> %ACT_D%\DOTNET_ROOT.sh +@REM echo export DOTNET_ROOT="%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.sh +@REM echo export PATH="$PATH;%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.sh +@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\DOTNET_ROOT.sh +@REM echo export DOTNET_ROOT="$_CONDA_PKG_BACKUP_DOTNET_ROOT" >> %DEACT_D%\DOTNET_ROOT.sh +@REM echo unset _CONDA_PKG_BACKUP_DOTNET_ROOT >> %DEACT_D%\DOTNET_ROOT.sh +@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\DOTNET_ROOT.sh diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh index dbf0e3e9a6..287a3f7e87 100644 --- a/conda-recipes/dotnetcore-sdk/build.sh +++ b/conda-recipes/dotnetcore-sdk/build.sh @@ -1,13 +1,13 @@ -DOTNET_HOME=$PREFIX/opt/dotnet +DOTNET_ROOT=$PREFIX/opt/dotnet # The dotnet-install script uses non-POSIX compilant set commands, so we need # to explicitly use bash. -/bin/bash ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_HOME +/bin/bash ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_ROOT # We can save environment variables into the new package using the technique # demonstrated at: # https://github.com/conda-forge/staged-recipes/pull/2002/files # We do so here to ensure that the new install of .NET Core SDK is added -# to %PATH%, and that the %DOTNET_HOME% variable is set for use with global +# to %PATH%, and that the %DOTNET_ROOT% variable is set for use with global # tools. # Since the activate.d mechanism is shell-dependent, we will also need to @@ -25,17 +25,17 @@ DEACT_D=$PREFIX/etc/conda/deactivate.d mkdir -p $DEACT_D # -- pwsh activation/deactivation -- -echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME = \"\$Env:DOTNET_HOME\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:DOTNET_HOME = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:PATH = \"$DOTNET_HOME:\$Env:PATH\";" >> $ACT_D/dotnet_home.ps1 -echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.ps1 -echo "\$Env:DOTNET_HOME = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.ps1 +echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/DOTNET_ROOT.ps1 +echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = \"\$Env:DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.ps1 +echo "\$Env:DOTNET_ROOT = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/DOTNET_ROOT.ps1 +echo "\$Env:PATH = \"$DOTNET_ROOT:\$Env:PATH\";" >> $ACT_D/DOTNET_ROOT.ps1 +echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/DOTNET_ROOT.ps1 +echo "\$Env:DOTNET_ROOT = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/DOTNET_ROOT.ps1 # -- posix-style activation/deactivation -- -echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/dotnet_home.sh -echo "export _CONDA_PKG_BACKUP_DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh -echo "export DOTNET_HOME=\"$DOTNET_HOME\";" >> $ACT_D/dotnet_home.sh -echo "export PATH=\"$DOTNET_HOME:\$PATH\";" >> $ACT_D/dotnet_home.sh -echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_home.sh -echo "export DOTNET_HOME=\"\$_CONDA_PKG_BACKUP_DOTNET_HOME\";" >> $DEACT_D/dotnet_home.sh +echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/DOTNET_ROOT.sh +echo "export _CONDA_PKG_BACKUP_DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.sh +echo "export DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.sh +echo "export PATH=\"$DOTNET_ROOT:\$PATH\";" >> $ACT_D/DOTNET_ROOT.sh +echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/DOTNET_ROOT.sh +echo "export DOTNET_ROOT=\"\$_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/DOTNET_ROOT.sh From 36dbe871ae5dfa5d26a47adb348324501b728f99 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 12:13:08 -0700 Subject: [PATCH 20/84] Fix Runtime ID check on PS 5.1. --- conda-recipes/iqsharp/build.ps1 | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index b2d3e11084..81c2d056bf 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -4,7 +4,9 @@ param( $Configuration = "Release" ); -if ($IsWindows) { +# On Windows PowerShell, we don't have the nice $IsWindows / $IsLinux / $IsMacOS +# variables. +if ($IsWindows -or ($PSVersionTable.PSEdition -eq "Desktop")) { # NOTE: Building this package is ★only★ supported for Windows 10. $RuntimeID = "win10-x$Env:ARCH"; } elseif ($IsLinux) { @@ -24,7 +26,7 @@ Write-Host "## Diagnostic Information ##" "Prefix" = $Env:PREFIX; "Runtime ID" = $RuntimeID; "Target directory" = $TargetDirectory; - "Path to Jupyter" = (Get-Command jupyter -ErrorAction SilentlyContinue); + "Path to Jupyter" = (Get-Command jupyter -ErrorAction SilentlyContinue).Source; "Repo root" = $RepoRoot; } | Format-Table | Out-String | Write-Host From 53a51691b5af56d11404b6d1e5ab88e3d5a946c5 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 16:15:40 -0700 Subject: [PATCH 21/84] Fix name of activation/deactivation scripts. --- conda-recipes/dotnetcore-sdk/bld.bat | 48 +++++++++++++-------------- conda-recipes/dotnetcore-sdk/build.sh | 24 +++++++------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat index 898871a946..451478f5e4 100644 --- a/conda-recipes/dotnetcore-sdk/bld.bat +++ b/conda-recipes/dotnetcore-sdk/bld.bat @@ -34,31 +34,31 @@ set DEACT_D=%PREFIX%\etc\conda\deactivate.d md %DEACT_D% @REM -- cmd activation/deactivation -- -echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\DOTNET_ROOT.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_ROOT=%%DOTNET_ROOT%% >> %ACT_D%\DOTNET_ROOT.cmd -echo set DOTNET_ROOT=%DOTNET_ROOT% >> %ACT_D%\DOTNET_ROOT.cmd -echo set PATH=%DOTNET_ROOT%;%%PATH%% >> %ACT_D%\DOTNET_ROOT.cmd -echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\DOTNET_ROOT.cmd -echo set DOTNET_ROOT=%%_CONDA_PKG_BACKUP_DOTNET_ROOT%% >> %DEACT_D%\DOTNET_ROOT.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_ROOT= >> %DEACT_D%\DOTNET_ROOT.cmd -echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\DOTNET_ROOT.cmd +echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\dotnet_root.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_ROOT=%%DOTNET_ROOT%% >> %ACT_D%\dotnet_root.cmd +echo set DOTNET_ROOT=%DOTNET_ROOT% >> %ACT_D%\dotnet_root.cmd +echo set PATH=%DOTNET_ROOT%;%%PATH%% >> %ACT_D%\dotnet_root.cmd +echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\dotnet_root.cmd +echo set DOTNET_ROOT=%%_CONDA_PKG_BACKUP_DOTNET_ROOT%% >> %DEACT_D%\dotnet_root.cmd +echo set _CONDA_PKG_BACKUP_DOTNET_ROOT= >> %DEACT_D%\dotnet_root.cmd +echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\dotnet_root.cmd @REM -- pwsh activation/deactivation -- -echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\DOTNET_ROOT.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = "$Env:DOTNET_ROOT"; >> %ACT_D%\DOTNET_ROOT.ps1 -echo $Env:DOTNET_ROOT = "%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.ps1 -echo $Env:PATH = "%DOTNET_ROOT%;$Env:PATH"; >> %ACT_D%\DOTNET_ROOT.ps1 -echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\DOTNET_ROOT.ps1 -echo $Env:DOTNET_ROOT = "$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT"; >> %DEACT_D%\DOTNET_ROOT.ps1 -echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\DOTNET_ROOT.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = $null; >> %DEACT_D%\DOTNET_ROOT.ps1 +echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\dotnet_root.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = "$Env:DOTNET_ROOT"; >> %ACT_D%\dotnet_root.ps1 +echo $Env:DOTNET_ROOT = "%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.ps1 +echo $Env:PATH = "%DOTNET_ROOT%;$Env:PATH"; >> %ACT_D%\dotnet_root.ps1 +echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\dotnet_root.ps1 +echo $Env:DOTNET_ROOT = "$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT"; >> %DEACT_D%\dotnet_root.ps1 +echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\dotnet_root.ps1 +echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = $null; >> %DEACT_D%\dotnet_root.ps1 @REM -- posix-style activation/deactivation -- -@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\DOTNET_ROOT.sh -@REM echo export _CONDA_PKG_BACKUP_DOTNET_ROOT="$DOTNET_ROOT"; >> %ACT_D%\DOTNET_ROOT.sh -@REM echo export DOTNET_ROOT="%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.sh -@REM echo export PATH="$PATH;%DOTNET_ROOT%"; >> %ACT_D%\DOTNET_ROOT.sh -@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\DOTNET_ROOT.sh -@REM echo export DOTNET_ROOT="$_CONDA_PKG_BACKUP_DOTNET_ROOT" >> %DEACT_D%\DOTNET_ROOT.sh -@REM echo unset _CONDA_PKG_BACKUP_DOTNET_ROOT >> %DEACT_D%\DOTNET_ROOT.sh -@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\DOTNET_ROOT.sh +@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_root.sh +@REM echo export _CONDA_PKG_BACKUP_DOTNET_ROOT="$DOTNET_ROOT"; >> %ACT_D%\dotnet_root.sh +@REM echo export DOTNET_ROOT="%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.sh +@REM echo export PATH="$PATH;%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.sh +@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_root.sh +@REM echo export DOTNET_ROOT="$_CONDA_PKG_BACKUP_DOTNET_ROOT" >> %DEACT_D%\dotnet_root.sh +@REM echo unset _CONDA_PKG_BACKUP_DOTNET_ROOT >> %DEACT_D%\dotnet_root.sh +@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\dotnet_root.sh diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh index 287a3f7e87..de5bd9d488 100644 --- a/conda-recipes/dotnetcore-sdk/build.sh +++ b/conda-recipes/dotnetcore-sdk/build.sh @@ -25,17 +25,17 @@ DEACT_D=$PREFIX/etc/conda/deactivate.d mkdir -p $DEACT_D # -- pwsh activation/deactivation -- -echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/DOTNET_ROOT.ps1 -echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = \"\$Env:DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.ps1 -echo "\$Env:DOTNET_ROOT = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/DOTNET_ROOT.ps1 -echo "\$Env:PATH = \"$DOTNET_ROOT:\$Env:PATH\";" >> $ACT_D/DOTNET_ROOT.ps1 -echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/DOTNET_ROOT.ps1 -echo "\$Env:DOTNET_ROOT = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/DOTNET_ROOT.ps1 +echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_root.ps1 +echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = \"\$Env:DOTNET_ROOT\";" >> $ACT_D/dotnet_root.ps1 +echo "\$Env:DOTNET_ROOT = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_root.ps1 +echo "\$Env:PATH = \"$DOTNET_ROOT:\$Env:PATH\";" >> $ACT_D/dotnet_root.ps1 +echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_root.ps1 +echo "\$Env:DOTNET_ROOT = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/dotnet_root.ps1 # -- posix-style activation/deactivation -- -echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/DOTNET_ROOT.sh -echo "export _CONDA_PKG_BACKUP_DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.sh -echo "export DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/DOTNET_ROOT.sh -echo "export PATH=\"$DOTNET_ROOT:\$PATH\";" >> $ACT_D/DOTNET_ROOT.sh -echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/DOTNET_ROOT.sh -echo "export DOTNET_ROOT=\"\$_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/DOTNET_ROOT.sh +echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/dotnet_root.sh +echo "export _CONDA_PKG_BACKUP_DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/dotnet_root.sh +echo "export DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/dotnet_root.sh +echo "export PATH=\"$DOTNET_ROOT:\$PATH\";" >> $ACT_D/dotnet_root.sh +echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_root.sh +echo "export DOTNET_ROOT=\"\$_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/dotnet_root.sh From e9858db903f0316e4b8a1d9ea180da5fb33e112e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 16:44:30 -0700 Subject: [PATCH 22/84] Force line endings to enable patching 10607. --- .gitattributes | 3 +++ conda-recipes/iqsharp/bug-10607-workaround.patch | 13 +++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 .gitattributes create mode 100644 conda-recipes/iqsharp/bug-10607-workaround.patch diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000000..8748e5be20 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +# Force line endings to be Unix style so that we can apply patch files. +src/Tool/Tool.csproj text eol=lf +conda-recipes/iqsharp/*.patch text eol=lf diff --git a/conda-recipes/iqsharp/bug-10607-workaround.patch b/conda-recipes/iqsharp/bug-10607-workaround.patch new file mode 100644 index 0000000000..cffc768555 --- /dev/null +++ b/conda-recipes/iqsharp/bug-10607-workaround.patch @@ -0,0 +1,13 @@ +diff --git a/src/Tool/Tool.csproj b/src/Tool/Tool.csproj +index a57eeee..7827aa3 100644 +--- a/src/Tool/Tool.csproj ++++ b/src/Tool/Tool.csproj +@@ -18,7 +18,7 @@ + https://github.com/Microsoft/Quantum + https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png + Quantum Q# Qsharp +- true ++ false + dotnet-iqsharp + Microsoft.Quantum.IQSharp + \ From f6fae69aeeeb1648f9344675ccd42ab39ffd089c Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 16:44:42 -0700 Subject: [PATCH 23/84] Add SHA256 sums. --- conda-recipes/dotnetcore-sdk/meta.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/conda-recipes/dotnetcore-sdk/meta.yaml b/conda-recipes/dotnetcore-sdk/meta.yaml index cbaa899914..b30dc57450 100644 --- a/conda-recipes/dotnetcore-sdk/meta.yaml +++ b/conda-recipes/dotnetcore-sdk/meta.yaml @@ -4,7 +4,9 @@ package: source: - url: https://dot.net/v1/dotnet-install.sh # [not win] + sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e - url: https://dot.net/v1/dotnet-install.ps1 # [win] + sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e # test: # imports: From 4a4f478293ee33a63f820744795f0e1978ec68a1 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 16:44:58 -0700 Subject: [PATCH 24/84] Build fixes for # [non win]. --- conda-recipes/iqsharp/build.ps1 | 23 +++++++++++++++++------ conda-recipes/iqsharp/build.sh | 2 +- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 81c2d056bf..92771dd8d7 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -4,9 +4,20 @@ param( $Configuration = "Release" ); +# The user may not have run .NET Core SDK before, so we disable first-time +# experience to avoid capturing the NuGet cache. +$Env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"; +$Env:NUGET_XMLDOC_MODE = "skip"; + # On Windows PowerShell, we don't have the nice $IsWindows / $IsLinux / $IsMacOS -# variables. -if ($IsWindows -or ($PSVersionTable.PSEdition -eq "Desktop")) { +# variables. Since Windows PowerShell is the only PowerShell variant that +# has "Desktop" as its PSEdition, we can check for that and create the +# $IsWindows variable if need be. +if ($PSVersionTable.PSEdition -eq "Desktop") { + $IsWindows = $true; +} + +if ($IsWindows) { # NOTE: Building this package is ★only★ supported for Windows 10. $RuntimeID = "win10-x$Env:ARCH"; } elseif ($IsLinux) { @@ -36,11 +47,11 @@ Push-Location (Join-Path $RepoRoot src/Tool) Pop-Location Write-Host "## Installing IQ# into Jupyter. ##" +$BaseName = "Microsoft.Quantum.IQSharp"; +if ($IsWindows) { + $BaseName = "${BaseName}.exe"; +} Push-Location $TargetDirectory - $BaseName = "Microsoft.Quantum.IQSharp"; - if ($IsWindows) { - $BaseName = "${BaseName}.exe"; - } $PathToTool = Resolve-Path "./$BaseName"; & $PathToTool install --path-to-tool $PathToTool --sys-prefix Pop-Location diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh index 6ce2fac1e3..2ed345f84c 100644 --- a/conda-recipes/iqsharp/build.sh +++ b/conda-recipes/iqsharp/build.sh @@ -1 +1 @@ -pwsh -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 +pwsh iqsharp/conda-recipes/iqsharp/build.ps1 From 505cc3eb58233853697583d94ce2cf554f94655e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 16:45:27 -0700 Subject: [PATCH 25/84] --- conda-recipes/iqsharp/meta.yaml | 19 ++++++++++++++++--- conda-recipes/iqsharp/test.ps1 | 13 +++++++++++++ 2 files changed, 29 insertions(+), 3 deletions(-) create mode 100644 conda-recipes/iqsharp/test.ps1 diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index e3f050f96f..38d6bc9442 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -5,6 +5,11 @@ package: source: - path: ../../ folder: iqsharp + patches: + # We need to disable true when publishing on macOS + # and Linux due to https://github.com/dotnet/cli/issues/10607. This should + # be resolved with .NET Core SDK 3.0 and later. + - bug-10607-workaround.patch # [not win] requirements: build: @@ -18,9 +23,17 @@ requirements: - python - jupyter -# test: -# imports: -# - +test: + requires: + - pwsh>=6.2.2 # [not win] + - jupyter + + source_files: + - test.ps1 + + commands: + - powershell -NoProfile test.ps1 # [win] + - pwsh test.ps1 # [not win] about: home: https://docs.microsoft.com/quantum diff --git a/conda-recipes/iqsharp/test.ps1 b/conda-recipes/iqsharp/test.ps1 new file mode 100644 index 0000000000..9b0686af87 --- /dev/null +++ b/conda-recipes/iqsharp/test.ps1 @@ -0,0 +1,13 @@ +$failed = $false; + +# Check that iqsharp is installed as a Jupyter kernel. +$kernels = jupyter kernelspec list --json | ConvertFrom-Json; +if ($null -eq $kernels.kernelspecs.iqsharp) { + $failed = $true; + Write-Error "IQ# not found in list of kernelspecs, found $($kernels.kernelspecs.PSObject.Properties.Name)." +} + +# If any tests failed, raise an error code. +if ($failed) { + return -1; +} From ac71c2a50d147a9c2211797ccf874f72ee0fc19a Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 17:12:21 -0700 Subject: [PATCH 26/84] Fixes to test. --- conda-recipes/iqsharp/meta.yaml | 6 +++--- conda-recipes/iqsharp/test.ps1 | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index 38d6bc9442..25f29d42aa 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -29,11 +29,11 @@ test: - jupyter source_files: - - test.ps1 + - iqsharp/conda-recipes/iqsharp/test.ps1 commands: - - powershell -NoProfile test.ps1 # [win] - - pwsh test.ps1 # [not win] + - powershell -NoProfile iqsharp/conda-recipes/iqsharp/test.ps1 # [win] + - pwsh iqsharp/conda-recipes/iqsharp/test.ps1 # [not win] about: home: https://docs.microsoft.com/quantum diff --git a/conda-recipes/iqsharp/test.ps1 b/conda-recipes/iqsharp/test.ps1 index 9b0686af87..cb0c3cc7f8 100644 --- a/conda-recipes/iqsharp/test.ps1 +++ b/conda-recipes/iqsharp/test.ps1 @@ -4,10 +4,11 @@ $failed = $false; $kernels = jupyter kernelspec list --json | ConvertFrom-Json; if ($null -eq $kernels.kernelspecs.iqsharp) { $failed = $true; - Write-Error "IQ# not found in list of kernelspecs, found $($kernels.kernelspecs.PSObject.Properties.Name)." + Write-Error "## TEST FAILED: IQ# not found in list of kernelspecs, see kernelspec list below." + jupyter kernelspec list } # If any tests failed, raise an error code. if ($failed) { - return -1; + exit -1; } From 55f35ad4ce2ae019618f49b52b70254bd7ab0e59 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 23:36:01 -0700 Subject: [PATCH 27/84] Fixed meta.yaml for windows. --- conda-recipes/dotnetcore-sdk/meta.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conda-recipes/dotnetcore-sdk/meta.yaml b/conda-recipes/dotnetcore-sdk/meta.yaml index b30dc57450..97fd269a7a 100644 --- a/conda-recipes/dotnetcore-sdk/meta.yaml +++ b/conda-recipes/dotnetcore-sdk/meta.yaml @@ -4,9 +4,9 @@ package: source: - url: https://dot.net/v1/dotnet-install.sh # [not win] - sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e + sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e # [not win] - url: https://dot.net/v1/dotnet-install.ps1 # [win] - sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e + sha256: a0b41e631cfd67cdf07a97a68be9b7da22df002a0e60110685c8a4ab5e2eb883 # [win] # test: # imports: From 539ea23e2812f6b1152ecc107a9dbc0c3bb7cd7f Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 23:36:10 -0700 Subject: [PATCH 28/84] Version bump --- NOTICE.txt | 2 +- src/Jupyter/Jupyter.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 6a85f2827d..b93806f68c 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -195,7 +195,7 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ------------------------------------------------------------------- -Microsoft.Jupyter.Core 1.1.14623 - MIT +Microsoft.Jupyter.Core 1.1.17470 - MIT (c) 2008 VeriSign, Inc. (c) Microsoft Corporation. Copyright (c) Microsoft Corporation. diff --git a/src/Jupyter/Jupyter.csproj b/src/Jupyter/Jupyter.csproj index e23dd034f6..b2e94b0b8b 100644 --- a/src/Jupyter/Jupyter.csproj +++ b/src/Jupyter/Jupyter.csproj @@ -22,7 +22,7 @@ - + From 0b463f7f90bc78e8fe867dc19c030918c8f47525 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 9 Aug 2019 23:36:23 -0700 Subject: [PATCH 29/84] Suppress posh profile on Windows. --- conda-recipes/dotnetcore-sdk/bld.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat index 451478f5e4..5395812a34 100644 --- a/conda-recipes/dotnetcore-sdk/bld.bat +++ b/conda-recipes/dotnetcore-sdk/bld.bat @@ -3,7 +3,7 @@ set DOTNET_ROOT=%PREFIX%\opt\dotnet @REM We use powershell.exe and not pwsh.exe to invoke the downloaded script, @REM as we do not know whether or not the build agent has PowerShell 6 or later @REM installed. -powershell.exe -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_ROOT%" +powershell.exe -NoProfile -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_ROOT%" @REM We can save environment variables into the new package using the technique @REM demonstrated at: From e30a049a63a8fcad30e0ab5c326123126b6790c0 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Sat, 10 Aug 2019 09:55:03 -0700 Subject: [PATCH 30/84] Fixed line endings in dotnet/cli#10607 workaround. --- .gitattributes | 3 -- conda-recipes/iqsharp/ToolStandalone.csproj | 45 +++++++++++++++++++ .../iqsharp/bug-10607-workaround.patch | 13 ------ conda-recipes/iqsharp/build.ps1 | 7 +++ conda-recipes/iqsharp/meta.yaml | 5 --- conda-recipes/iqsharp/test.ps1 | 2 + 6 files changed, 54 insertions(+), 21 deletions(-) delete mode 100644 .gitattributes create mode 100644 conda-recipes/iqsharp/ToolStandalone.csproj delete mode 100644 conda-recipes/iqsharp/bug-10607-workaround.patch diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 8748e5be20..0000000000 --- a/.gitattributes +++ /dev/null @@ -1,3 +0,0 @@ -# Force line endings to be Unix style so that we can apply patch files. -src/Tool/Tool.csproj text eol=lf -conda-recipes/iqsharp/*.patch text eol=lf diff --git a/conda-recipes/iqsharp/ToolStandalone.csproj b/conda-recipes/iqsharp/ToolStandalone.csproj new file mode 100644 index 0000000000..82937bede3 --- /dev/null +++ b/conda-recipes/iqsharp/ToolStandalone.csproj @@ -0,0 +1,45 @@ + + + + Exe + x64 + netcoreapp2.2 + Microsoft.Quantum.IQSharp + Microsoft.Quantum.IQSharp + + + + 0162 + Microsoft + Microsoft's IQ# Server. + © Microsoft Corporation. All rights reserved. + \ + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + diff --git a/conda-recipes/iqsharp/bug-10607-workaround.patch b/conda-recipes/iqsharp/bug-10607-workaround.patch deleted file mode 100644 index cffc768555..0000000000 --- a/conda-recipes/iqsharp/bug-10607-workaround.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/src/Tool/Tool.csproj b/src/Tool/Tool.csproj -index a57eeee..7827aa3 100644 ---- a/src/Tool/Tool.csproj -+++ b/src/Tool/Tool.csproj -@@ -18,7 +18,7 @@ - https://github.com/Microsoft/Quantum - https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png - Quantum Q# Qsharp -- true -+ false - dotnet-iqsharp - Microsoft.Quantum.IQSharp - \ diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 92771dd8d7..9b8b857ec3 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -34,6 +34,7 @@ $RepoRoot = Resolve-Path iqsharp; Write-Host "## Diagnostic Information ##" @{ + "Script root" = $PSScriptRoot; "Prefix" = $Env:PREFIX; "Runtime ID" = $RuntimeID; "Target directory" = $TargetDirectory; @@ -41,6 +42,12 @@ Write-Host "## Diagnostic Information ##" "Repo root" = $RepoRoot; } | Format-Table | Out-String | Write-Host +# We need to disable true when publishing +# due to https://github.com/dotnet/cli/issues/10607. This should +# be resolved with .NET Core SDK 3.0 and later. +Write-Host "## Patching IQ# for Standalone Deployment. ##" +Copy-Item (Join-Path $PSScriptRoot "ToolStandalone.csproj") (Join-Path (Join-Path (Join-Path $RepoRoot "src") "Tool") "Tool.csproj"); + Write-Host "## Building IQ#. ##" Push-Location (Join-Path $RepoRoot src/Tool) dotnet publish --self-contained -c $Configuration -r $RuntimeID -o $TargetDirectory diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index 25f29d42aa..d2dbd20b28 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -5,11 +5,6 @@ package: source: - path: ../../ folder: iqsharp - patches: - # We need to disable true when publishing on macOS - # and Linux due to https://github.com/dotnet/cli/issues/10607. This should - # be resolved with .NET Core SDK 3.0 and later. - - bug-10607-workaround.patch # [not win] requirements: build: diff --git a/conda-recipes/iqsharp/test.ps1 b/conda-recipes/iqsharp/test.ps1 index cb0c3cc7f8..92d4587248 100644 --- a/conda-recipes/iqsharp/test.ps1 +++ b/conda-recipes/iqsharp/test.ps1 @@ -11,4 +11,6 @@ if ($null -eq $kernels.kernelspecs.iqsharp) { # If any tests failed, raise an error code. if ($failed) { exit -1; +} else { + Write-Host "## ALL TESTS PASSED ##"; } From e6bf60992f4987d48c37d7fecaab533865f81242 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Sat, 10 Aug 2019 13:13:16 -0700 Subject: [PATCH 31/84] Pin versions in pwsh. --- conda-recipes/pwsh/meta.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conda-recipes/pwsh/meta.yaml b/conda-recipes/pwsh/meta.yaml index 1ad1da578a..191bbf6ca6 100644 --- a/conda-recipes/pwsh/meta.yaml +++ b/conda-recipes/pwsh/meta.yaml @@ -4,10 +4,10 @@ package: requirements: build: - - dotnetcore-sdk + - dotnetcore-sdk=2.2.401 run: - - dotnetcore-sdk + - dotnetcore-sdk=2.2.401 about: - home: https://docs.microsoft.com/dotnet/core/ + home: https://github.com/PowerShell/PowerShell From 2d80ecf7cb9d16623187814ad798d626127350c3 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Sat, 10 Aug 2019 13:13:33 -0700 Subject: [PATCH 32/84] Added slightly more tests to iqsharp package. --- conda-recipes/iqsharp/meta.yaml | 6 ++++++ conda-recipes/iqsharp/test.py | 17 +++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 conda-recipes/iqsharp/test.py diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index d2dbd20b28..d8fd216ba9 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -22,13 +22,19 @@ test: requires: - pwsh>=6.2.2 # [not win] - jupyter + - python>=3.6 + - jupyter_client + - pip source_files: - iqsharp/conda-recipes/iqsharp/test.ps1 + - iqsharp/conda-recipes/iqsharp/test.py commands: - powershell -NoProfile iqsharp/conda-recipes/iqsharp/test.ps1 # [win] - pwsh iqsharp/conda-recipes/iqsharp/test.ps1 # [not win] + - pip install jupyter_kernel_test + - python iqsharp/conda-recipes/iqsharp/test.py about: home: https://docs.microsoft.com/quantum diff --git a/conda-recipes/iqsharp/test.py b/conda-recipes/iqsharp/test.py new file mode 100644 index 0000000000..e704c8b572 --- /dev/null +++ b/conda-recipes/iqsharp/test.py @@ -0,0 +1,17 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. + +import unittest +import jupyter_kernel_test + +class MyKernelTests(jupyter_kernel_test.KernelTests): + # Required -------------------------------------- + + # The name identifying an installed kernel to run the tests against + kernel_name = "iqsharp" + + # language_info.name in a kernel_info_reply should match this + language_name = "qsharp" + +if __name__ == '__main__': + unittest.main() From 0fa785d39453183cc95c1c5dd149421d56b00752 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Mon, 12 Aug 2019 07:08:01 -0700 Subject: [PATCH 33/84] Use Jinja2 to handle IQ# version passed by set-env.ps1. --- conda-recipes/iqsharp/meta.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index d8fd216ba9..6731413675 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -1,6 +1,8 @@ +{% set version = environ.get('PYTHON_VERSION', '0.0.0.1') %} + package: name: iqsharp - version: "0.8" + version: "{{ version }}" source: - path: ../../ From d69051f2f1ff1f06f56c33af9c28a99392bffc0a Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Mon, 12 Aug 2019 07:08:11 -0700 Subject: [PATCH 34/84] Added qsharp package as well. --- conda-recipes/qsharp/build.ps1 | 7 +++++ conda-recipes/qsharp/meta.yaml | 47 ++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 conda-recipes/qsharp/build.ps1 create mode 100644 conda-recipes/qsharp/meta.yaml diff --git a/conda-recipes/qsharp/build.ps1 b/conda-recipes/qsharp/build.ps1 new file mode 100644 index 0000000000..4aeb3c0f94 --- /dev/null +++ b/conda-recipes/qsharp/build.ps1 @@ -0,0 +1,7 @@ +# We need to set the PYTHON_VERSION environment variable +# explicitly here, since conda-build doesn't by default pass +# environment variables from the host environment. +$Env:PYTHON_VERSION = $Env:PKG_VERSION +Push-Location src/src/Python/ + python setup.py install --prefix $Env:PREFIX +Pop-Location diff --git a/conda-recipes/qsharp/meta.yaml b/conda-recipes/qsharp/meta.yaml new file mode 100644 index 0000000000..d6746bdc54 --- /dev/null +++ b/conda-recipes/qsharp/meta.yaml @@ -0,0 +1,47 @@ +{% set version = environ.get('PYTHON_VERSION', '0.0.0.1') %} + +package: + name: qsharp + version: "{{ version }}" + +source: + - path: ../../ + folder: src + +requirements: + build: + - python + - setuptools + - jupyter + - jupyter_client + - iqsharp={{ version }} + - pwsh # [not win] + + run: + - python + - jupyter_client + - iqsharp + +build: + script: | + powershell -NoProfile src/conda-recipes/qsharp/build.ps1 # [win] + pwsh src/conda-recipes/qsharp/build.ps1 # [not win] + +# test: +# requires: +# - python +# - jupyter_client +# - iqsharp + +# source_files: +# - iqsharp/conda-recipes/iqsharp/test.ps1 +# - iqsharp/conda-recipes/iqsharp/test.py + +# commands: +# - powershell -NoProfile iqsharp/conda-recipes/iqsharp/test.ps1 # [win] +# - pwsh iqsharp/conda-recipes/iqsharp/test.ps1 # [not win] +# - pip install jupyter_kernel_test +# - python iqsharp/conda-recipes/iqsharp/test.py + +about: + home: https://docs.microsoft.com/quantum From ed87d4d5c5e0550c188573443ea1af1432b681be Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Mon, 12 Aug 2019 07:08:46 -0700 Subject: [PATCH 35/84] Added qsharp package to pack as well. --- build/pack.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pack.ps1 b/build/pack.ps1 index 9d48b6dcd0..1815cab700 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -120,6 +120,7 @@ if (-not $IsWindows) { Pack-CondaRecipe -Path "../conda-recipes/pwsh" } Pack-CondaRecipe -Path "../conda-recipes/iqsharp" +Pack-CondaRecipe -Path "../conda-recipes/qsharp" if (-not $all_ok) { throw "At least one package failed to build. Check the logs." From 1ce876d62e0e0107a5debb0f7bda7d3d9e39e2a3 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Fri, 16 Aug 2019 15:19:25 -0700 Subject: [PATCH 36/84] macOS fixes --- conda-recipes/iqsharp/build.ps1 | 17 +++++++++++++++-- conda-recipes/iqsharp/build.sh | 7 ++++++- conda-recipes/pwsh/meta.yaml | 5 +++++ 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 9b8b857ec3..9f5d626132 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -1,9 +1,21 @@ #!/usr/bin/env pwsh param( [string] - $Configuration = "Release" + $Configuration = "Release", + + [string] + $DotNetPath = $null ); +# If we weren't given a path, find dotnet now. +if ($null -eq $DotNetPath) { + $DotNetPath = (Get-Command dotnet).Source; + if ($DotNetPath -eq $null) { + Write-Error "Could not find .NET Core SDK. This should never happen." + exit -1; + } +} + # The user may not have run .NET Core SDK before, so we disable first-time # experience to avoid capturing the NuGet cache. $Env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"; @@ -34,6 +46,7 @@ $RepoRoot = Resolve-Path iqsharp; Write-Host "## Diagnostic Information ##" @{ + "Path to .NET Core SDK" = $DotNetPath; "Script root" = $PSScriptRoot; "Prefix" = $Env:PREFIX; "Runtime ID" = $RuntimeID; @@ -50,7 +63,7 @@ Copy-Item (Join-Path $PSScriptRoot "ToolStandalone.csproj") (Join-Path (Join-Pat Write-Host "## Building IQ#. ##" Push-Location (Join-Path $RepoRoot src/Tool) - dotnet publish --self-contained -c $Configuration -r $RuntimeID -o $TargetDirectory + & $DotNetPath publish --self-contained -c $Configuration -r $RuntimeID -o $TargetDirectory Pop-Location Write-Host "## Installing IQ# into Jupyter. ##" diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh index 2ed345f84c..2c9c8b0ed8 100644 --- a/conda-recipes/iqsharp/build.sh +++ b/conda-recipes/iqsharp/build.sh @@ -1 +1,6 @@ -pwsh iqsharp/conda-recipes/iqsharp/build.ps1 +echo "Using $(which pwsh) to run build.ps1" +echo "Using .NET Core SDK at $(which dotnet)" +# We need to pass the path to dotnet manually on macOS, +# as the path environment variable is sometimes clobbered when +# running the build script. +pwsh iqsharp/conda-recipes/iqsharp/build.ps1 -DotNetPath "$(which dotnet)" diff --git a/conda-recipes/pwsh/meta.yaml b/conda-recipes/pwsh/meta.yaml index 191bbf6ca6..b210ef6468 100644 --- a/conda-recipes/pwsh/meta.yaml +++ b/conda-recipes/pwsh/meta.yaml @@ -2,6 +2,11 @@ package: name: pwsh version: "6.2.2" +build: + detect_binary_files_with_prefix: False + ignore_prefix_files: + - libmi.dylib + requirements: build: - dotnetcore-sdk=2.2.401 From 23145de9d08f470b186c9aa006597f060812c2f3 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 18:20:10 -0700 Subject: [PATCH 37/84] Fix some metadata. --- conda-recipes/iqsharp/meta.yaml | 4 ++++ conda-recipes/qsharp/meta.yaml | 3 +++ src/Python/README.md | 9 ++++++++- src/Python/setup.py | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index 6731413675..af69113eed 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -40,3 +40,7 @@ test: about: home: https://docs.microsoft.com/quantum + license: MIT + summary: Microsoft's IQ# Server. + dev_url: https://github.com/microsoft/iqsharp + diff --git a/conda-recipes/qsharp/meta.yaml b/conda-recipes/qsharp/meta.yaml index d6746bdc54..4e2a3b45cf 100644 --- a/conda-recipes/qsharp/meta.yaml +++ b/conda-recipes/qsharp/meta.yaml @@ -45,3 +45,6 @@ build: about: home: https://docs.microsoft.com/quantum + license: MIT + summary: Python client for Q#, a domain-specific quantum programming language + dev_url: https://github.com/microsoft/iqsharp diff --git a/src/Python/README.md b/src/Python/README.md index df96c665c7..6c30c05499 100644 --- a/src/Python/README.md +++ b/src/Python/README.md @@ -4,6 +4,14 @@ The `qsharp` package for Python provides interoperability with the Quantum Devel For details on how to get started with Python and Q#, please see the [Getting Started with Python guide](https://docs.microsoft.com/quantum/install-guide/python). +## Installing with Anaconda ## + +If you use Anaconda or Miniconda, installing the `qsharp` package will automatically include all dependencies: + +```bash +conda install -c quantum-engineering qsharp +``` + ## Installing from Source ## If you'd like to contribute to or experiment with the Python interoperability feature, it may be useful to install from source rather than from the `qsharp` package on the Python Package Index (PyPI). @@ -19,7 +27,6 @@ python setup.py install The Python interoperability feature uses a standard `setuptools`-based packaging strategy. To build a platform-independent wheel, run the setup script with `bdist_wheel` instead: - ```bash cd iqsharp/src/Python/ python setup.py bdist_wheel diff --git a/src/Python/setup.py b/src/Python/setup.py index ec12b3f0a3..af29234555 100644 --- a/src/Python/setup.py +++ b/src/Python/setup.py @@ -50,7 +50,7 @@ description="Python client for Q#, a domain-specific quantum programming language", long_description=long_description, long_description_content_type="text/markdown", - url="https://github.com/Quantum/QuantumLibraries", + url="https://github.com/microsoft/iqsharp", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", From 45596a45acd98dd392c0db3251dfbd4b59f3817e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 18:39:59 -0700 Subject: [PATCH 38/84] Extended build definition for xplat conda build. --- build/ci.yml | 28 ++++++++++++++++++++++++++++ build/pack.ps1 | 27 ++++++++++++++++++--------- build/steps.yml | 20 ++++++++++++-------- 3 files changed, 58 insertions(+), 17 deletions(-) diff --git a/build/ci.yml b/build/ci.yml index d5d8fd387c..bd1de77917 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -9,8 +9,36 @@ variables: jobs: - job: "iqsharp" + pool: + vmImage: ubuntu-16.04 steps: - template: steps.yml + parameters: + onlyConda: "false" + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Detection' + inputs: + failOnAlert: true + +- job: "pack-conda-macos" + pool: + vmImage: macOS-10.14 + steps: + - template: steps.yml + parameters: + onlyConda: "true" + - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 + displayName: 'Component Detection' + inputs: + failOnAlert: true + +- job: "pack-conda-win" + pool: + vmImage: windows-2019 + steps: + - template: steps.yml + parameters: + onlyConda: "true" - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' inputs: diff --git a/build/pack.ps1 b/build/pack.ps1 index 1815cab700..733fecd7de 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -1,6 +1,11 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. +param( + [switch] + $OnlyConda = $false +); + $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" @@ -101,18 +106,22 @@ function Pack-CondaRecipe() { } } -Write-Host "##[info]Packing IQ# library..." -Pack-Nuget '../src/Core/Core.csproj' +if (-not $OnlyConda.IsPresent) { + + Write-Host "##[info]Packing IQ# library..." + Pack-Nuget '../src/Core/Core.csproj' -Write-Host "##[info]Packing IQ# tool..." -Pack-Nuget '../src/Tool/Tool.csproj' + Write-Host "##[info]Packing IQ# tool..." + Pack-Nuget '../src/Tool/Tool.csproj' -Write-Host "##[info]Packing Python wheel..." -python --version -Pack-Wheel '../src/Python/' + Write-Host "##[info]Packing Python wheel..." + python --version + Pack-Wheel '../src/Python/' -Write-Host "##[info]Packing Docker image..." -Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' + Write-Host "##[info]Packing Docker image..." + Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' + +} Write-Host "##[info]Packing conda recipes..." Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" diff --git a/build/steps.yml b/build/steps.yml index ca72059969..a8b97ca082 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -1,6 +1,9 @@ ## # Build and test IQ#. ## +parameters: + onlyConda: "false" + steps: ## @@ -14,14 +17,15 @@ steps: ## # Build, test & pack ## -- powershell: .\build.ps1 - displayName: "Building IQ#" - workingDirectory: '$(System.DefaultWorkingDirectory)/build' +- ${{ if eq(parameters.onlyConda, 'false') }}: + - powershell: .\build.ps1 + displayName: "Building IQ#" + workingDirectory: '$(System.DefaultWorkingDirectory)/build' -- powershell: .\test.ps1 - displayName: "Testing IQ#" - workingDirectory: '$(System.DefaultWorkingDirectory)/build' - condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) + - powershell: .\test.ps1 + displayName: "Testing IQ#" + workingDirectory: '$(System.DefaultWorkingDirectory)/build' + condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) - powershell: .\pack.ps1 displayName: "Packing IQ#" @@ -43,4 +47,4 @@ steps: condition: succeededOrFailed() inputs: PathtoPublish: '$(Build.ArtifactStagingDirectory)' - artifactName: iqsharp \ No newline at end of file + artifactName: iqsharp From 5000926edb27cf398e7ddb38da238d402b27d2c1 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 18:41:39 -0700 Subject: [PATCH 39/84] Renamed xplat conda build jobs. --- build/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/ci.yml b/build/ci.yml index bd1de77917..a57af26e90 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -20,7 +20,7 @@ jobs: inputs: failOnAlert: true -- job: "pack-conda-macos" +- job: "pack_conda_macos" pool: vmImage: macOS-10.14 steps: @@ -32,7 +32,7 @@ jobs: inputs: failOnAlert: true -- job: "pack-conda-win" +- job: "pack_conda_win" pool: vmImage: windows-2019 steps: From 8c8039fcfb40cf7cf1cde6d40d6153861f98da59 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 18:47:24 -0700 Subject: [PATCH 40/84] Propagate step template parameter into env. --- build/pack.ps1 | 8 +------- build/steps.yml | 2 ++ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 733fecd7de..754a245429 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -1,11 +1,5 @@ # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. - -param( - [switch] - $OnlyConda = $false -); - $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" @@ -106,7 +100,7 @@ function Pack-CondaRecipe() { } } -if (-not $OnlyConda.IsPresent) { +if ("true" -eq $Env:ONLY_CONDA) { Write-Host "##[info]Packing IQ# library..." Pack-Nuget '../src/Core/Core.csproj' diff --git a/build/steps.yml b/build/steps.yml index a8b97ca082..590689018d 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -30,6 +30,8 @@ steps: - powershell: .\pack.ps1 displayName: "Packing IQ#" workingDirectory: '$(System.DefaultWorkingDirectory)/build' + env: + ONLY_CONDA: ${{ parameters.onlyConda }} ## # Publish tests results and build artifacts. From 1c72a996730bd9b2aafa1817deadefdf35090e0d Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 19:01:41 -0700 Subject: [PATCH 41/84] Adding more detail to pack diagnostics. --- build/pack.ps1 | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 754a245429..83691400f1 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -4,6 +4,25 @@ $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" $all_ok = $True +$LogGuid = New-Guid; + +if ("true" -ne $Env:ONLY_CONDA) { + Write-Host "##vso[task.logdetail id=$LogGuid;name=iqsharp;type=build;order=1]Packing IQ# (only conda)" +} else { + Write-Host "##vso[task.logdetail id=$LogGuid;name=iqsharp;type=build;order=1]Packing IQ#" +} + +$script:Order = 1; +function Write-LogDetail() { + param( + [string] + $Name, + [string] + $Message + ); + Write-Host "##vso[task.logdetail id=$(New-Guid);parent=$LogGuid;name=$Name;type=build;order=$script:Order]$Message"; + $script:Order += 1; +} function Pack-Nuget() { param( @@ -100,23 +119,27 @@ function Pack-CondaRecipe() { } } -if ("true" -eq $Env:ONLY_CONDA) { - +if ("true" -ne $Env:ONLY_CONDA) { + Write-LogDetail "core" "Packing IQ# library..." Write-Host "##[info]Packing IQ# library..." Pack-Nuget '../src/Core/Core.csproj' + Write-LogDetail "tool" "Packing IQ# tool..." Write-Host "##[info]Packing IQ# tool..." Pack-Nuget '../src/Tool/Tool.csproj' + Write-LogDetail "wheel" "Packing Python wheel..." Write-Host "##[info]Packing Python wheel..." python --version Pack-Wheel '../src/Python/' + Write-LogDetail "docker" "Packing Docker image..." Write-Host "##[info]Packing Docker image..." Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' } +Write-LogDetail "conda" "Packing conda recipes..." Write-Host "##[info]Packing conda recipes..." Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" if (-not $IsWindows) { From f132e77ce80d6826e6ccfb1481ff5d6fb55b9f0d Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Tue, 10 Sep 2019 23:17:29 -0700 Subject: [PATCH 42/84] Handle stderr from conda-build better. --- build/pack.ps1 | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 83691400f1..90a63cfb63 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -109,13 +109,18 @@ function Pack-CondaRecipe() { return; } - conda build (Resolve-Path $Path); - - if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False - } else { - Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR; + # conda-build prints some warnings to stderr, which can lead to false positives. + # We wrap in a try-finally to make sure we can condition on the exit code and not on + # writing to stderr. + try { + conda build (Resolve-Path $Path); + } finally { + if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False + } else { + Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR; + } } } From 0fffb49b9a208df4748823f7de15b09e50639a98 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 11 Sep 2019 09:48:37 -0700 Subject: [PATCH 43/84] Detect $IsWindows even on Windows. --- build/pack.ps1 | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 90a63cfb63..2aa1039711 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -12,16 +12,11 @@ if ("true" -ne $Env:ONLY_CONDA) { Write-Host "##vso[task.logdetail id=$LogGuid;name=iqsharp;type=build;order=1]Packing IQ#" } -$script:Order = 1; -function Write-LogDetail() { - param( - [string] - $Name, - [string] - $Message - ); - Write-Host "##vso[task.logdetail id=$(New-Guid);parent=$LogGuid;name=$Name;type=build;order=$script:Order]$Message"; - $script:Order += 1; +# Detect whether we're on Windows. On PowerShell Core, this is easy, but +# Windows PowerShell doesn't have an $IsWindows automatic variable, so we need +# to do a little more work there. +if ($PSVersionTable.PSEdition -eq "Desktop") { + $IsWindows = $true; } function Pack-Nuget() { @@ -113,6 +108,7 @@ function Pack-CondaRecipe() { # We wrap in a try-finally to make sure we can condition on the exit code and not on # writing to stderr. try { + Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" conda build (Resolve-Path $Path); } finally { if ($LastExitCode -ne 0) { @@ -125,26 +121,21 @@ function Pack-CondaRecipe() { } if ("true" -ne $Env:ONLY_CONDA) { - Write-LogDetail "core" "Packing IQ# library..." Write-Host "##[info]Packing IQ# library..." Pack-Nuget '../src/Core/Core.csproj' - Write-LogDetail "tool" "Packing IQ# tool..." Write-Host "##[info]Packing IQ# tool..." Pack-Nuget '../src/Tool/Tool.csproj' - Write-LogDetail "wheel" "Packing Python wheel..." Write-Host "##[info]Packing Python wheel..." python --version Pack-Wheel '../src/Python/' - Write-LogDetail "docker" "Packing Docker image..." Write-Host "##[info]Packing Docker image..." Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' } -Write-LogDetail "conda" "Packing conda recipes..." Write-Host "##[info]Packing conda recipes..." Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" if (-not $IsWindows) { From bc5ab1085923957ab8554a915b5ad96b80450e09 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 11 Sep 2019 13:57:31 -0700 Subject: [PATCH 44/84] Revert and downgrade to warning. --- build/pack.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/pack.ps1 b/build/pack.ps1 index 2aa1039711..7f87b3dadd 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -110,12 +110,14 @@ function Pack-CondaRecipe() { try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" conda build (Resolve-Path $Path); + } catch { + Write-Host "##vso[task.logissue type=warning;]$_"; } finally { if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False } else { - Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR; + Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR -ErrorAction Continue; } } } From 9febe94316b923d3ff3a7bff0bf025cef18cf4c8 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 11 Sep 2019 16:30:43 -0700 Subject: [PATCH 45/84] Separate out conda-build call into separate job. --- build/ci.yml | 26 +++++---------- build/pack-conda.ps1 | 53 ++++++++++++++++++++++++++++++ build/pack.ps1 | 76 +++++-------------------------------------- build/steps-conda.yml | 30 +++++++++++++++++ build/steps.yml | 21 +++++------- 5 files changed, 108 insertions(+), 98 deletions(-) create mode 100644 build/pack-conda.ps1 create mode 100644 build/steps-conda.yml diff --git a/build/ci.yml b/build/ci.yml index a57af26e90..e87178f65a 100644 --- a/build/ci.yml +++ b/build/ci.yml @@ -9,37 +9,27 @@ variables: jobs: - job: "iqsharp" - pool: - vmImage: ubuntu-16.04 steps: - template: steps.yml - parameters: - onlyConda: "false" - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 displayName: 'Component Detection' inputs: failOnAlert: true +- job: "pack_conda_linux" + pool: + vmImage: ubuntu-16.04 + steps: + - template: steps-conda.yml + - job: "pack_conda_macos" pool: vmImage: macOS-10.14 steps: - - template: steps.yml - parameters: - onlyConda: "true" - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' - inputs: - failOnAlert: true + - template: steps-conda.yml - job: "pack_conda_win" pool: vmImage: windows-2019 steps: - - template: steps.yml - parameters: - onlyConda: "true" - - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0 - displayName: 'Component Detection' - inputs: - failOnAlert: true + - template: steps-conda.yml diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 new file mode 100644 index 0000000000..316f8bf4ea --- /dev/null +++ b/build/pack-conda.ps1 @@ -0,0 +1,53 @@ +# Copyright (c) Microsoft Corporation. All rights reserved. +# Licensed under the MIT License. +$ErrorActionPreference = 'Stop' + +& "$PSScriptRoot/set-env.ps1" +$all_ok = $True + +# Detect if we're running on Windows. This is trivial on PowerShell Core, but +# takes a bit more work on Windows PowerShell. +if ("Desktop" -eq $PSVersionTable.PSEdition) { + $IsWindows = $true; +} + +function Pack-CondaRecipe() { + param( + [string] $Path + ); + + if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { + Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` + "Will skip creation of conda package for $Path."; + return; + } + + # conda-build prints some warnings to stderr, which can lead to false positives. + # We wrap in a try-finally to make sure we can condition on the exit code and not on + # writing to stderr. + try { + Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" + conda build (Resolve-Path $Path); + } catch { + Write-Host "##vso[task.logissue type=warning;]$_"; + } finally { + if ($LastExitCode -ne 0) { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False + } else { + Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR -ErrorAction Continue; + } + } +} + +Write-Host "##[info]Packing conda recipes..." +Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" +if (-not $IsWindows) { + Pack-CondaRecipe -Path "../conda-recipes/pwsh" +} +Pack-CondaRecipe -Path "../conda-recipes/iqsharp" +Pack-CondaRecipe -Path "../conda-recipes/qsharp" + +if (-not $all_ok) { + throw "At least one package failed to build. Check the logs." +} diff --git a/build/pack.ps1 b/build/pack.ps1 index 7f87b3dadd..38391e8785 100644 --- a/build/pack.ps1 +++ b/build/pack.ps1 @@ -4,20 +4,6 @@ $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" $all_ok = $True -$LogGuid = New-Guid; - -if ("true" -ne $Env:ONLY_CONDA) { - Write-Host "##vso[task.logdetail id=$LogGuid;name=iqsharp;type=build;order=1]Packing IQ# (only conda)" -} else { - Write-Host "##vso[task.logdetail id=$LogGuid;name=iqsharp;type=build;order=1]Packing IQ#" -} - -# Detect whether we're on Windows. On PowerShell Core, this is easy, but -# Windows PowerShell doesn't have an $IsWindows automatic variable, so we need -# to do a little more work there. -if ($PSVersionTable.PSEdition -eq "Desktop") { - $IsWindows = $true; -} function Pack-Nuget() { param( @@ -93,59 +79,15 @@ function Pack-Image() { } } -function Pack-CondaRecipe() { - param( - [string] $Path - ); - - if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { - Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` - "Will skip creation of conda package for $Path."; - return; - } - - # conda-build prints some warnings to stderr, which can lead to false positives. - # We wrap in a try-finally to make sure we can condition on the exit code and not on - # writing to stderr. - try { - Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path); - } catch { - Write-Host "##vso[task.logissue type=warning;]$_"; - } finally { - if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False - } else { - Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR -ErrorAction Continue; - } - } -} - -if ("true" -ne $Env:ONLY_CONDA) { - Write-Host "##[info]Packing IQ# library..." - Pack-Nuget '../src/Core/Core.csproj' - - Write-Host "##[info]Packing IQ# tool..." - Pack-Nuget '../src/Tool/Tool.csproj' +Write-Host "##[info]Packing IQ# library..." +Pack-Nuget '../src/Core/Core.csproj' - Write-Host "##[info]Packing Python wheel..." - python --version - Pack-Wheel '../src/Python/' +Write-Host "##[info]Packing IQ# tool..." +Pack-Nuget '../src/Tool/Tool.csproj' - Write-Host "##[info]Packing Docker image..." - Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' +Write-Host "##[info]Packing Python wheel..." +python --version +Pack-Wheel '../src/Python/' -} - -Write-Host "##[info]Packing conda recipes..." -Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" -if (-not $IsWindows) { - Pack-CondaRecipe -Path "../conda-recipes/pwsh" -} -Pack-CondaRecipe -Path "../conda-recipes/iqsharp" -Pack-CondaRecipe -Path "../conda-recipes/qsharp" - -if (-not $all_ok) { - throw "At least one package failed to build. Check the logs." -} +Write-Host "##[info]Packing Docker image..." +Pack-Image -RepoName "iqsharp-base" -Dockerfile '../images/iqsharp-base/Dockerfile' diff --git a/build/steps-conda.yml b/build/steps-conda.yml new file mode 100644 index 0000000000..177a5893f5 --- /dev/null +++ b/build/steps-conda.yml @@ -0,0 +1,30 @@ +## +# Build and test IQ#. +## + +steps: + +## +# Pre-reqs +## +- task: CondaEnvironment@1 + inputs: + packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" + displayName: 'Use conda environment w/ Python 3.6' + +## +# Pack conda packages +## +- powershell: .\pack-conda.ps1 + displayName: "Packing IQ# packages" + workingDirectory: '$(System.DefaultWorkingDirectory)/build' + +## +# Publish build artifacts. +## +- task: PublishBuildArtifacts@1 + displayName: 'Publish Artifact: drop' + condition: succeededOrFailed() + inputs: + PathtoPublish: '$(Build.ArtifactStagingDirectory)' + artifactName: iqsharp diff --git a/build/steps.yml b/build/steps.yml index 590689018d..8f29f3485c 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -1,8 +1,6 @@ ## # Build and test IQ#. ## -parameters: - onlyConda: "false" steps: @@ -11,27 +9,24 @@ steps: ## - task: CondaEnvironment@1 inputs: - packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" + packageSpecs: "python=3.6 pip setuptools pytest jupyter" displayName: 'Use conda environment w/ Python 3.6' ## # Build, test & pack ## -- ${{ if eq(parameters.onlyConda, 'false') }}: - - powershell: .\build.ps1 - displayName: "Building IQ#" - workingDirectory: '$(System.DefaultWorkingDirectory)/build' +- powershell: .\build.ps1 + displayName: "Building IQ#" + workingDirectory: '$(System.DefaultWorkingDirectory)/build' - - powershell: .\test.ps1 - displayName: "Testing IQ#" - workingDirectory: '$(System.DefaultWorkingDirectory)/build' - condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) +- powershell: .\test.ps1 + displayName: "Testing IQ#" + workingDirectory: '$(System.DefaultWorkingDirectory)/build' + condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) - powershell: .\pack.ps1 displayName: "Packing IQ#" workingDirectory: '$(System.DefaultWorkingDirectory)/build' - env: - ONLY_CONDA: ${{ parameters.onlyConda }} ## # Publish tests results and build artifacts. From 3cfcd267cd1ef39d5ca8e44b37f1379a8e570123 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 11 Sep 2019 17:40:57 -0700 Subject: [PATCH 46/84] Find .NET Core SDK more reliabily. --- build/pack-conda.ps1 | 11 +++++++++- conda-recipes/iqsharp/bld.bat | 2 +- conda-recipes/iqsharp/build.ps1 | 36 +++++++++++++++++++++------------ conda-recipes/iqsharp/build.sh | 2 +- 4 files changed, 35 insertions(+), 16 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 316f8bf4ea..2e8c7131e2 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -4,6 +4,9 @@ $ErrorActionPreference = 'Stop' & "$PSScriptRoot/set-env.ps1" $all_ok = $True +$CondaPlatform = (conda info --json) ` + | ConvertFrom-Json ` + | Select-Object -ExpandProperty platform; # Detect if we're running on Windows. This is trivial on PowerShell Core, but # takes a bit more work on Windows PowerShell. @@ -35,7 +38,13 @@ function Pack-CondaRecipe() { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False } else { - Copy-Item (conda build (Resolve-Path $Path) --output) $Env:CONDA_OUTDIR -ErrorAction Continue; + $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); + New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; + Copy-Item ` + (conda build (Resolve-Path $Path) --output) ` + $TargetDir ` + -ErrorAction Continue ` + -Verbose; } } } diff --git a/conda-recipes/iqsharp/bld.bat b/conda-recipes/iqsharp/bld.bat index 09ff6eb218..a4dccada9d 100644 --- a/conda-recipes/iqsharp/bld.bat +++ b/conda-recipes/iqsharp/bld.bat @@ -1 +1 @@ -powershell -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 +powershell -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 \ No newline at end of file diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 9f5d626132..0c24ef6fd2 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -7,28 +7,38 @@ param( $DotNetPath = $null ); +# On Windows PowerShell, we don't have the nice $IsWindows / $IsLinux / $IsMacOS +# variables. Since Windows PowerShell is the only PowerShell variant that +# has "Desktop" as its PSEdition, we can check for that and create the +# $IsWindows variable if need be. +if ($PSVersionTable.PSEdition -eq "Desktop") { + $IsWindows = $true; +} + # If we weren't given a path, find dotnet now. -if ($null -eq $DotNetPath) { - $DotNetPath = (Get-Command dotnet).Source; - if ($DotNetPath -eq $null) { - Write-Error "Could not find .NET Core SDK. This should never happen." - exit -1; +# By default, look for the executable provided by the dotnetcore-sdk package, +# since the activate.d script isn't run by conda-build on all platforms. +if (($null -eq $DotNetPath) -or $DotNetPath.Length -eq 0) { + $CondaDotNet = Join-Path (Join-Path (Join-Path $Env:PREFIX "opt") "dotnet") "dotnet"; + if (Get-Command $CondaDotNet -ErrorAction SilentlyContinue) { + $DotNetPath = $CondaDotNet; + } else { + # Check for a globally installed fallback and warn. + Write-Warning "Could not find dotnet as installed by the dotnetcore-sdk package. Falling back to global version."; + $DotNetPath = (Get-Command dotnet).Source; } } +if (-not (Get-Command $DotNetPath)) { + Write-Error "Could not find .NET Core SDK. This should never happen." + exit -1; +} + # The user may not have run .NET Core SDK before, so we disable first-time # experience to avoid capturing the NuGet cache. $Env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE = "true"; $Env:NUGET_XMLDOC_MODE = "skip"; -# On Windows PowerShell, we don't have the nice $IsWindows / $IsLinux / $IsMacOS -# variables. Since Windows PowerShell is the only PowerShell variant that -# has "Desktop" as its PSEdition, we can check for that and create the -# $IsWindows variable if need be. -if ($PSVersionTable.PSEdition -eq "Desktop") { - $IsWindows = $true; -} - if ($IsWindows) { # NOTE: Building this package is ★only★ supported for Windows 10. $RuntimeID = "win10-x$Env:ARCH"; diff --git a/conda-recipes/iqsharp/build.sh b/conda-recipes/iqsharp/build.sh index 2c9c8b0ed8..b546b8a5f6 100644 --- a/conda-recipes/iqsharp/build.sh +++ b/conda-recipes/iqsharp/build.sh @@ -1,6 +1,6 @@ echo "Using $(which pwsh) to run build.ps1" echo "Using .NET Core SDK at $(which dotnet)" -# We need to pass the path to dotnet manually on macOS, +# We need to pass the path to dotnet manually, # as the path environment variable is sometimes clobbered when # running the build script. pwsh iqsharp/conda-recipes/iqsharp/build.ps1 -DotNetPath "$(which dotnet)" From 3283808f386e5a5d8fc033e48a0d338c6b4a7749 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:18:30 -0700 Subject: [PATCH 47/84] Write conda build logs to temporary file as well. --- build/pack-conda.ps1 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 2e8c7131e2..40659ceb78 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -19,6 +19,7 @@ function Pack-CondaRecipe() { [string] $Path ); + $LogFile = New-TemporaryFile; if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` "Will skip creation of conda package for $Path."; @@ -30,10 +31,13 @@ function Pack-CondaRecipe() { # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path); + conda build (Resolve-Path $Path) *>&1 ` + | Tee-Object -FilePath $LogFile.FullName; } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { + Write-Host "##[vso.uploadfile]$($LogFile.FullPath)" + Write-Host "[vso.uploadfile]$($LogFile.FullPath)" if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False From 74b61d2c7907634b257649fe280bf66a70e122e7 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:24:49 -0700 Subject: [PATCH 48/84] trying again to log. --- build/pack-conda.ps1 | 1 + 1 file changed, 1 insertion(+) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 40659ceb78..a29869b827 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -20,6 +20,7 @@ function Pack-CondaRecipe() { ); $LogFile = New-TemporaryFile; + Write-Host "Logging conda-build to $($LogFile.FullName)"; if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` "Will skip creation of conda package for $Path."; From 31a439001d1d44e96d5ee8c3a8ab9e417d23f3e0 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:25:22 -0700 Subject: [PATCH 49/84] Explicitly write all conda-build output to host. --- build/pack-conda.ps1 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index a29869b827..444626ab4d 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -33,7 +33,8 @@ function Pack-CondaRecipe() { try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" conda build (Resolve-Path $Path) *>&1 ` - | Tee-Object -FilePath $LogFile.FullName; + | Tee-Object -FilePath $LogFile.FullName ` + | Write-Host; } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { From 0abc0eb5cd9013581c6a1a997279d9311af7b284 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:29:12 -0700 Subject: [PATCH 50/84] Fixing property name in log upload. --- build/pack-conda.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 444626ab4d..14910455f4 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -38,8 +38,8 @@ function Pack-CondaRecipe() { } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { - Write-Host "##[vso.uploadfile]$($LogFile.FullPath)" - Write-Host "[vso.uploadfile]$($LogFile.FullPath)" + Write-Host "##[vso.uploadfile]$($LogFile.FullName)" + Write-Host "[vso.uploadfile]$($LogFile.FullName)" if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False From a97dc5c4de5e158dea91dfb0d3dd4844d49d2942 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:34:15 -0700 Subject: [PATCH 51/84] Fix uploadfile task command. --- build/pack-conda.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 14910455f4..cad085a167 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -38,8 +38,7 @@ function Pack-CondaRecipe() { } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { - Write-Host "##[vso.uploadfile]$($LogFile.FullName)" - Write-Host "[vso.uploadfile]$($LogFile.FullName)" + Write-Host "##vso[task.uploadfile]$($LogFile.FullName)" if ($LastExitCode -ne 0) { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False From c5644d75e3828f7a5ed5c044d9d08ae41f78b7fa Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 11:51:39 -0700 Subject: [PATCH 52/84] Trying again to get any log information out of ADO. --- build/pack-conda.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index cad085a167..ec869a14fe 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -32,7 +32,7 @@ function Pack-CondaRecipe() { # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path) *>&1 ` + conda build (Resolve-Path $Path) ` | Tee-Object -FilePath $LogFile.FullName ` | Write-Host; } catch { From a9ccc9b81ddc483955107fb0d505e42fca239400 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 12:45:33 -0700 Subject: [PATCH 53/84] Don't trust conda-build's exit code. --- build/pack-conda.ps1 | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index ec869a14fe..b37e87045b 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -14,6 +14,9 @@ if ("Desktop" -eq $PSVersionTable.PSEdition) { $IsWindows = $true; } +# Write out diagnostics about what version of PowerShell we're on. +$PSVersionTable | Write-Host; + function Pack-CondaRecipe() { param( [string] $Path @@ -32,24 +35,23 @@ function Pack-CondaRecipe() { # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path) ` - | Tee-Object -FilePath $LogFile.FullName ` - | Write-Host; + conda build (Resolve-Path $Path); } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { Write-Host "##vso[task.uploadfile]$($LogFile.FullName)" - if ($LastExitCode -ne 0) { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False - } else { - $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); - New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; + New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; + $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); + $PackagePath = (conda build (Resolve-Path $Path) --output); + if (Test-Path $PackagePath) { Copy-Item ` - (conda build (Resolve-Path $Path) --output) ` + $PackagePath ` $TargetDir ` -ErrorAction Continue ` -Verbose; + } else { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False } } } From 9b17aeda99f42415786c5ead1246cad167fae9c0 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 12:53:49 -0700 Subject: [PATCH 54/84] Switch to using pwsh everywhere. --- build/pack-conda.ps1 | 2 +- build/steps.yml | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index b37e87045b..f1b5e733b1 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -40,8 +40,8 @@ function Pack-CondaRecipe() { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { Write-Host "##vso[task.uploadfile]$($LogFile.FullName)" - New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); + New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; $PackagePath = (conda build (Resolve-Path $Path) --output); if (Test-Path $PackagePath) { Copy-Item ` diff --git a/build/steps.yml b/build/steps.yml index 8f29f3485c..2b3b2f5c04 100644 --- a/build/steps.yml +++ b/build/steps.yml @@ -15,16 +15,16 @@ steps: ## # Build, test & pack ## -- powershell: .\build.ps1 +- pwsh: .\build.ps1 displayName: "Building IQ#" workingDirectory: '$(System.DefaultWorkingDirectory)/build' -- powershell: .\test.ps1 +- pwsh: .\test.ps1 displayName: "Testing IQ#" workingDirectory: '$(System.DefaultWorkingDirectory)/build' condition: and(succeeded(), ne(variables['Skip.Tests'], 'true')) -- powershell: .\pack.ps1 +- pwsh: .\pack.ps1 displayName: "Packing IQ#" workingDirectory: '$(System.DefaultWorkingDirectory)/build' From 0764e1b5d2b6918ccfa029e7b36da0e539de2a6c Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 13:14:43 -0700 Subject: [PATCH 55/84] Fix macOS-specific bug. --- build/pack-conda.ps1 | 3 +-- conda-recipes/pwsh/meta.yaml | 8 +++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index f1b5e733b1..6fa363652e 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -22,8 +22,6 @@ function Pack-CondaRecipe() { [string] $Path ); - $LogFile = New-TemporaryFile; - Write-Host "Logging conda-build to $($LogFile.FullName)"; if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { Write-Host "##vso[task.logissue type=warning;] conda-build not installed. " + ` "Will skip creation of conda package for $Path."; @@ -49,6 +47,7 @@ function Pack-CondaRecipe() { $TargetDir ` -ErrorAction Continue ` -Verbose; + Write-Host "##[info]Copied $PackagePath to $TargetDir."; } else { Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." $script:all_ok = $False diff --git a/conda-recipes/pwsh/meta.yaml b/conda-recipes/pwsh/meta.yaml index b210ef6468..4c6df376df 100644 --- a/conda-recipes/pwsh/meta.yaml +++ b/conda-recipes/pwsh/meta.yaml @@ -3,9 +3,11 @@ package: version: "6.2.2" build: - detect_binary_files_with_prefix: False - ignore_prefix_files: - - libmi.dylib + # Note that we do not need to look for prefixes with this package, as it is a + # .NET Core Global Tool; any prefixing is done in the dotnetcore-sdk package itself. + # Disabling prefixing fixes a macOS-specific bug and makes building this package much + # faster. + ignore_prefix_files: True requirements: build: From ddc020017dab5f3a511d21c578062216fb08a41f Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 13:16:29 -0700 Subject: [PATCH 56/84] Fix pack-conda diagnostics. --- build/pack-conda.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 6fa363652e..e8f72a31fc 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -15,7 +15,7 @@ if ("Desktop" -eq $PSVersionTable.PSEdition) { } # Write out diagnostics about what version of PowerShell we're on. -$PSVersionTable | Write-Host; +$PSVersionTable | Format-Table | Out-String | Write-Host; function Pack-CondaRecipe() { param( From 6119125268820e50e025f910fe6e401fdeb23ffd Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 13:45:15 -0700 Subject: [PATCH 57/84] Forgot to remove log upload. --- build/pack-conda.ps1 | 1 - 1 file changed, 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index e8f72a31fc..0fe1c5f2ca 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -37,7 +37,6 @@ function Pack-CondaRecipe() { } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { - Write-Host "##vso[task.uploadfile]$($LogFile.FullName)" $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; $PackagePath = (conda build (Resolve-Path $Path) --output); From 540df3bf9486e66e744f0be912c3fb5baaf30b52 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 15:06:11 -0700 Subject: [PATCH 58/84] First stab at removing dotnetcore-sdk and pwsh recipes. --- conda-recipes/dotnetcore-sdk/bld.bat | 64 -------------------------- conda-recipes/dotnetcore-sdk/build.sh | 41 ----------------- conda-recipes/dotnetcore-sdk/meta.yaml | 16 ------- conda-recipes/iqsharp/build.ps1 | 9 +--- conda-recipes/iqsharp/meta.yaml | 2 - conda-recipes/pwsh/build.sh | 6 --- conda-recipes/pwsh/meta.yaml | 20 -------- conda-recipes/qsharp/meta.yaml | 1 - 8 files changed, 1 insertion(+), 158 deletions(-) delete mode 100644 conda-recipes/dotnetcore-sdk/bld.bat delete mode 100644 conda-recipes/dotnetcore-sdk/build.sh delete mode 100644 conda-recipes/dotnetcore-sdk/meta.yaml delete mode 100644 conda-recipes/pwsh/build.sh delete mode 100644 conda-recipes/pwsh/meta.yaml diff --git a/conda-recipes/dotnetcore-sdk/bld.bat b/conda-recipes/dotnetcore-sdk/bld.bat deleted file mode 100644 index 5395812a34..0000000000 --- a/conda-recipes/dotnetcore-sdk/bld.bat +++ /dev/null @@ -1,64 +0,0 @@ -set DOTNET_ROOT=%PREFIX%\opt\dotnet - -@REM We use powershell.exe and not pwsh.exe to invoke the downloaded script, -@REM as we do not know whether or not the build agent has PowerShell 6 or later -@REM installed. -powershell.exe -NoProfile -Command "./dotnet-install.ps1 -Version %PKG_VERSION% -NoPath -InstallDir %DOTNET_ROOT%" - -@REM We can save environment variables into the new package using the technique -@REM demonstrated at: -@REM https://github.com/conda-forge/staged-recipes/pull/2002/files -@REM We do so here to ensure that the new install of .NET Core SDK is added -@REM to %PATH%, and that the %DOTNET_ROOT% variable is set for use with global -@REM tools. - -@REM Since the activate.d mechanism is shell-dependent, we will also need to -@REM provide activation and deactivation scripts for cmd.exe, PowerShell, and -@REM for POSIX-style shells. - -@REM In the future, we should transition this mechanism over to use what is -@REM implemented to resolve the shell-dependence of the current activate.d -@REM system. See also: -@REM https://github.com/conda/conda/issues/6820. - -@REM Known issues: -@REM - Does not support recursive entry into environments, as the -@REM _CONDA_PKG_BACKUP_* variables are overwritten by activate.d calls. -@REM - POSIX-style shells are not yet supported on Windows, as it is not clear -@REM how to convert Windows paths visible to cmd.exe to a format expected by -@REM Git Bash or msys2 bash. - -set ACT_D=%PREFIX%\etc\conda\activate.d -md %ACT_D% -set DEACT_D=%PREFIX%\etc\conda\deactivate.d -md %DEACT_D% - -@REM -- cmd activation/deactivation -- -echo set _CONDA_PKG_BACKUP_PATH=%%PATH%% >> %ACT_D%\dotnet_root.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_ROOT=%%DOTNET_ROOT%% >> %ACT_D%\dotnet_root.cmd -echo set DOTNET_ROOT=%DOTNET_ROOT% >> %ACT_D%\dotnet_root.cmd -echo set PATH=%DOTNET_ROOT%;%%PATH%% >> %ACT_D%\dotnet_root.cmd -echo set PATH=%%_CONDA_PKG_BACKUP_PATH%% >> %DEACT_D%\dotnet_root.cmd -echo set DOTNET_ROOT=%%_CONDA_PKG_BACKUP_DOTNET_ROOT%% >> %DEACT_D%\dotnet_root.cmd -echo set _CONDA_PKG_BACKUP_DOTNET_ROOT= >> %DEACT_D%\dotnet_root.cmd -echo set _CONDA_PKG_BACKUP_PATH= >> %DEACT_D%\dotnet_root.cmd - -@REM -- pwsh activation/deactivation -- -echo $Env:_CONDA_PKG_BACKUP_PATH = "$Env:PATH"; >> %ACT_D%\dotnet_root.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = "$Env:DOTNET_ROOT"; >> %ACT_D%\dotnet_root.ps1 -echo $Env:DOTNET_ROOT = "%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.ps1 -echo $Env:PATH = "%DOTNET_ROOT%;$Env:PATH"; >> %ACT_D%\dotnet_root.ps1 -echo $Env:PATH = "$Env:_CONDA_PKG_BACKUP_PATH"; >> %DEACT_D%\dotnet_root.ps1 -echo $Env:DOTNET_ROOT = "$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT"; >> %DEACT_D%\dotnet_root.ps1 -echo $Env:_CONDA_PKG_BACKUP_PATH = $null; >> %DEACT_D%\dotnet_root.ps1 -echo $Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = $null; >> %DEACT_D%\dotnet_root.ps1 - -@REM -- posix-style activation/deactivation -- -@REM echo export _CONDA_PKG_BACKUP_PATH="$PATH"; >> %ACT_D%\dotnet_root.sh -@REM echo export _CONDA_PKG_BACKUP_DOTNET_ROOT="$DOTNET_ROOT"; >> %ACT_D%\dotnet_root.sh -@REM echo export DOTNET_ROOT="%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.sh -@REM echo export PATH="$PATH;%DOTNET_ROOT%"; >> %ACT_D%\dotnet_root.sh -@REM echo export PATH="$_CONDA_PKG_BACKUP_PATH" >> %DEACT_D%\dotnet_root.sh -@REM echo export DOTNET_ROOT="$_CONDA_PKG_BACKUP_DOTNET_ROOT" >> %DEACT_D%\dotnet_root.sh -@REM echo unset _CONDA_PKG_BACKUP_DOTNET_ROOT >> %DEACT_D%\dotnet_root.sh -@REM echo unset _CONDA_PKG_BACKUP_PATH >> %DEACT_D%\dotnet_root.sh diff --git a/conda-recipes/dotnetcore-sdk/build.sh b/conda-recipes/dotnetcore-sdk/build.sh deleted file mode 100644 index de5bd9d488..0000000000 --- a/conda-recipes/dotnetcore-sdk/build.sh +++ /dev/null @@ -1,41 +0,0 @@ -DOTNET_ROOT=$PREFIX/opt/dotnet -# The dotnet-install script uses non-POSIX compilant set commands, so we need -# to explicitly use bash. -/bin/bash ./dotnet-install.sh -Version $PKG_VERSION -NoPath -InstallDir $DOTNET_ROOT - -# We can save environment variables into the new package using the technique -# demonstrated at: -# https://github.com/conda-forge/staged-recipes/pull/2002/files -# We do so here to ensure that the new install of .NET Core SDK is added -# to %PATH%, and that the %DOTNET_ROOT% variable is set for use with global -# tools. - -# Since the activate.d mechanism is shell-dependent, we will also need to -# provide activation and deactivation scripts for PowerShell and -# for POSIX-style shells. - -# In the future, we should transition this mechanism over to use what is -# implemented to resolve the shell-dependence of the current activate.d -# system. See also: -# https://github.com/conda/conda/issues/6820. - -ACT_D=$PREFIX/etc/conda/activate.d -mkdir -p $ACT_D -DEACT_D=$PREFIX/etc/conda/deactivate.d -mkdir -p $DEACT_D - -# -- pwsh activation/deactivation -- -echo "\$Env:_CONDA_PKG_BACKUP_PATH = \"\$Env:PATH\";" >> $ACT_D/dotnet_root.ps1 -echo "\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT = \"\$Env:DOTNET_ROOT\";" >> $ACT_D/dotnet_root.ps1 -echo "\$Env:DOTNET_ROOT = \"$PREFIX/opt/dotnet/\";" >> $ACT_D/dotnet_root.ps1 -echo "\$Env:PATH = \"$DOTNET_ROOT:\$Env:PATH\";" >> $ACT_D/dotnet_root.ps1 -echo "\$Env:PATH = \"\$Env:_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_root.ps1 -echo "\$Env:DOTNET_ROOT = \"\$Env:_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/dotnet_root.ps1 - -# -- posix-style activation/deactivation -- -echo "export _CONDA_PKG_BACKUP_PATH=\"\$PATH\";" >> $ACT_D/dotnet_root.sh -echo "export _CONDA_PKG_BACKUP_DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/dotnet_root.sh -echo "export DOTNET_ROOT=\"$DOTNET_ROOT\";" >> $ACT_D/dotnet_root.sh -echo "export PATH=\"$DOTNET_ROOT:\$PATH\";" >> $ACT_D/dotnet_root.sh -echo "export PATH=\"\$_CONDA_PKG_BACKUP_PATH\";" >> $DEACT_D/dotnet_root.sh -echo "export DOTNET_ROOT=\"\$_CONDA_PKG_BACKUP_DOTNET_ROOT\";" >> $DEACT_D/dotnet_root.sh diff --git a/conda-recipes/dotnetcore-sdk/meta.yaml b/conda-recipes/dotnetcore-sdk/meta.yaml deleted file mode 100644 index 97fd269a7a..0000000000 --- a/conda-recipes/dotnetcore-sdk/meta.yaml +++ /dev/null @@ -1,16 +0,0 @@ -package: - name: dotnetcore-sdk - version: "2.2.401" - -source: - - url: https://dot.net/v1/dotnet-install.sh # [not win] - sha256: b5b2340b159fa644e6a77ed54afc7fa9667fa6947caedf71c1e8c2d667e0632e # [not win] - - url: https://dot.net/v1/dotnet-install.ps1 # [win] - sha256: a0b41e631cfd67cdf07a97a68be9b7da22df002a0e60110685c8a4ab5e2eb883 # [win] - -# test: -# imports: -# - - -about: - home: https://docs.microsoft.com/dotnet/core/ diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 0c24ef6fd2..db2aff80ec 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -19,14 +19,7 @@ if ($PSVersionTable.PSEdition -eq "Desktop") { # By default, look for the executable provided by the dotnetcore-sdk package, # since the activate.d script isn't run by conda-build on all platforms. if (($null -eq $DotNetPath) -or $DotNetPath.Length -eq 0) { - $CondaDotNet = Join-Path (Join-Path (Join-Path $Env:PREFIX "opt") "dotnet") "dotnet"; - if (Get-Command $CondaDotNet -ErrorAction SilentlyContinue) { - $DotNetPath = $CondaDotNet; - } else { - # Check for a globally installed fallback and warn. - Write-Warning "Could not find dotnet as installed by the dotnetcore-sdk package. Falling back to global version."; - $DotNetPath = (Get-Command dotnet).Source; - } + $DotNetPath = (Get-Command dotnet).Source; } if (-not (Get-Command $DotNetPath)) { diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index af69113eed..0010212bdd 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -12,8 +12,6 @@ requirements: build: - python - setuptools - - dotnetcore-sdk=2.2.401 - - pwsh>=6.2.2 # [not win] - jupyter run: diff --git a/conda-recipes/pwsh/build.sh b/conda-recipes/pwsh/build.sh deleted file mode 100644 index 2036fcab08..0000000000 --- a/conda-recipes/pwsh/build.sh +++ /dev/null @@ -1,6 +0,0 @@ -# The user may not have run .NET Core SDK before, so we disable first-time -# experience to avoid capturing the NuGet cache. -export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=true -export NUGET_XMLDOC_MODE=skip - -dotnet tool install PowerShell --tool-path $PREFIX/bin --version $PKG_VERSION diff --git a/conda-recipes/pwsh/meta.yaml b/conda-recipes/pwsh/meta.yaml deleted file mode 100644 index 4c6df376df..0000000000 --- a/conda-recipes/pwsh/meta.yaml +++ /dev/null @@ -1,20 +0,0 @@ -package: - name: pwsh - version: "6.2.2" - -build: - # Note that we do not need to look for prefixes with this package, as it is a - # .NET Core Global Tool; any prefixing is done in the dotnetcore-sdk package itself. - # Disabling prefixing fixes a macOS-specific bug and makes building this package much - # faster. - ignore_prefix_files: True - -requirements: - build: - - dotnetcore-sdk=2.2.401 - - run: - - dotnetcore-sdk=2.2.401 - -about: - home: https://github.com/PowerShell/PowerShell diff --git a/conda-recipes/qsharp/meta.yaml b/conda-recipes/qsharp/meta.yaml index 4e2a3b45cf..dd03726d32 100644 --- a/conda-recipes/qsharp/meta.yaml +++ b/conda-recipes/qsharp/meta.yaml @@ -15,7 +15,6 @@ requirements: - jupyter - jupyter_client - iqsharp={{ version }} - - pwsh # [not win] run: - python From f073363bdd22a0c7a235f24103084c97e00feb2c Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 15:09:41 -0700 Subject: [PATCH 59/84] Updated pack script for reduced package set. --- build/pack-conda.ps1 | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 0fe1c5f2ca..b2f4103b94 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -8,12 +8,6 @@ $CondaPlatform = (conda info --json) ` | ConvertFrom-Json ` | Select-Object -ExpandProperty platform; -# Detect if we're running on Windows. This is trivial on PowerShell Core, but -# takes a bit more work on Windows PowerShell. -if ("Desktop" -eq $PSVersionTable.PSEdition) { - $IsWindows = $true; -} - # Write out diagnostics about what version of PowerShell we're on. $PSVersionTable | Format-Table | Out-String | Write-Host; @@ -55,10 +49,6 @@ function Pack-CondaRecipe() { } Write-Host "##[info]Packing conda recipes..." -Pack-CondaRecipe -Path "../conda-recipes/dotnetcore-sdk" -if (-not $IsWindows) { - Pack-CondaRecipe -Path "../conda-recipes/pwsh" -} Pack-CondaRecipe -Path "../conda-recipes/iqsharp" Pack-CondaRecipe -Path "../conda-recipes/qsharp" From 86c7fbc034d7be0799b923a1326b573e15c748eb Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 12 Sep 2019 15:13:46 -0700 Subject: [PATCH 60/84] Fixed test-time requirements for iqsharp. --- conda-recipes/iqsharp/meta.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index 0010212bdd..753bcf90b8 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -20,7 +20,6 @@ requirements: test: requires: - - pwsh>=6.2.2 # [not win] - jupyter - python>=3.6 - jupyter_client From 4041e1886f8c363505182da02c28f0a35517cd2b Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 10:33:04 -0700 Subject: [PATCH 61/84] Force pwsh vs powershell. --- build/steps-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps-conda.yml b/build/steps-conda.yml index 177a5893f5..22d9eaa59d 100644 --- a/build/steps-conda.yml +++ b/build/steps-conda.yml @@ -15,7 +15,7 @@ steps: ## # Pack conda packages ## -- powershell: .\pack-conda.ps1 +- pwsh: .\pack-conda.ps1 displayName: "Packing IQ# packages" workingDirectory: '$(System.DefaultWorkingDirectory)/build' From c6a178335c8c8ccfb162c8e5e2209dcd415cd619 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 14:14:09 -0700 Subject: [PATCH 62/84] Try using pwsh on Windows. --- conda-recipes/iqsharp/bld.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/bld.bat b/conda-recipes/iqsharp/bld.bat index a4dccada9d..6ce2fac1e3 100644 --- a/conda-recipes/iqsharp/bld.bat +++ b/conda-recipes/iqsharp/bld.bat @@ -1 +1 @@ -powershell -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 \ No newline at end of file +pwsh -NoProfile iqsharp/conda-recipes/iqsharp/build.ps1 From 527d240d5a2f7bfd9032eeb57429feae781aa64a Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 15:39:28 -0700 Subject: [PATCH 63/84] Lock conda-build to 3.18.8. --- build/steps-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps-conda.yml b/build/steps-conda.yml index 22d9eaa59d..979c2b1546 100644 --- a/build/steps-conda.yml +++ b/build/steps-conda.yml @@ -9,7 +9,7 @@ steps: ## - task: CondaEnvironment@1 inputs: - packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build" + packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build=3.18.8" displayName: 'Use conda environment w/ Python 3.6' ## From eeaf8a9ebdc3bfc40abfb4ec45d0336bd4421c94 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 15:58:06 -0700 Subject: [PATCH 64/84] Added call to dotnet --info. --- build/pack-conda.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index b2f4103b94..1c07780785 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -8,8 +8,10 @@ $CondaPlatform = (conda info --json) ` | ConvertFrom-Json ` | Select-Object -ExpandProperty platform; -# Write out diagnostics about what version of PowerShell we're on. +# Write out diagnostics about what version of PowerShell and .NET Core SDK we're on. +Write-Host "##[info]Diagnostic information:"; $PSVersionTable | Format-Table | Out-String | Write-Host; +dotnet --info; function Pack-CondaRecipe() { param( From fdf0bd8eabe97b97fd015e03d5ca71036a4deff9 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 16:05:48 -0700 Subject: [PATCH 65/84] Revert "Added call to dotnet --info." This reverts commit eeaf8a9ebdc3bfc40abfb4ec45d0336bd4421c94. --- build/pack-conda.ps1 | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 1c07780785..b2f4103b94 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -8,10 +8,8 @@ $CondaPlatform = (conda info --json) ` | ConvertFrom-Json ` | Select-Object -ExpandProperty platform; -# Write out diagnostics about what version of PowerShell and .NET Core SDK we're on. -Write-Host "##[info]Diagnostic information:"; +# Write out diagnostics about what version of PowerShell we're on. $PSVersionTable | Format-Table | Out-String | Write-Host; -dotnet --info; function Pack-CondaRecipe() { param( From 2943c2a77ba692064fd29cf2ccd2ec6f96b96198 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 16:21:27 -0700 Subject: [PATCH 66/84] Lock conda build to dotnet 2.2.401 --- build/steps-conda.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build/steps-conda.yml b/build/steps-conda.yml index 979c2b1546..18a970e920 100644 --- a/build/steps-conda.yml +++ b/build/steps-conda.yml @@ -12,6 +12,12 @@ steps: packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build=3.18.8" displayName: 'Use conda environment w/ Python 3.6' +- task: UseDotNet@2 + displayName: 'Use .NET Core sdk' + inputs: + packageType: sdk + version: 2.2.401 + ## # Pack conda packages ## From 18c370dac03e94f07b824d5ffad110310c78febe Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 16:51:01 -0700 Subject: [PATCH 67/84] Adding more diagnostics. --- build/pack-conda.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index b2f4103b94..ab6e33c3ff 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -27,7 +27,7 @@ function Pack-CondaRecipe() { # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path); + conda build (Resolve-Path $Path) --debug --keep-going; } catch { Write-Host "##vso[task.logissue type=warning;]$_"; } finally { From dcb6457a898720243f176f97002cd10fed3a71b1 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 17:06:57 -0700 Subject: [PATCH 68/84] More diagnostics. --- conda-recipes/iqsharp/build.ps1 | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index db2aff80ec..da83b6b76d 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -7,12 +7,9 @@ param( $DotNetPath = $null ); -# On Windows PowerShell, we don't have the nice $IsWindows / $IsLinux / $IsMacOS -# variables. Since Windows PowerShell is the only PowerShell variant that -# has "Desktop" as its PSEdition, we can check for that and create the -# $IsWindows variable if need be. +# This script is only designed to work on PowerShell Core or PowerShell 7 and later. if ($PSVersionTable.PSEdition -eq "Desktop") { - $IsWindows = $true; + Write-Error "##vso[task.logissue type=error;]conda recipe for iqsharp requires PowerShell Core or PowerShell 7."; } # If we weren't given a path, find dotnet now. @@ -41,10 +38,7 @@ if ($IsWindows) { $RuntimeID = "osx-x$Env:ARCH"; } -# On PowerShell 6 (Core) and later, Join-Path takes multiple child paths, -# but we don't use that for compatability with Windows PowerShell (5.1 and -# earlier). -$TargetDirectory = (Join-Path (Join-Path $Env:PREFIX "opt") "iqsharp"); +$TargetDirectory = (Join-Path $Env:PREFIX "opt" "iqsharp"); $RepoRoot = Resolve-Path iqsharp; Write-Host "## Diagnostic Information ##" @@ -62,7 +56,10 @@ Write-Host "## Diagnostic Information ##" # due to https://github.com/dotnet/cli/issues/10607. This should # be resolved with .NET Core SDK 3.0 and later. Write-Host "## Patching IQ# for Standalone Deployment. ##" -Copy-Item (Join-Path $PSScriptRoot "ToolStandalone.csproj") (Join-Path (Join-Path (Join-Path $RepoRoot "src") "Tool") "Tool.csproj"); +Copy-Item ` + (Join-Path $PSScriptRoot "ToolStandalone.csproj") ` + (Join-Path $RepoRoot "src" "Tool" "Tool.csproj") ` + -Verbose; Write-Host "## Building IQ#. ##" Push-Location (Join-Path $RepoRoot src/Tool) @@ -78,3 +75,6 @@ Push-Location $TargetDirectory $PathToTool = Resolve-Path "./$BaseName"; & $PathToTool install --path-to-tool $PathToTool --sys-prefix Pop-Location + +Write-Host "## Manifest of Installed Files ##" +Get-ChildItem -Recurse $TargetDirectory | Write-Host; From 4f1613258c48029d81ebc1c44641ca26179dd6dd Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 17:26:31 -0700 Subject: [PATCH 69/84] even more diagnostics --- conda-recipes/iqsharp/build.ps1 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index da83b6b76d..d07d3f1f72 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -77,4 +77,6 @@ Push-Location $TargetDirectory Pop-Location Write-Host "## Manifest of Installed Files ##" -Get-ChildItem -Recurse $TargetDirectory | Write-Host; +$ManifestFile = New-TemporaryFile; +Get-ChildItem -Recurse $TargetDirectory | Out-File $ManifestFile; +Write-Host "##vso[task.uploadfile]$($ManifestFile.FullName)" From 7f997462b8dfffcdca973ba4702b034c1296a053 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 17:38:33 -0700 Subject: [PATCH 70/84] Disable binary prefix searching. --- conda-recipes/iqsharp/meta.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conda-recipes/iqsharp/meta.yaml b/conda-recipes/iqsharp/meta.yaml index 753bcf90b8..e2da5887f9 100644 --- a/conda-recipes/iqsharp/meta.yaml +++ b/conda-recipes/iqsharp/meta.yaml @@ -8,6 +8,10 @@ source: - path: ../../ folder: iqsharp +build: + binary_relocation: False + detect_binary_files_with_prefix: False + requirements: build: - python From 22b9f6d7dd356a6642a7f78e92e41ec79e05537e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 18:01:19 -0700 Subject: [PATCH 71/84] yet more debugging --- conda-recipes/iqsharp/build.ps1 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index d07d3f1f72..fd38112ed0 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -77,6 +77,12 @@ Push-Location $TargetDirectory Pop-Location Write-Host "## Manifest of Installed Files ##" -$ManifestFile = New-TemporaryFile; +$Env:ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; +python -c @" +from conda_build.utils import prefix_files +import os +with open(os.getenv('ManifestFile', 'w') as f: + f.write(prefix_files(os.getenv('PREFIX')) +"@ Get-ChildItem -Recurse $TargetDirectory | Out-File $ManifestFile; Write-Host "##vso[task.uploadfile]$($ManifestFile.FullName)" From 343a0fefe97447a6d567d8fd99887a1087005f8f Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 18:10:49 -0700 Subject: [PATCH 72/84] fix diagnostics. --- conda-recipes/iqsharp/build.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index fd38112ed0..5e2f534eab 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -81,8 +81,8 @@ $Env:ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; python -c @" from conda_build.utils import prefix_files import os -with open(os.getenv('ManifestFile', 'w') as f: +with open(os.getenv('ManifestFile', 'w')) as f: f.write(prefix_files(os.getenv('PREFIX')) "@ -Get-ChildItem -Recurse $TargetDirectory | Out-File $ManifestFile; -Write-Host "##vso[task.uploadfile]$($ManifestFile.FullName)" +Get-ChildItem -Recurse $TargetDirectory | Out-File $Env:ManifestFile; +Write-Host "##vso[task.uploadfile]$Env:ManifestFile" From edde3fa86bcb904b0eaa6525aab633a975b48374 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 18:18:28 -0700 Subject: [PATCH 73/84] One more fix to diagnostics. --- conda-recipes/iqsharp/build.ps1 | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 5e2f534eab..683466d5ea 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -78,11 +78,6 @@ Pop-Location Write-Host "## Manifest of Installed Files ##" $Env:ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; -python -c @" -from conda_build.utils import prefix_files -import os -with open(os.getenv('ManifestFile', 'w')) as f: - f.write(prefix_files(os.getenv('PREFIX')) -"@ +python -c "from conda_build.utils import prefix_files; import os; with open(os.getenv('ManifestFile', 'w')) as f: f.write(prefix_files(os.getenv('PREFIX'));" Get-ChildItem -Recurse $TargetDirectory | Out-File $Env:ManifestFile; Write-Host "##vso[task.uploadfile]$Env:ManifestFile" From 33a4eeb9b0bb10cd1beb4691ce8e15d3eb2dec76 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 18:34:43 -0700 Subject: [PATCH 74/84] one moar fix --- conda-recipes/iqsharp/build.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 683466d5ea..338dd0cd76 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -78,6 +78,6 @@ Pop-Location Write-Host "## Manifest of Installed Files ##" $Env:ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; -python -c "from conda_build.utils import prefix_files; import os; with open(os.getenv('ManifestFile', 'w')) as f: f.write(prefix_files(os.getenv('PREFIX'));" +python -c "from conda_build.utils import prefix_files; import os; open(os.getenv('ManifestFile'), 'w').write(prefix_files(os.getenv('PREFIX')))" Get-ChildItem -Recurse $TargetDirectory | Out-File $Env:ManifestFile; Write-Host "##vso[task.uploadfile]$Env:ManifestFile" From 9e66ee45075b28e511c91c3e4e8cc6bc8ec72248 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 19:48:39 -0700 Subject: [PATCH 75/84] undo diagnostics. --- conda-recipes/iqsharp/build.ps1 | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/conda-recipes/iqsharp/build.ps1 b/conda-recipes/iqsharp/build.ps1 index 338dd0cd76..be528809ac 100644 --- a/conda-recipes/iqsharp/build.ps1 +++ b/conda-recipes/iqsharp/build.ps1 @@ -77,7 +77,6 @@ Push-Location $TargetDirectory Pop-Location Write-Host "## Manifest of Installed Files ##" -$Env:ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; -python -c "from conda_build.utils import prefix_files; import os; open(os.getenv('ManifestFile'), 'w').write(prefix_files(os.getenv('PREFIX')))" -Get-ChildItem -Recurse $TargetDirectory | Out-File $Env:ManifestFile; -Write-Host "##vso[task.uploadfile]$Env:ManifestFile" +$ManifestFile = New-TemporaryFile | Select-Object -ExpandProperty FullName; +Get-ChildItem -Recurse $TargetDirectory | Out-File $ManifestFile; +Write-Host "##vso[task.uploadfile]$ManifestFile" From 311fd0be33b49de0ee2b6d61fc23a48a3aa5fd30 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 19:50:52 -0700 Subject: [PATCH 76/84] Workaround for conda/conda-build#3736. --- build/steps-conda.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/steps-conda.yml b/build/steps-conda.yml index 18a970e920..bc8694cef7 100644 --- a/build/steps-conda.yml +++ b/build/steps-conda.yml @@ -9,7 +9,7 @@ steps: ## - task: CondaEnvironment@1 inputs: - packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build=3.18.8" + packageSpecs: "python=3.6 pip setuptools pytest jupyter conda-build=3.18.8 conda-package-handling=1.3.11" displayName: 'Use conda environment w/ Python 3.6' - task: UseDotNet@2 From 35b4a6fffbfe83528abf7d53c491749ce1548725 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 20:12:19 -0700 Subject: [PATCH 77/84] Workaround for conda/conda-build#3170. --- build/pack-conda.ps1 | 4 ++-- conda-recipes/iqsharp/conda_build_config.yaml | 3 +++ conda-recipes/qsharp/conda_build_config.yaml | 3 +++ 3 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 conda-recipes/iqsharp/conda_build_config.yaml create mode 100644 conda-recipes/qsharp/conda_build_config.yaml diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index ab6e33c3ff..b3a07f2a9b 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -27,9 +27,9 @@ function Pack-CondaRecipe() { # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path) --debug --keep-going; + conda build (Resolve-Path $Path); } catch { - Write-Host "##vso[task.logissue type=warning;]$_"; + Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; } finally { $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; diff --git a/conda-recipes/iqsharp/conda_build_config.yaml b/conda-recipes/iqsharp/conda_build_config.yaml new file mode 100644 index 0000000000..84c776e7aa --- /dev/null +++ b/conda-recipes/iqsharp/conda_build_config.yaml @@ -0,0 +1,3 @@ +# Workaround for conda/conda-build#3170. +numpy: + - 1.11 diff --git a/conda-recipes/qsharp/conda_build_config.yaml b/conda-recipes/qsharp/conda_build_config.yaml new file mode 100644 index 0000000000..84c776e7aa --- /dev/null +++ b/conda-recipes/qsharp/conda_build_config.yaml @@ -0,0 +1,3 @@ +# Workaround for conda/conda-build#3170. +numpy: + - 1.11 From aa93293c20817b156583acbf4b291de0150902cd Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 20:22:14 -0700 Subject: [PATCH 78/84] Trying again to redirect stderr. --- build/pack-conda.ps1 | 4 ++-- conda-recipes/iqsharp/conda_build_config.yaml | 3 --- conda-recipes/qsharp/conda_build_config.yaml | 3 --- 3 files changed, 2 insertions(+), 8 deletions(-) delete mode 100644 conda-recipes/iqsharp/conda_build_config.yaml delete mode 100644 conda-recipes/qsharp/conda_build_config.yaml diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index b3a07f2a9b..63d4af155c 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -23,11 +23,11 @@ function Pack-CondaRecipe() { } # conda-build prints some warnings to stderr, which can lead to false positives. - # We wrap in a try-finally to make sure we can condition on the exit code and not on + # We wrap in a try-finally to make sure we can condition on the built file being there, and not on # writing to stderr. try { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path); + conda build (Resolve-Path $Path) *>&1; } catch { Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; } finally { diff --git a/conda-recipes/iqsharp/conda_build_config.yaml b/conda-recipes/iqsharp/conda_build_config.yaml deleted file mode 100644 index 84c776e7aa..0000000000 --- a/conda-recipes/iqsharp/conda_build_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# Workaround for conda/conda-build#3170. -numpy: - - 1.11 diff --git a/conda-recipes/qsharp/conda_build_config.yaml b/conda-recipes/qsharp/conda_build_config.yaml deleted file mode 100644 index 84c776e7aa..0000000000 --- a/conda-recipes/qsharp/conda_build_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -# Workaround for conda/conda-build#3170. -numpy: - - 1.11 From 646299ff0a6779057a68041f1fa67a110ada5c50 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 21:02:29 -0700 Subject: [PATCH 79/84] trying one more time to suppress stderr. --- build/pack-conda.ps1 | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 63d4af155c..7b9660458b 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -25,26 +25,23 @@ function Pack-CondaRecipe() { # conda-build prints some warnings to stderr, which can lead to false positives. # We wrap in a try-finally to make sure we can condition on the built file being there, and not on # writing to stderr. - try { - Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - conda build (Resolve-Path $Path) *>&1; - } catch { - Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; - } finally { - $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); - New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; - $PackagePath = (conda build (Resolve-Path $Path) --output); - if (Test-Path $PackagePath) { - Copy-Item ` - $PackagePath ` - $TargetDir ` - -ErrorAction Continue ` - -Verbose; - Write-Host "##[info]Copied $PackagePath to $TargetDir."; - } else { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False - } + Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" + # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda + # to output all log messages to stdout instead of stderr. + conda build (Resolve-Path $Path) *>&1 | ForEach-Object { "$_" }; + $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); + New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; + $PackagePath = (conda build (Resolve-Path $Path) --output); + if (Test-Path $PackagePath) { + Copy-Item ` + $PackagePath ` + $TargetDir ` + -ErrorAction Continue ` + -Verbose; + Write-Host "##[info]Copied $PackagePath to $TargetDir."; + } else { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False } } From 86a5a87964a0dcc7b6fe95a70583f1ac5b3c745e Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 21:06:10 -0700 Subject: [PATCH 80/84] Putting try catch back. --- build/pack-conda.ps1 | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 7b9660458b..cfaa4b248e 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -25,23 +25,28 @@ function Pack-CondaRecipe() { # conda-build prints some warnings to stderr, which can lead to false positives. # We wrap in a try-finally to make sure we can condition on the built file being there, and not on # writing to stderr. - Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda - # to output all log messages to stdout instead of stderr. - conda build (Resolve-Path $Path) *>&1 | ForEach-Object { "$_" }; - $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); - New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; - $PackagePath = (conda build (Resolve-Path $Path) --output); - if (Test-Path $PackagePath) { - Copy-Item ` - $PackagePath ` - $TargetDir ` - -ErrorAction Continue ` - -Verbose; - Write-Host "##[info]Copied $PackagePath to $TargetDir."; - } else { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False + try { + Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" + # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda + # to output all log messages to stdout instead of stderr. + conda build (Resolve-Path $Path) *>&1 | ForEach-Object { "$_" }; + } catch { + Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; + } finally { + $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); + New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; + $PackagePath = (conda build (Resolve-Path $Path) --output); + if (Test-Path $PackagePath) { + Copy-Item ` + $PackagePath ` + $TargetDir ` + -ErrorAction Continue ` + -Verbose; + Write-Host "##[info]Copied $PackagePath to $TargetDir."; + } else { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." + $script:all_ok = $False + } } } From d6c2e0ad02fc2fdada905051b52c5b603b34074b Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 21:09:33 -0700 Subject: [PATCH 81/84] Redirect just stderr. --- build/pack-conda.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index cfaa4b248e..8531537269 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -29,7 +29,7 @@ function Pack-CondaRecipe() { Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda # to output all log messages to stdout instead of stderr. - conda build (Resolve-Path $Path) *>&1 | ForEach-Object { "$_" }; + conda build (Resolve-Path $Path) 2>&1 | ForEach-Object { "$_" }; } catch { Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; } finally { From 9f9ebcc6377866cd5656ba171aed1da333a38ea1 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Wed, 18 Sep 2019 21:17:25 -0700 Subject: [PATCH 82/84] Downgrade error action as well. --- build/pack-conda.ps1 | 3 +++ 1 file changed, 3 insertions(+) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 8531537269..6a11c745a8 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -26,6 +26,8 @@ function Pack-CondaRecipe() { # We wrap in a try-finally to make sure we can condition on the built file being there, and not on # writing to stderr. try { + $OldPreference = $ErrorActionPreference; + $ErrorActionPreference = "Continue"; Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda # to output all log messages to stdout instead of stderr. @@ -33,6 +35,7 @@ function Pack-CondaRecipe() { } catch { Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; } finally { + $ErrorActionPreference = $OldPreference; $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; $PackagePath = (conda build (Resolve-Path $Path) --output); From 5b26947a8e23eabeb3a3e5a50f57d3f0711576d4 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 19 Sep 2019 12:49:27 -0700 Subject: [PATCH 83/84] Build 3.6 and 3.7 versions. --- .ionide/symbolCache.db | Bin 0 -> 8192 bytes .vscode/launch.json | 27 +++ .vscode/tasks.json | 42 +++++ build/pack-conda.ps1 | 14 +- src/Tool/Tool.csproj.orig | 54 ++++++ src/Tool/Tool.csproj.rej | 11 ++ .../miniconda/.devcontainer/devcontainer.json | 3 + test-containers/miniconda/Untitled.ipynb | 157 ++++++++++++++++++ test-containers/miniconda/environment.yml | 5 + 9 files changed, 308 insertions(+), 5 deletions(-) create mode 100644 .ionide/symbolCache.db create mode 100644 .vscode/launch.json create mode 100644 .vscode/tasks.json create mode 100644 src/Tool/Tool.csproj.orig create mode 100644 src/Tool/Tool.csproj.rej create mode 100644 test-containers/miniconda/.devcontainer/devcontainer.json create mode 100644 test-containers/miniconda/Untitled.ipynb create mode 100644 test-containers/miniconda/environment.yml diff --git a/.ionide/symbolCache.db b/.ionide/symbolCache.db new file mode 100644 index 0000000000000000000000000000000000000000..7566b892d76f260794b11357519846336185d385 GIT binary patch literal 8192 zcmeI#K}*9h6bJBR2%<3X=3$o{6~v2v0J|-NLfLffL66zYFpxB*eFb;-;`i`_n!4?v zbFF9jKN>=sm-O*VFG(K~Lt3nS=@f|@cE&hocS116cxb)QcF~NFc7xD2U8ZE-d5YLH=4^RlOl_T zi4@zH7pLM!OpMi2<+RA;V|KMSosudkF}W7;^w9Lk+uG&7C&>Ky@aizxwl=ONrFUb! zGPxn+b1|IF5*bbRtK4KpM5S5O;nv!bIP$KjNi}=Q*P_%_^@rWZrYaOIUsCHSc7@eW z=bJscK6kH(blF*cwk}#K-yGniwzloGzW#uwQmfXTd2yBarLw#7zn%SMb2kr{egp&{ Y009U<00Izz00bZa0SG_<0{>Xx69oRB!2kdN literal 0 HcmV?d00001 diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000..859aaf41e3 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,27 @@ +{ + // Use IntelliSense to find out which attributes exist for C# debugging + // Use hover for the description of the existing attributes + // For further information visit https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md + "version": "0.2.0", + "configurations": [ + { + "name": ".NET Core Launch (console)", + "type": "coreclr", + "request": "launch", + "preLaunchTask": "build", + // If you have changed target frameworks, make sure to update the program path. + "program": "${workspaceFolder}/src/Tool/bin/Debug/netcoreapp2.2/Microsoft.Quantum.IQSharp.dll", + "args": [], + "cwd": "${workspaceFolder}/src/Tool", + // For more information about the 'console' field, see https://aka.ms/VSCode-CS-LaunchJson-Console + "console": "internalConsole", + "stopAtEntry": false + }, + { + "name": ".NET Core Attach", + "type": "coreclr", + "request": "attach", + "processId": "${command:pickProcess}" + } + ] +} \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000000..905dcd2b88 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,42 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build", + "command": "dotnet", + "type": "process", + "args": [ + "build", + "${workspaceFolder}/src/Tool/Tool.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "publish", + "command": "dotnet", + "type": "process", + "args": [ + "publish", + "${workspaceFolder}/src/Tool/Tool.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + }, + { + "label": "watch", + "command": "dotnet", + "type": "process", + "args": [ + "watch", + "run", + "${workspaceFolder}/src/Tool/Tool.csproj", + "/property:GenerateFullPaths=true", + "/consoleloggerparameters:NoSummary" + ], + "problemMatcher": "$msCompile" + } + ] +} \ No newline at end of file diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 6a11c745a8..31ce1eab03 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -13,7 +13,8 @@ $PSVersionTable | Format-Table | Out-String | Write-Host; function Pack-CondaRecipe() { param( - [string] $Path + [string] $Path, + [string[]] $PythonVersions = @("3.6", "3.7") ); if (-not (Get-Command conda-build -ErrorAction SilentlyContinue)) { @@ -28,10 +29,13 @@ function Pack-CondaRecipe() { try { $OldPreference = $ErrorActionPreference; $ErrorActionPreference = "Continue"; - Write-Host "##[info]Running: conda build $(Resolve-Path $Path)" - # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda - # to output all log messages to stdout instead of stderr. - conda build (Resolve-Path $Path) 2>&1 | ForEach-Object { "$_" }; + $PythonVersions | ` + ForEach-Object { + Write-Host "##[info]Running: conda build $(Resolve-Path $Path) --python=$_" + # See https://stackoverflow.com/a/20950421/267841 for why this works to force conda + # to output all log messages to stdout instead of stderr. + conda build (Resolve-Path $Path) --python=$_ 2>&1 | ForEach-Object { "$_" }; + } } catch { Write-Host "##vso[task.logissue type=warning;]conda build error: $_"; } finally { diff --git a/src/Tool/Tool.csproj.orig b/src/Tool/Tool.csproj.orig new file mode 100644 index 0000000000..a57eeeec46 --- /dev/null +++ b/src/Tool/Tool.csproj.orig @@ -0,0 +1,54 @@ + + + + Exe + x64 + netcoreapp2.2 + Microsoft.Quantum.IQSharp + Microsoft.Quantum.IQSharp + + + + 0162 + Microsoft + Microsoft's IQ# Server. + © Microsoft Corporation. All rights reserved. + See: https://docs.microsoft.com/en-us/quantum/relnotes/ + MIT + https://github.com/Microsoft/Quantum + https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png + Quantum Q# Qsharp + true + dotnet-iqsharp + Microsoft.Quantum.IQSharp + \ + + + + + + + + + + PreserveNewest + + + + + + + + + + + + + + + + + + + + diff --git a/src/Tool/Tool.csproj.rej b/src/Tool/Tool.csproj.rej new file mode 100644 index 0000000000..4cf8879dd1 --- /dev/null +++ b/src/Tool/Tool.csproj.rej @@ -0,0 +1,11 @@ +--- src/Tool/Tool.csproj ++++ src/Tool/Tool.csproj +@@ -18,7 +18,7 @@ + https://github.com/Microsoft/Quantum + https://secure.gravatar.com/avatar/bd1f02955b2853ba0a3b1cdc2434e8ec.png + Quantum Q# Qsharp +- true ++ false + dotnet-iqsharp + Microsoft.Quantum.IQSharp + \ diff --git a/test-containers/miniconda/.devcontainer/devcontainer.json b/test-containers/miniconda/.devcontainer/devcontainer.json new file mode 100644 index 0000000000..07fc1a792e --- /dev/null +++ b/test-containers/miniconda/.devcontainer/devcontainer.json @@ -0,0 +1,3 @@ +{ + "image": "continuumio/miniconda3" +} diff --git a/test-containers/miniconda/Untitled.ipynb b/test-containers/miniconda/Untitled.ipynb new file mode 100644 index 0000000000..25d3830adf --- /dev/null +++ b/test-containers/miniconda/Untitled.ipynb @@ -0,0 +1,157 @@ +{ + "cells": [ + { + "cell_type": "code", + "execution_count": 1, + "metadata": {}, + "outputs": [ + { + "data": { + "application/json": "[\"Hello\"]", + "text/html": [ + "
  • Hello
" + ], + "text/plain": [ + "Hello" + ] + }, + "execution_count": 1, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "function Hello() : Unit {\n", + " Message(\"Hi!\");\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 2, + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Hi!\n" + ] + }, + { + "data": { + "application/json": "{\"@type\":\"tuple\"}", + "text/plain": [ + "()" + ] + }, + "execution_count": 2, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%simulate Hello" + ] + }, + { + "cell_type": "code", + "execution_count": 3, + "metadata": {}, + "outputs": [ + { + "data": { + "application/json": "[\"SampleQrng\"]", + "text/html": [ + "
  • SampleQrng
" + ], + "text/plain": [ + "SampleQrng" + ] + }, + "execution_count": 3, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "open Microsoft.Quantum.Measurement;\n", + "\n", + "operation SampleQrng() : Result {\n", + " using (q = Qubit()) {\n", + " return MResetX(q);\n", + " }\n", + "}" + ] + }, + { + "cell_type": "code", + "execution_count": 6, + "metadata": {}, + "outputs": [ + { + "data": { + "application/json": "1", + "text/plain": [ + "One" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" + } + ], + "source": [ + "%simulate SampleQrng" + ] + }, + { + "cell_type": "code", + "execution_count": 7, + "metadata": {}, + "outputs": [ + { + "data": { + "application/json": "{\"rows\":[{\"@type\":\"@tuple\",\"Item1\":\"iqsharp\",\"Item2\":\"1.0.0.0\"},{\"@type\":\"@tuple\",\"Item1\":\"Jupyter Core\",\"Item2\":\"1.1.3712.0\"}]}", + "text/html": [ + "
ComponentVersion
iqsharp1.0.0.0
Jupyter Core1.1.3712.0
" + ], + "text/plain": [ + "Component Version\n", + "------------ ----------\n", + "iqsharp 1.0.0.0\n", + "Jupyter Core 1.1.3712.0\n" + ] + }, + "metadata": {}, + "output_type": "display_data" + } + ], + "source": [ + "%version" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Q#", + "language": "qsharp", + "name": "iqsharp" + }, + "language_info": { + "file_extension": ".qs", + "mimetype": "text/x-qsharp", + "name": "qsharp", + "version": "0.4" + } + }, + "nbformat": 4, + "nbformat_minor": 2 +} diff --git a/test-containers/miniconda/environment.yml b/test-containers/miniconda/environment.yml new file mode 100644 index 0000000000..6497fae721 --- /dev/null +++ b/test-containers/miniconda/environment.yml @@ -0,0 +1,5 @@ +name: qsharp +channels: +- quantum-engineering +dependencies: +- qsharp From 739b88f0b6e74d39a7da9ef24a49fd981ef984f8 Mon Sep 17 00:00:00 2001 From: Christopher Granade Date: Thu, 19 Sep 2019 13:46:27 -0700 Subject: [PATCH 84/84] Adding python version to outputs as well. --- build/pack-conda.ps1 | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/build/pack-conda.ps1 b/build/pack-conda.ps1 index 31ce1eab03..9fc1c601a4 100644 --- a/build/pack-conda.ps1 +++ b/build/pack-conda.ps1 @@ -42,18 +42,21 @@ function Pack-CondaRecipe() { $ErrorActionPreference = $OldPreference; $TargetDir = (Join-Path $Env:CONDA_OUTDIR $CondaPlatform); New-Item -ItemType Directory -Path $TargetDir -Force -ErrorAction SilentlyContinue; - $PackagePath = (conda build (Resolve-Path $Path) --output); - if (Test-Path $PackagePath) { - Copy-Item ` - $PackagePath ` - $TargetDir ` - -ErrorAction Continue ` - -Verbose; - Write-Host "##[info]Copied $PackagePath to $TargetDir."; - } else { - Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path." - $script:all_ok = $False - } + $PythonVersions | ` + ForEach-Object { + $PackagePath = (conda build (Resolve-Path $Path) --python=$_ --output); + if (Test-Path $PackagePath) { + Copy-Item ` + $PackagePath ` + $TargetDir ` + -ErrorAction Continue ` + -Verbose; + Write-Host "##[info]Copied $PackagePath to $TargetDir."; + } else { + Write-Host "##vso[task.logissue type=error;]Failed to create conda package for $Path (Python $_)." + $script:all_ok = $False + } + } } }