Skip to content

Commit

Permalink
Merge remote-tracking branch 'conda/master'
Browse files Browse the repository at this point in the history
# Conflicts:
#	appveyor.yml
#	utils/travis-run-install.sh

Conflicts were minor and blamable on how code has moved to new files.
  • Loading branch information
kenodegard committed Nov 16, 2016
2 parents 1621597 + ab8ec3c commit 219c378
Show file tree
Hide file tree
Showing 28 changed files with 134 additions and 56 deletions.
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,32 @@
### Deprecations/Breaking Changes
* the 'r' channel is now part of defaults (#3677)
* remove dead install_tar function (#3641)
* no longer symlinking conda for activated envs (#3712)

### Improvements
* noarch python packages (#3712)
* cache VersionOrder objects to improve performance (#3596)
* fix documentation and typos (#3526, #3572, #3627)
* imporoved solver hint detection, simplified filtering (#3597)
* add multikey configuration validation (#3432)
* some Fish autocompletions (#2519)
* reduce priority for packages removed from the index (#3703)
* add user-agent, uid, gid to conda info (#3671)
* make http timeouts configurable (#3832)
* add a pkgs_dirs config parameter (#3691)
* Add an 'always_softlink' option (#3870, #3876)

### Bug Fixes
* account for the Windows Python 2.7 os.environ unicode aversion (#3363)
* fix link field in record object (#3424)
* anaconda api token bug fix; additional tests (#3673)
* fix #3667 unicode literals and unicode decode (#3682)
* add conda-env entrypoint (#3743)
* fix #3807 json dump on conda config --show --json (#3811)
* fix #3801 location of temporary hard links of index.json (#3813)
* fix invalid yml example (#3849)
* add arm platforms back to subdirs (#3852)
* fix #3771 better error message for assertion errors (#3802)

### Non-User-Facing Changes
* remove unnecessary eval (#3428)
Expand All @@ -31,24 +41,52 @@
* integration tests for conda clean (#3695, #3699)
* disable coverage on s3 and ftp requests adapaters (#3696, #3701)
* github repo hygiene (#3705, #3706)
* major install refactor (#3712)


## 4.2.13 (unreleased)

### Improvements
* double/extend http timeouts (#3831)
* let descriptive http errors cover more http exceptions (#3834)
* backport some conda-build configuration (#3875)

### Non-User-Facing Changes
* flake8 E116, E121, & E123 enabled (#3883)


## 4.1.13 (unreleased)

### Deprecations/Breaking Changes
* show warning message for pre-link scripts (#3727)
* error and exit for install of packages that require conda minimum version 4.3 (#3726)

### Improvements
* use install.rm_rf for TemporaryDirectory cleanup (#3425)
* improve handling of local dependency information (#2107)

### Bug Fixes
* fix the api->conda substitution (#3456)
* fix conda/install.py single-file behavior (#3854)


## 3.19.4 (unreleased)

### Deprecations/Breaking Changes
* show warning message for pre-link scripts (#3727)
* error and exit for install of packages that require conda minimum version 4.3 (#3726)

### Improvements
* improve handling of local dependency information (#2107)
* use install.rm_rf for TemporaryDirectory cleanup (#3425)

### Bug Fixes
* fix conda/install.py single-file behavior (#3854)
* fix the api->conda substitution (#3456)
* fix silent directory removal (#3730)


## 4.2.12 (unreleased)
## 4.2.12 (2016-11-02)

### Bug Fixes

Expand Down
33 changes: 20 additions & 13 deletions conda/base/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ class Context(Configuration):
use_pip = PrimitiveParameter(True)

_root_dir = PrimitiveParameter(sys.prefix, aliases=('root_dir',))
_envs_dirs = SequenceParameter(string_types, aliases=('envs_dirs',))
_envs_dirs = SequenceParameter(string_types, aliases=('envs_dirs', 'envs_path'),
string_delimiter=os.pathsep)
_pkgs_dirs = SequenceParameter(string_types, aliases=('pkgs_dirs',))

# connection details
Expand All @@ -96,6 +97,7 @@ class Context(Configuration):
_custom_multichannels = MapParameter(Sequence, aliases=('custom_multichannels',))

# command line
always_softlink = PrimitiveParameter(False, aliases=('softlink',))
always_copy = PrimitiveParameter(False, aliases=('copy',))
always_yes = PrimitiveParameter(False, aliases=('yes',))
channel_priority = PrimitiveParameter(True)
Expand All @@ -116,6 +118,20 @@ class Context(Configuration):
_croot = PrimitiveParameter('', aliases=('croot',))
conda_build = MapParameter(string_types, aliases=('conda-build',))

def post_build_validation(self):
errors = []
if self.client_ssl_cert_key and not self.client_ssl_cert:
error = ValidationError('client_ssl_cert', self.client_ssl_cert, "<<merged>>",
"'client_ssl_cert' is required when 'client_ssl_cert_key' "
"is defined")
errors.append(error)
if self.always_copy and self.always_softlink:
error = ValidationError('always_copy', self.always_copy, "<<merged>>",
"'always_copy' and 'always_softlink' are mutually exclusive. "
"Only one can be set to 'True'.")
errors.append(error)
return errors

@property
def croot(self):
"""This is where source caches and work folders live"""
Expand Down Expand Up @@ -154,18 +170,6 @@ def svn_cache(self):
conda_bld_ensure_dir(path)
return path

def post_build_validation(self):
errors = []
if self.client_ssl_cert_key and not self.client_ssl_cert:
error = ValidationError('client_ssl_cert', self.client_ssl_cert, "<<merged>>",
"'client_ssl_cert' is required when 'client_ssl_cert_key' "
"is defined")
errors.append(error)
return errors

_envs_dirs = SequenceParameter(string_types, aliases=('envs_dirs', 'envs_path'),
string_delimiter=os.pathsep)

@property
def default_python(self):
ver = sys.version_info
Expand Down Expand Up @@ -357,6 +361,8 @@ def get_help_dict():
"""),
'always_copy': dals("""
"""),
'always_softlink': dals("""
"""),
'changeps1': dals("""
"""),
'use_pip': dals("""
Expand Down Expand Up @@ -478,6 +484,7 @@ def inroot_notwritable(prefix):
return (abspath(prefix).startswith(context.root_dir) and
not context.root_writable)


try:
context = Context(SEARCH_PATH, conda, None)
except LoadError as e:
Expand Down
2 changes: 1 addition & 1 deletion conda/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ def add_parser_copy(p):
action="store_true",
default=NULL,
help="Install all packages using copies instead of hard- or soft-linking."
)
)

def add_parser_pscheck(p):
p.add_argument(
Expand Down
1 change: 1 addition & 0 deletions conda/cli/conda_argparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ def debug_argcomplete(msg):
f.write("\n%s\n" % msg)
f.flush()


try:
import argcomplete
argcomplete.CompletionFinder
Expand Down
1 change: 1 addition & 0 deletions conda/cli/main_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ def execute_config(args, parser):
'add_pip_as_python_dependency',
'allow_softlinks',
'always_copy',
'always_softlink',
'always_yes',
'auto_update_conda',
'binstar_upload',
Expand Down
2 changes: 1 addition & 1 deletion conda/cli/main_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def pretty_package(pkg):
('build string', pkg.build),
('channel', Channel(pkg.channel).canonical_name),
('size', human_bytes(pkg.info['size'])),
])
])
rest = pkg.info
for key in sorted(rest):
if key in {'build', 'depends', 'requires', 'channel', 'name',
Expand Down
4 changes: 2 additions & 2 deletions conda/cli/main_remove.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

import errno
import logging
import sys
from argparse import RawDescriptionHelpFormatter
from os.path import join

Expand Down Expand Up @@ -160,8 +161,7 @@ def execute(args, parser):

if plan.nothing_to_do(actions):
if args.all:
print()
print("Remove all packages in environment %s:\n" % prefix)
print("\nRemove all packages in environment %s:\n" % prefix, file=sys.stderr)
if not context.json:
confirm_yn(args)
rm_rf(prefix)
Expand Down
4 changes: 2 additions & 2 deletions conda/cli/main_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ def configure_parser(sub_parsers):
'win-64', and so on. The default is to search the current platform.""",
choices=Platforms(),
default=None,
)
)
p.add_argument(
"--spec",
action="store_true",
Expand Down Expand Up @@ -268,7 +268,7 @@ def execute_search(args, parser):
pkg.build,
pkg.schannel,
disp_features(features),
))
))
disp_name = ''
else:
data = {}
Expand Down
6 changes: 5 additions & 1 deletion conda/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import sys
from os.path import abspath, expanduser, isfile, join

from conda.base.context import context, non_x86_linux_machines # NOQA
from conda.base.context import context, non_x86_linux_machines
non_x86_linux_machines = non_x86_linux_machines


Expand Down Expand Up @@ -38,6 +38,7 @@
'always_yes',
'always_copy',
'allow_softlinks',
'always_softlink',
'auto_update_conda',
'changeps1',
'use_pip',
Expand Down Expand Up @@ -81,12 +82,14 @@ def get_local_urls():
class RC(object):

def get(self, key, default=None):
key = key.replace('-', '_')
return getattr(context, key, default)


rc = RC()
envs_dirs = context.envs_dirs


def get_rc_path():
path = os.getenv('CONDARC')
if path == ' ':
Expand All @@ -98,6 +101,7 @@ def get_rc_path():
return path
return None


rc_path = get_rc_path()

pkgs_dirs = context.pkgs_dirs
Expand Down
1 change: 1 addition & 0 deletions conda/console.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ def emit(self, record):
except IOError:
pass


_fetch_prog_handler = FetchProgressHandler()
_prog_handler = ProgressHandler()

Expand Down
33 changes: 11 additions & 22 deletions conda/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import bz2
import hashlib
import json
import requests
import warnings
from functools import wraps
from logging import DEBUG, getLogger
from os import makedirs
from os.path import dirname, join
from requests.exceptions import ConnectionError, HTTPError, SSLError
from requests.packages.urllib3.exceptions import InsecureRequestWarning

from .linked_data import linked_data
Expand Down Expand Up @@ -158,8 +158,10 @@ def get_json_str(filename, resp_content):
except ValueError as e:
raise CondaRuntimeError("Invalid index file: {0}: {1}".format(join_url(url, filename), e))

except requests.exceptions.HTTPError as e:
if e.response.status_code == 404:
except (ConnectionError, HTTPError, SSLError) as e:
# status_code might not exist on SSLError
status_code = getattr(e.response, 'status_code', None)
if status_code == 404:
if url.endswith('/noarch'): # noarch directory might not exist
return None

Expand All @@ -171,7 +173,7 @@ def get_json_str(filename, resp_content):
Further configuration help can be found at <%s>.
""" % join_url(CONDA_HOMEPAGE_URL, 'docs/config.html'))

elif e.response.status_code == 403:
elif status_code == 403:
if url.endswith('/noarch'):
return None
else:
Expand All @@ -183,7 +185,7 @@ def get_json_str(filename, resp_content):
Further configuration help can be found at <%s>.
""" % join_url(CONDA_HOMEPAGE_URL, 'docs/config.html'))

elif e.response.status_code == 401:
elif status_code == 401:
channel = Channel(url)
if channel.token:
help_message = dals("""
Expand Down Expand Up @@ -222,7 +224,7 @@ def get_json_str(filename, resp_content):
Further configuration help can be found at <%s>.
""" % join_url(CONDA_HOMEPAGE_URL, 'docs/config.html'))

elif 500 <= e.response.status_code < 600:
elif status_code is not None and 500 <= status_code < 600:
help_message = dals("""
An remote server error occurred when trying to retrieve this URL.
Expand All @@ -233,24 +235,11 @@ def get_json_str(filename, resp_content):
""")

else:
help_message = "An HTTP error occurred when trying to retrieve this URL."
help_message = "An HTTP error occurred when trying to retrieve this URL.\n%r" % e

raise CondaHTTPError(help_message, e.response.url, e.response.status_code,
e.response.reason)
raise CondaHTTPError(help_message, e.response.url if e.response else None, status_code,
e.response.reason if e.response else None)

except requests.exceptions.SSLError as e:
msg = "SSL Error: %s\n" % e
stderrlog.info("SSL verification error: %s\n" % e)
log.debug(msg)

except requests.exceptions.ConnectionError as e:
msg = "Connection error: %s: %s\n" % (e, url)
stderrlog.info('Could not connect to %s\n' % url)
log.debug(msg)
if fail_unknown_host:
raise CondaRuntimeError(msg)

raise CondaRuntimeError(msg)
cache['_url'] = url
try:
with open(cache_path, 'w') as fo:
Expand Down
10 changes: 8 additions & 2 deletions conda/core/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import sys
import warnings
from collections import namedtuple
from conda._vendor.auxlib.ish import dals
from logging import getLogger
from os import listdir
from os.path import dirname, isdir, isfile, join
Expand Down Expand Up @@ -282,8 +283,13 @@ def run_script(prefix, dist, action='post-link', env_prefix=None):
False on failure
"""
if action == 'pre-link':
warnings.warn("The package %s uses a pre-link script.\n"
"Pre-link scripts may be deprecated in the near future.")
warnings.warn(dals("""
Package %s uses a pre-link script. Pre-link scripts are potentially dangerous.
This is because pre-link scripts have the ability to change the package contents in the
package cache, and therefore modify the underlying files for already-created conda
environments. Future versions of conda may deprecate and ignore pre-link scripts.
""" % dist))

path = join(prefix, 'Scripts' if on_win else 'bin', '.%s-%s.%s' % (
dist.dist_name,
action,
Expand Down
Loading

0 comments on commit 219c378

Please sign in to comment.