Skip to content

Commit

Permalink
Merge pull request conda#8579 from msarahan/remove_free
Browse files Browse the repository at this point in the history
remove free from defaults.  Provide restore_free_channel config
  • Loading branch information
msarahan authored May 10, 2019
2 parents 8232664 + 4969dd9 commit aa8c876
Show file tree
Hide file tree
Showing 11 changed files with 241 additions and 227 deletions.
11 changes: 9 additions & 2 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,12 @@ conda_build_test: &conda_build_test
echo "safety_checks: disabled" >> ~/.condarc
echo "local_repodata_ttl: 1800" >> ~/.condarc
conda create -n blarg -yq --download-only python=2.7
conda create -n blarg -yq --download-only python=3.4
conda create -n blarg -yq -c https://repo.anaconda.com/pkgs/free --download-only python=3.4
conda create -n blarg -yq --download-only python=3.5
conda create -n blarg -yq --download-only python=3.6
conda create -n blarg -yq --download-only python=3.7
conda create -n blarg -yq --download-only python setuptools cython certifi
conda create -n blarg -yq --download-only libpng=1.6.17
conda create -n blarg -yq -c https://repo.anaconda.com/pkgs/free --download-only libpng=1.6.17
- run:
name: conda-build conda
Expand Down Expand Up @@ -141,6 +141,9 @@ conda_build_test: &conda_build_test
echo "Only docs changed detected, skipping tests"
else
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
conda config --add default_channels https://repo.anaconda.com/pkgs/free
conda config --add default_channels https://repo.anaconda.com/pkgs/r
conda config --add default_channels https://repo.anaconda.com/pkgs/main
conda info
cd ~/conda-build
py.test --basetemp /tmp/cb -v --durations=20 -n 2 -m "not serial" tests -k "$CONDABUILD_SKIP"
Expand Down Expand Up @@ -169,6 +172,10 @@ conda_build_test: &conda_build_test
echo "Only docs changed detected, skipping tests"
else
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
conda config --add default_channels https://repo.anaconda.com/pkgs/free
conda config --add default_channels https://repo.anaconda.com/pkgs/r
conda config --add default_channels https://repo.anaconda.com/pkgs/main
conda info
cd ~/conda-build
py.test --basetemp /tmp/cb -v --durations=20 -n 0 -m "serial" tests -k "$CONDABUILD_SKIP"
/opt/conda/bin/python -m conda.common.io
Expand Down
2 changes: 0 additions & 2 deletions conda/base/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,11 @@

DEFAULT_CHANNELS_UNIX = (
'https://repo.anaconda.com/pkgs/main',
'https://repo.anaconda.com/pkgs/free',
'https://repo.anaconda.com/pkgs/r',
)

DEFAULT_CHANNELS_WIN = (
'https://repo.anaconda.com/pkgs/main',
'https://repo.anaconda.com/pkgs/free',
'https://repo.anaconda.com/pkgs/r',
'https://repo.anaconda.com/pkgs/msys2',
)
Expand Down
12 changes: 11 additions & 1 deletion conda/base/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@ class Context(Configuration):
show_channel_urls = PrimitiveParameter(None, element_type=(bool, NoneType))
use_local = PrimitiveParameter(False)
whitelist_channels = SequenceParameter(string_types, expandvars=True)
restore_free_channel = PrimitiveParameter(False)

always_softlink = PrimitiveParameter(False, aliases=('softlink',))
always_copy = PrimitiveParameter(False, aliases=('copy',))
Expand Down Expand Up @@ -544,8 +545,12 @@ def default_channels(self):
def custom_multichannels(self):
from ..models.channel import Channel

default_channels = list(self._default_channels)
if self.restore_free_channel:
default_channels.insert(1, 'https://repo.anaconda.com/pkgs/free')

reserved_multichannel_urls = odict((
(DEFAULTS_CHANNEL_NAME, self._default_channels),
(DEFAULTS_CHANNEL_NAME, default_channels),
('local', self.conda_build_local_urls),
))
reserved_multichannels = odict(
Expand Down Expand Up @@ -713,6 +718,7 @@ def category_map(self):
'migrated_custom_channels',
'add_anaconda_token',
'allow_non_channel_urls',
'restore_free_channel',
)),
('Basic Conda Configuration', ( # TODO: Is there a better category name here?
'envs_dirs',
Expand Down Expand Up @@ -1062,6 +1068,10 @@ def description_map(self):
reports are anonymous, with only the error stack trace and information given
by `conda info` being sent.
"""),
'restore_free_channel': dals(""""
Add the "free" channel back into defaults, behind "main" in priority. The "free"
channel was removed from the collection of default channels in conda 4.7.0.
"""),
'rollback_enabled': dals("""
Should any error occur during an unlink/link transaction, revert any disk
mutations made to that point in the transaction.
Expand Down
5 changes: 5 additions & 0 deletions tests/base/test_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ def test_custom_multichannels(self):
Channel('learn_from_every_thing'),
)

def test_restore_free_channel(self):
assert 'https://repo.anaconda.com/pkgs/free' not in context.default_channels
with env_var("CONDA_RESTORE_FREE_CHANNEL", 'true', stack_callback=conda_tests_ctxt_mgmt_def_pol):
assert context.default_channels.index('https://repo.anaconda.com/pkgs/free') == 1

def test_proxy_servers(self):
assert context.proxy_servers['http'] == 'http://user:[email protected]:8080'
assert context.proxy_servers['https'] is None
Expand Down
64 changes: 28 additions & 36 deletions tests/models/test_channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ def setUpClass(cls):
cls.platform = context.subdir
cls.DEFAULT_URLS = ['https://repo.anaconda.com/pkgs/main/%s' % cls.platform,
'https://repo.anaconda.com/pkgs/main/noarch',
'https://repo.anaconda.com/pkgs/free/%s' % cls.platform,
'https://repo.anaconda.com/pkgs/free/noarch',
'https://repo.anaconda.com/pkgs/r/%s' % cls.platform,
'https://repo.anaconda.com/pkgs/r/noarch',
]
Expand Down Expand Up @@ -111,19 +109,19 @@ def test_default_channel(self):

def test_url_channel_w_platform(self):
with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
channel = Channel('https://repo.anaconda.com/pkgs/free/osx-64')
channel = Channel('https://repo.anaconda.com/pkgs/main/osx-64')

assert channel.scheme == "https"
assert channel.location == "repo.anaconda.com"
assert channel.platform == 'osx-64' == channel.subdir
assert channel.name == 'pkgs/free'
assert channel.name == 'pkgs/main'

assert channel.base_url == 'https://repo.anaconda.com/pkgs/free'
assert channel.base_url == 'https://repo.anaconda.com/pkgs/main'
assert channel.canonical_name == 'defaults'
assert channel.url() == 'https://repo.anaconda.com/pkgs/free/osx-64'
assert channel.url() == 'https://repo.anaconda.com/pkgs/main/osx-64'
assert channel.urls() == [
'https://repo.anaconda.com/pkgs/free/osx-64',
'https://repo.anaconda.com/pkgs/free/noarch',
'https://repo.anaconda.com/pkgs/main/osx-64',
'https://repo.anaconda.com/pkgs/main/noarch',
]

def test_bare_channel_http(self):
Expand Down Expand Up @@ -160,18 +158,18 @@ def test_bare_channel_file(self):

def test_channel_name_subdir_only(self):
with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
channel = Channel('pkgs/free/win-64')
channel = Channel('pkgs/main/win-64')
assert channel.scheme == "https"
assert channel.location == "repo.anaconda.com"
assert channel.platform == 'win-64' == channel.subdir
assert channel.name == 'pkgs/free'
assert channel.name == 'pkgs/main'

assert channel.base_url == 'https://repo.anaconda.com/pkgs/free'
assert channel.base_url == 'https://repo.anaconda.com/pkgs/main'
assert channel.canonical_name == 'defaults'
assert channel.url() == 'https://repo.anaconda.com/pkgs/free/win-64'
assert channel.url() == 'https://repo.anaconda.com/pkgs/main/win-64'
assert channel.urls() == [
'https://repo.anaconda.com/pkgs/free/win-64',
'https://repo.anaconda.com/pkgs/free/noarch',
'https://repo.anaconda.com/pkgs/main/win-64',
'https://repo.anaconda.com/pkgs/main/noarch',
]


Expand Down Expand Up @@ -356,7 +354,7 @@ def setUp(cls):
def tearDown(cls):
reset_context()

def test_pkgs_free(self):
def test_pkgs_main(self):
channel = Channel('pkgs/anaconda')
assert channel.channel_name == "pkgs/anaconda"
assert channel.channel_location == "192.168.0.15:8080"
Expand Down Expand Up @@ -1050,18 +1048,15 @@ def test_multichannel_priority():
('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 4)),
('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 4)),
('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 4)),
('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 5)),
('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 5)),
('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 5)),
('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/msys2/new-optimized-subdir', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/msys2/linux-32', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/msys2/noarch', ('defaults', 3)),
('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 4)),
('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 4)),
('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 4)),
])
else:
assert channel_priority_map == OrderedDict([
Expand All @@ -1071,13 +1066,10 @@ def test_multichannel_priority():
('https://repo.anaconda.com/pkgs/main/new-optimized-subdir', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/main/linux-32', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/main/noarch', ('defaults', 1)),
('https://repo.anaconda.com/pkgs/free/new-optimized-subdir', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/free/linux-32', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/free/noarch', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 3)),
('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 3)),
('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 4)),
('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 4)),
('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 4)),
('https://repo.anaconda.com/pkgs/r/new-optimized-subdir', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/linux-32', ('defaults', 2)),
('https://repo.anaconda.com/pkgs/r/noarch', ('defaults', 2)),
('https://conda.anaconda.org/conda-forge/new-optimized-subdir', ('conda-forge', 3)),
('https://conda.anaconda.org/conda-forge/linux-32', ('conda-forge', 3)),
('https://conda.anaconda.org/conda-forge/noarch', ('conda-forge', 3)),
])
4 changes: 2 additions & 2 deletions tests/models/test_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class UrlDistTests(TestCase):

def test_dist_with_channel_url(self):
# standard named channel
url = "https://repo.anaconda.com/pkgs/free/win-64/spyder-app-2.3.8-py27_0.tar.bz2"
url = "https://repo.anaconda.com/pkgs/main/win-64/spyder-app-2.3.8-py27_0.tar.bz2"
d = Dist(url)
assert d.channel == 'defaults'
assert d.name == 'spyder-app'
Expand All @@ -67,7 +67,7 @@ def test_dist_with_channel_url(self):
assert d.is_channel is True

# standard url channel
url = "https://not.real.continuum.io/pkgs/free/win-64/spyder-app-2.3.8-py27_0.tar.bz2"
url = "https://not.real.continuum.io/pkgs/main/win-64/spyder-app-2.3.8-py27_0.tar.bz2"
d = Dist(url)
assert d.channel == 'defaults' # because pkgs/anaconda is in defaults
assert d.name == 'spyder-app'
Expand Down
10 changes: 5 additions & 5 deletions tests/models/test_index_record.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ def test_prefix_record_no_channel(self):
version='1.2.3',
build_string='py34_2',
build_number=2,
url="https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2",
url="https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2",
subdir="win-32",
md5='0123456789',
files=(),
)
assert pr.url == "https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2"
assert pr.url == "https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2"
assert pr.channel.canonical_name == 'defaults'
assert pr.subdir == "win-32"
assert pr.fn == "austin-1.2.3-py34_2.tar.bz2"
channel_str = text_type(Channel("https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2"))
assert channel_str == "https://repo.anaconda.com/pkgs/free/win-32"
channel_str = text_type(Channel("https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2"))
assert channel_str == "https://repo.anaconda.com/pkgs/main/win-32"
assert dict(pr.dump()) == dict(
name='austin',
version='1.2.3',
build='py34_2',
build_number=2,
url="https://repo.anaconda.com/pkgs/free/win-32/austin-1.2.3-py34_2.tar.bz2",
url="https://repo.anaconda.com/pkgs/main/win-32/austin-1.2.3-py34_2.tar.bz2",
md5='0123456789',
files=(),
channel=channel_str,
Expand Down
18 changes: 9 additions & 9 deletions tests/models/test_match_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,18 +293,18 @@ def test_exact_values(self):

def test_channel_matching(self):
with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
assert ChannelMatch('pkgs/free').match('defaults') is False
assert ChannelMatch('defaults').match('pkgs/free') is True
assert ChannelMatch('pkgs/main').match('defaults') is False
assert ChannelMatch('defaults').match('pkgs/main') is True

assert ChannelMatch("https://repo.anaconda.com/pkgs/free").match('defaults') is False
assert ChannelMatch("defaults").match("https://repo.anaconda.com/pkgs/free") is True
assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('defaults') is False
assert ChannelMatch("defaults").match("https://repo.anaconda.com/pkgs/main") is True

assert ChannelMatch("https://conda.anaconda.org/conda-forge").match('conda-forge') is True
assert ChannelMatch("conda-forge").match("https://conda.anaconda.org/conda-forge") is True

assert ChannelMatch("https://repo.anaconda.com/pkgs/free").match('conda-forge') is False
assert ChannelMatch("https://repo.anaconda.com/pkgs/main").match('conda-forge') is False

assert str(MatchSpec("pkgs/free::*")) == "pkgs/free::*"
assert str(MatchSpec("pkgs/main::*")) == "pkgs/main::*"
assert str(MatchSpec("defaults::*")) == "defaults::*"

def test_matchspec_errors(self):
Expand Down Expand Up @@ -356,12 +356,12 @@ def test_dist(self):
'tk 8.5*', 'xz 5.0.5', 'zlib 1.2*', 'pip'),
channel=Channel(scheme='https', auth=None,
location='repo.anaconda.com', token=None,
name='pkgs/free', platform='osx-64',
name='pkgs/main', platform='osx-64',
package_filename=None),
subdir='osx-64', fn='python-3.5.1-0.tar.bz2',
md5='a813bc0a32691ab3331ac9f37125164c', size=14678857,
priority=0,
url='https://repo.anaconda.com/pkgs/free/osx-64/python-3.5.1-0.tar.bz2'))
url='https://repo.anaconda.com/pkgs/main/osx-64/python-3.5.1-0.tar.bz2'))

def test_index_record(self):
dst = Dist('defaults::foo-1.2.3-4.tar.bz2')
Expand Down Expand Up @@ -524,7 +524,7 @@ class SpecStrParsingTests(TestCase):

def test_parse_spec_str_tarball_url(self):
with env_unmodified(conda_tests_ctxt_mgmt_def_pol):
url = "https://repo.anaconda.com/pkgs/free/linux-64/_license-1.1-py27_1.tar.bz2"
url = "https://repo.anaconda.com/pkgs/main/linux-64/_license-1.1-py27_1.tar.bz2"
assert _parse_spec_str(url) == {
"channel": "defaults",
"subdir": "linux-64",
Expand Down
10 changes: 5 additions & 5 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,20 +140,20 @@ def test_search_2(self):
stdout, stderr, _ = run_command(Commands.SEARCH, prefix, "nose", use_exception_handler=True)
result = stdout.replace("Loading channels: ...working... done", "")

assert "nose 1.3.4 py34_0 pkgs/free" in result
assert "nose 1.3.7 py37_2 pkgs/main" in result

@pytest.mark.integration
def test_search_3(self):
from tests.test_create import make_temp_env
from tests.test_create import run_command
from tests.test_create import Commands
with make_temp_env() as prefix:
stdout, stderr, _ = run_command(Commands.SEARCH, prefix, "*/linux-64::nose==1.3.7[build=py36_1]", "--info", use_exception_handler=True)
stdout, stderr, _ = run_command(Commands.SEARCH, prefix, "*/linux-64::nose==1.3.7[build=py37_2]", "--info", use_exception_handler=True)
result = stdout.replace("Loading channels: ...working... done", "")
assert "file name : nose-1.3.7-py36_1.tar.bz2" in result
assert "file name : nose-1.3.7-py37_2.tar.bz2" in result
assert "name : nose" in result
assert "url : https://repo.anaconda.com/pkgs/free/linux-64/nose-1.3.7-py36_1.tar.bz2" in result
assert "md5 : f4f697f5ad4df9c8fe35357d269718a5" in result
assert "url : https://repo.anaconda.com/pkgs/main/linux-64/nose-1.3.7-py37_2.tar.bz2" in result
assert "md5 : ff390a1e44d77e54914ca1a2c9e75445" in result

@pytest.mark.integration
def test_search_4(self):
Expand Down
Loading

0 comments on commit aa8c876

Please sign in to comment.