Skip to content

Commit 32aaae3

Browse files
authored
Merge branch 'master' into separate-conda-package-metadata
2 parents 258e926 + aa8c876 commit 32aaae3

20 files changed

+780
-333
lines changed

.cla-signers

+3-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
1-
# New contributors should email [email protected] to request a Contributor License Agreement
2-
# that can be electronically signed. A signed contributor license agreement for a pull request
3-
# author needs to be on file with Anaconda, Inc. for pull requests to be merged. This file,
4-
# while not an official record, is used by conda-bot for the purposes of CLA status on pull
5-
# requests.
1+
# A signed contributor license agreement for a pull request author needs to be on file with
2+
# Anaconda, Inc. for pull requests to be merged. This file, while not an official record,
3+
# is used by conda-bot for the purposes of CLA status on pull requests.
64

75
# Each row in this file has three fields. The first field is github username. The second field
86
# is git id, the output of `git log -n1 --format="%aN <%aE>"` when HEAD is at a specific user's

CONTRIBUTING.md

+5-4
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ In case you're new to CLAs, this is rather standard procedure for larger project
107107

108108
### Process
109109

110-
New contributors should email [email protected] to request a Contributor License Agreement that
111-
can be electronically signed. A signed contributor license agreement for a pull request author
112-
needs to be on file with Anaconda, Inc. for pull requests to be merged. A record of signatories is
113-
kept in the [`.cla-signers`](https://github.com/conda/conda/blob/master/.cla-signers) file in the
110+
New contributors should complete the Conda Contributor License Agreement located
111+
[here](https://conda.io/en/latest/contributing.html#conda-contributor-license-agreement). A
112+
signed contributor license agreement for a pull request author needs to be on file with
113+
Anaconda, Inc. for pull requests to be merged. A record of signatories is kept in the
114+
[`.cla-signers`](https://github.com/conda/conda/blob/master/.cla-signers) file in the
114115
project root.
115116

116117
### Individual Contributor License Agreement – Conda Code Organization

circle.yml

+9-2
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ conda_build_test: &conda_build_test
7777
echo "safety_checks: disabled" >> ~/.condarc
7878
echo "local_repodata_ttl: 1800" >> ~/.condarc
7979
conda create -n blarg -yq --download-only python=2.7
80-
conda create -n blarg -yq --download-only python=3.4
80+
conda create -n blarg -yq -c https://repo.anaconda.com/pkgs/free --download-only python=3.4
8181
conda create -n blarg -yq --download-only python=3.5
8282
conda create -n blarg -yq --download-only python=3.6
8383
conda create -n blarg -yq --download-only python=3.7
8484
conda create -n blarg -yq --download-only python setuptools cython certifi
85-
conda create -n blarg -yq --download-only libpng=1.6.17
85+
conda create -n blarg -yq -c https://repo.anaconda.com/pkgs/free --download-only libpng=1.6.17
8686
8787
- run:
8888
name: conda-build conda
@@ -141,6 +141,9 @@ conda_build_test: &conda_build_test
141141
echo "Only docs changed detected, skipping tests"
142142
else
143143
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
144+
conda config --add default_channels https://repo.anaconda.com/pkgs/free
145+
conda config --add default_channels https://repo.anaconda.com/pkgs/r
146+
conda config --add default_channels https://repo.anaconda.com/pkgs/main
144147
conda info
145148
cd ~/conda-build
146149
py.test --basetemp /tmp/cb -v --durations=20 -n 2 -m "not serial" tests -k "$CONDABUILD_SKIP"
@@ -169,6 +172,10 @@ conda_build_test: &conda_build_test
169172
echo "Only docs changed detected, skipping tests"
170173
else
171174
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
175+
conda config --add default_channels https://repo.anaconda.com/pkgs/free
176+
conda config --add default_channels https://repo.anaconda.com/pkgs/r
177+
conda config --add default_channels https://repo.anaconda.com/pkgs/main
178+
conda info
172179
cd ~/conda-build
173180
py.test --basetemp /tmp/cb -v --durations=20 -n 0 -m "serial" tests -k "$CONDABUILD_SKIP"
174181
/opt/conda/bin/python -m conda.common.io

conda/activate.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -838,7 +838,7 @@ def __init__(self, arguments=None):
838838
self.sep = '/'
839839
self.path_conversion = native_path_to_unix
840840
self.script_extension = '.xsh'
841-
self.tempfile_extension = '.xsh'
841+
self.tempfile_extension = None
842842
self.command_join = '\n'
843843

844844
self.unset_var_tmpl = 'del $%s'
@@ -851,7 +851,7 @@ def __init__(self, arguments=None):
851851
super(XonshActivator, self).__init__(arguments)
852852

853853
def _hook_preamble(self):
854-
return 'CONDA_EXE = "%s"' % context.conda_exe
854+
return '$CONDA_EXE = "%s"' % context.conda_exe
855855

856856

857857
class CmdExeActivator(_Activator):

conda/base/constants.py

-2
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,11 @@
7878

7979
DEFAULT_CHANNELS_UNIX = (
8080
'https://repo.anaconda.com/pkgs/main',
81-
'https://repo.anaconda.com/pkgs/free',
8281
'https://repo.anaconda.com/pkgs/r',
8382
)
8483

8584
DEFAULT_CHANNELS_WIN = (
8685
'https://repo.anaconda.com/pkgs/main',
87-
'https://repo.anaconda.com/pkgs/free',
8886
'https://repo.anaconda.com/pkgs/r',
8987
'https://repo.anaconda.com/pkgs/msys2',
9088
)

conda/base/context.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,7 @@ class Context(Configuration):
217217
show_channel_urls = PrimitiveParameter(None, element_type=(bool, NoneType))
218218
use_local = PrimitiveParameter(False)
219219
whitelist_channels = SequenceParameter(string_types, expandvars=True)
220+
restore_free_channel = PrimitiveParameter(False)
220221

221222
always_softlink = PrimitiveParameter(False, aliases=('softlink',))
222223
always_copy = PrimitiveParameter(False, aliases=('copy',))
@@ -544,8 +545,12 @@ def default_channels(self):
544545
def custom_multichannels(self):
545546
from ..models.channel import Channel
546547

548+
default_channels = list(self._default_channels)
549+
if self.restore_free_channel:
550+
default_channels.insert(1, 'https://repo.anaconda.com/pkgs/free')
551+
547552
reserved_multichannel_urls = odict((
548-
(DEFAULTS_CHANNEL_NAME, self._default_channels),
553+
(DEFAULTS_CHANNEL_NAME, default_channels),
549554
('local', self.conda_build_local_urls),
550555
))
551556
reserved_multichannels = odict(
@@ -713,6 +718,7 @@ def category_map(self):
713718
'migrated_custom_channels',
714719
'add_anaconda_token',
715720
'allow_non_channel_urls',
721+
'restore_free_channel',
716722
)),
717723
('Basic Conda Configuration', ( # TODO: Is there a better category name here?
718724
'envs_dirs',
@@ -1062,6 +1068,10 @@ def description_map(self):
10621068
reports are anonymous, with only the error stack trace and information given
10631069
by `conda info` being sent.
10641070
"""),
1071+
'restore_free_channel': dals(""""
1072+
Add the "free" channel back into defaults, behind "main" in priority. The "free"
1073+
channel was removed from the collection of default channels in conda 4.7.0.
1074+
"""),
10651075
'rollback_enabled': dals("""
10661076
Should any error occur during an unlink/link transaction, revert any disk
10671077
mutations made to that point in the transaction.

conda/core/initialize.py

+113-2
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def make_install_plan(conda_prefix):
414414
plan.append({
415415
'function': install_conda_xsh.__name__,
416416
'kwargs': {
417-
'target_path': join(site_packages_dir, 'xonsh', 'conda.xsh'),
417+
'target_path': join(site_packages_dir, 'xontrib', 'conda.xsh'),
418418
'conda_prefix': conda_prefix,
419419
},
420420
})
@@ -493,6 +493,32 @@ def make_initialize_plan(conda_prefix, shells, for_user, for_system, anaconda_pr
493493
},
494494
})
495495

496+
if 'xonsh' in shells:
497+
if for_user:
498+
config_xonsh_path = expand(join('~', '.xonshrc'))
499+
plan.append({
500+
'function': init_xonsh_user.__name__,
501+
'kwargs': {
502+
'target_path': config_xonsh_path,
503+
'conda_prefix': conda_prefix,
504+
'reverse': reverse,
505+
},
506+
})
507+
508+
if for_system:
509+
if on_win:
510+
config_xonsh_path = expand(join('%ALLUSERSPROFILE%', 'xonsh', 'xonshrc'))
511+
else:
512+
config_xonsh_path = '/etc/xonshrc'
513+
plan.append({
514+
'function': init_xonsh_user.__name__,
515+
'kwargs': {
516+
'target_path': config_xonsh_path,
517+
'conda_prefix': conda_prefix,
518+
'reverse': reverse,
519+
},
520+
})
521+
496522
if 'tcsh' in shells and for_user:
497523
tcshrc_path = expand(join('~', '.tcshrc'))
498524
plan.append({
@@ -973,7 +999,7 @@ def _config_fish_content(conda_prefix):
973999
conda_initialize_content = dals("""
9741000
# >>> conda initialize >>>
9751001
# !! Contents within this block are managed by 'conda init' !!
976-
eval (eval %(conda_exe)s "shell.fish" "hook" $argv)
1002+
eval %(conda_exe)s "shell.fish" "hook" $argv | source
9771003
# <<< conda initialize <<<
9781004
""") % {
9791005
'conda_exe': conda_exe,
@@ -1066,6 +1092,91 @@ def init_fish_user(target_path, conda_prefix, reverse):
10661092
return Result.NO_CHANGE
10671093

10681094

1095+
def _config_xonsh_content(conda_prefix):
1096+
if on_win:
1097+
from ..activate import native_path_to_unix
1098+
conda_exe = native_path_to_unix(join(conda_prefix, 'Scripts', 'conda.exe'))
1099+
else:
1100+
conda_exe = join(conda_prefix, 'bin', 'conda')
1101+
conda_initialize_content = dals("""
1102+
# >>> conda initialize >>>
1103+
# !! Contents within this block are managed by 'conda init' !!
1104+
import sys as _sys
1105+
from types import ModuleType as _ModuleType
1106+
_mod = _ModuleType("xontrib.conda",
1107+
"Autogenerated from $({conda_exe} shell.xonsh hook)")
1108+
__xonsh__.execer.exec($("{conda_exe}" "shell.xonsh" "hook"),
1109+
glbs=_mod.__dict__,
1110+
filename="$({conda_exe} shell.xonsh hook)")
1111+
_sys.modules["xontrib.conda"] = _mod
1112+
del _sys, _mod, _ModuleType
1113+
# <<< conda initialize <<<
1114+
""").format(conda_exe=conda_exe)
1115+
return conda_initialize_content
1116+
1117+
1118+
def init_xonsh_user(target_path, conda_prefix, reverse):
1119+
# target_path: ~/.xonshrc
1120+
user_rc_path = target_path
1121+
1122+
try:
1123+
with open(user_rc_path) as fh:
1124+
rc_content = fh.read()
1125+
except FileNotFoundError:
1126+
rc_content = ''
1127+
except:
1128+
raise
1129+
1130+
rc_original_content = rc_content
1131+
1132+
conda_init_comment = "# commented out by conda initialize"
1133+
conda_initialize_content = _config_xonsh_content(conda_prefix)
1134+
if reverse:
1135+
# uncomment any lines that were commented by prior conda init run
1136+
rc_content = re.sub(
1137+
r"#\s(.*?)\s*{}".format(conda_init_comment),
1138+
r"\1",
1139+
rc_content,
1140+
flags=re.MULTILINE,
1141+
)
1142+
1143+
# remove any conda init sections added
1144+
rc_content = re.sub(
1145+
r"^\s*" + CONDA_INITIALIZE_RE_BLOCK,
1146+
"",
1147+
rc_content,
1148+
flags=re.DOTALL | re.MULTILINE
1149+
)
1150+
else:
1151+
replace_str = "__CONDA_REPLACE_ME_123__"
1152+
rc_content = re.sub(
1153+
CONDA_INITIALIZE_RE_BLOCK,
1154+
replace_str,
1155+
rc_content,
1156+
flags=re.MULTILINE,
1157+
)
1158+
# TODO: maybe remove all but last of replace_str, if there's more than one occurrence
1159+
rc_content = rc_content.replace(replace_str, conda_initialize_content)
1160+
1161+
if "# >>> conda initialize >>>" not in rc_content:
1162+
rc_content += '\n{0}\n'.format(conda_initialize_content)
1163+
1164+
if rc_content != rc_original_content:
1165+
if context.verbosity:
1166+
print('\n')
1167+
print(target_path)
1168+
print(make_diff(rc_original_content, rc_content))
1169+
if not context.dry_run:
1170+
# Make the directory if needed.
1171+
if not exists(dirname(user_rc_path)):
1172+
mkdir_p(dirname(user_rc_path))
1173+
with open(user_rc_path, 'w') as fh:
1174+
fh.write(rc_content)
1175+
return Result.MODIFIED
1176+
else:
1177+
return Result.NO_CHANGE
1178+
1179+
10691180
def _bashrc_content(conda_prefix, shell):
10701181
if on_win:
10711182
from ..activate import native_path_to_unix

0 commit comments

Comments
 (0)