Skip to content

Commit

Permalink
updates to bootstrap to reflect the current build settings (bioconda#…
Browse files Browse the repository at this point in the history
  • Loading branch information
daler authored and luizirber committed Jun 23, 2018
1 parent 9e536f9 commit a5047d6
Showing 1 changed file with 31 additions and 25 deletions.
56 changes: 31 additions & 25 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@

# This is the "common" step in the CircleCI config which gets the versions of
# Miniconda and bioconda-utils that we're using.
#urlretrieve(
# 'https://raw.githubusercontent.com/bioconda/bioconda-common/master/common.sh',
# filename='.circleci/common.sh')
urlretrieve(
'https://raw.githubusercontent.com/bioconda/bioconda-common/master/common.sh',
filename='.circleci/common.sh')

# TODO: this mimics the override in the "common" job in .circleci/config.yaml
with open('.circleci/common.sh', 'w') as fout:
fout.write("MINICONDA_VER=4.5.4\nBIOCONDA_UTILS_TAG=cb3-migration\n")

local_config_path = os.path.expanduser('~/.config/bioconda/activate')

Expand All @@ -67,29 +70,32 @@ def _write_custom_activate(install_path):
activate = os.path.join(install_path, 'miniconda/bin/activate')
lines = [i.rstrip() for i in open(activate)]

# Exact matches to lines we want to replace in the activate script, leading
# space included.
substitutions = [
(
'_CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")',
'_CONDA_DIR="{0}/miniconda/bin"'.format(install_path)
),
(
' export PS1="(${CONDA_DEFAULT_ENV}) $PS1"',
' export PS1="(BIOCONDA-UTILS) $PS1"',
)
]

for orig, sub in substitutions:
# Be very picky so that we'll know if/when the activate script changes.
try:
pos = lines.index(orig)
except ValueError:
raise ValueError(
"Expecting '{0}' to be in {1} but couldn't find it"
.format(orig, activate)

# The following is code from cb2; disabling but keeping it around for now:
if 0:
# Exact matches to lines we want to replace in the activate script, leading
# space included.
substitutions = [
(
'_CONDA_DIR=$(dirname "$_SCRIPT_LOCATION")',
'_CONDA_DIR="{0}/miniconda/bin"'.format(install_path)
),
(
' export PS1="(${CONDA_DEFAULT_ENV}) $PS1"',
' export PS1="(BIOCONDA-UTILS) $PS1"',
)
lines[pos] = sub
]

for orig, sub in substitutions:
# Be very picky so that we'll know if/when the activate script changes.
try:
pos = lines.index(orig)
except ValueError:
raise ValueError(
"Expecting '{0}' to be in {1} but couldn't find it"
.format(orig, activate)
)
lines[pos] = sub

with open(local_config_path, 'w') as fout:
for line in lines:
Expand Down

0 comments on commit a5047d6

Please sign in to comment.