-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
28 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
source activate base |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,34 @@ | ||
import * as path from 'path' | ||
import * as exec from '@actions/exec' | ||
import * as core from '@actions/core' | ||
|
||
const IS_WINDOWS = process.platform === 'win32' | ||
// Miniconda has "scripts" or "bin" directories where command-line tools that come with packages are installed. | ||
// This is where pip is, along with anything that pip installs. | ||
// There is a seperate directory for `pip install --user`. | ||
// | ||
// For reference, these directories are as follows: | ||
// macOS / Linux: | ||
// <sys.prefix>/bin (by default /usr/local/bin, but not on hosted agents -- see the `else`) | ||
// (--user) ~/.local/bin | ||
// Windows: | ||
// <Miniconda installation dir>\Scripts | ||
// (--user) %APPDATA%\Python\PythonXY\Scripts | ||
// See https://docs.python.org/3/library/sysconfig.html | ||
import { ConfigObject } from './load_config' | ||
|
||
function binDir(installDir: string): string { | ||
if (IS_WINDOWS) { | ||
function binDir(installDir: string, config: ConfigObject): string { | ||
if (config.os === 'win32') { | ||
return path.join(installDir, 'Scripts') | ||
} else { | ||
return path.join(installDir, 'bin') | ||
} | ||
} | ||
|
||
export const init_conda = () => { | ||
console.log(`process.env.CONDA: ${process.env.CONDA}`) | ||
export const init_conda = async (config: ConfigObject): Promise<void> => { | ||
await addCondaToPath(config) | ||
await activate_conda(config) | ||
} | ||
|
||
const addCondaToPath = async (config: ConfigObject): Promise<void> => { | ||
console.log(`Adding conda path to path: ${process.env.CONDA}`) | ||
const conda_base_path = process.env.CONDA as string | ||
const bin_dir = binDir(conda_base_path) | ||
const bin_dir = binDir(conda_base_path, config) | ||
core.addPath(conda_base_path) | ||
core.addPath(bin_dir) | ||
} | ||
|
||
const activate_conda = async (config: ConfigObject): Promise<void> => { | ||
if (config.os === 'win32') { | ||
await exec.exec('activate.bat', ['base']) | ||
} else { | ||
await exec.exec('bash', ['src/activate_conda.sh']) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters