forked from microsoft/azure-quantum-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
bootstrap.ps1
47 lines (36 loc) · 1.52 KB
/
bootstrap.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
<#
.SYNOPSIS
Bootstrap: set up a Python environment using Anaconda using the corresponding
environment.yml file. Install the specified package in the environment,
either from Source or from PyPI. Takes optional input arguments PackageName,
CondaEnvironmentSuffix and FromSource:
If no PackageName is specified, this script searches the root directory and runs
bootstrap for all packages.
The CondaEnvironmentSuffix is used to find an alternate environment yml, for
instance environment<CondaEnvironmentSuffix>.yml.
FromWheel determines if the package is installed from a wheel on PyPI (if True)
or from source using <pip install -e> (if False) and defaults to False.
#>
param(
[string] $PackageName,
[string] $CondaEnvironmentSuffix,
[bool] $FromWheel
)
if ($False -eq $FromWheel) {
$FromSource = $True;
} else {
$FromSource = $False;
}
Write-Host $FromSource;
# Set env vars
& (Join-Path $PSScriptRoot "build" "set-env.ps1");
# Import Conda utils
Import-Module (Join-Path $PSScriptRoot "build" "package-utils.psm1");
# Enable conda hook
Enable-Conda
# Create environment
New-CondaEnvironment -PackageName $PackageName -CondaEnvironmentSuffix $CondaEnvironmentSuffix
# Install package in environment
Install-PackageInEnv -PackageName $PackageName -CondaEnvironmentSuffix $CondaEnvironmentSuffix -FromSource $FromSource