Skip to content

Commit

Permalink
Merge branch 'master' into expand_env_vars
Browse files Browse the repository at this point in the history
  • Loading branch information
teake committed Dec 6, 2018
2 parents 3ea8244 + db6af4f commit 28adfb7
Show file tree
Hide file tree
Showing 121 changed files with 9,428 additions and 54 deletions.
4 changes: 4 additions & 0 deletions .cla-signers
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,7 @@ methane | INADA Naoki <> | 2018-07-23
ohadravid | Ohad Ravid <> | 2018-07-24
nickpowersys | Nicholas Brown <> | 2018-09-20
keszybz | Zbigniew Jędrzejewski-Szmek <> | 2018-09-21
amelio-vazquez-reina | Amelio Vazquez-Reina <> | 2018-09-25
makbigc | Mak Sze Chun <> | 2018-10-02
mrakitin | Maksim Rakitin <> | 2018-10-19
sdebionne | Debionne <> | 2018-11-08
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
build/
dist/
docs/build
docs/_build
.cache/
.idea/
ve/
Expand Down
3 changes: 3 additions & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
requirements_file: utils/requirements-docs.txt
python:
version: 3
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
config (#7195, #7226, #7233)
* resolve #7087 add non-conda-installed python packages into PrefixData (#7067, #7370)
* resolve #2682 add 'conda run' preview support (#7320, #7625)
* resolve #626 conda wrapper for PowerShell (#7794)
* resolve #626 conda wrapper for PowerShell (#7794, #7829)

### Deprecations/Breaking Changes
* resolve #6915 remove 'conda env attach' and 'conda env upload' (#6916)
Expand Down Expand Up @@ -54,6 +54,7 @@
* performance improvement to cache __hash__ value on PackageRecord (#7715)
* resolve #7764 change name of 'condacmd' dir to 'condabin'; use on all platforms (#7773)
* resolve #7782 implement PEP-440 '~=' compatible release operator (#7783)
* disable timestamp prioritization (#7894)

### Bug Fixes
* fix #7107 verify hangs when a package is corrupted (#7131)
Expand Down
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,9 @@ test-installed:
$(PYTEST) $(ADD_COV) -m "installed" --shell=bash --shell=zsh


html:
@cd docs && make html


.PHONY : clean clean-all anaconda-submit anaconda-submit-upload auxlib boltons toolz \
pytest-version smoketest unit integration test-installed
pytest-version smoketest unit integration test-installed html
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ init:
# - ps: $blockRdp = $true; iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
- '%PYTHON_ROOT%\\Scripts\\conda install -y -c conda-canary -c defaults -c conda-forge python=%PYTHON_VERSION% pycosat conda requests ruamel_yaml pytest pytest-cov pytest-timeout mock responses pexpect pywin32'
- '%PYTHON_ROOT%\\Scripts\\conda install -y -c conda-canary -c defaults -c conda-forge python=%PYTHON_VERSION% pycosat conda requests ruamel_yaml pytest pytest-cov pytest-timeout mock responses pexpect pywin32 anaconda-client'
- "%PYTHON_ROOT%\\Scripts\\conda install -yq conda-build=3.13"
# conda install -y -c defaults -c conda-forge pytest pytest-cov pytest-timeout mock responses pexpect xonsh
# TODO: add xonsh for PY3 builds
Expand Down
6 changes: 6 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,9 @@ conda_build_test: &conda_build_test
and not test_setuptools_test_requirements
and not alternate_type_wheel
and not rpm-libX11-devel
and not test_resolved_packages_recipe
and not test_overlinking_detection
and not test_python_line_up_with_compiled_lib
# skeleton_pypi skipped because of changes to PyPI API
# expand_globs and build_expands_wildcards fail on circleci because of list ordering discrepancies
# skipping numpy tests so circleci images don't need numpy (and mkl) installed
Expand All @@ -115,6 +118,9 @@ conda_build_test: &conda_build_test
# test_setuptools_test_requirements upstream changes that affect 'conda skeleton'
# alternate_type_wheel broken with pip 10
# rpm-libX11-devel returns 404 error
# test_resolved_packages_recipedue to openssl not being pinned
# test_overlinking_detection package doesn't have configure
# test_python_line_up_with_compiled_lib because older CB honors run_exports.yaml and not run_exports.json
command: |
eval "$(sudo /opt/conda/bin/python -m conda init --dev bash)"
conda info
Expand Down
4 changes: 3 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):
deps_modifier = PrimitiveParameter(DepsModifier.NOT_SET)
update_modifier = PrimitiveParameter(UpdateModifier.UPDATE_SPECS)
sat_solver = PrimitiveParameter(None, element_type=string_types + (NoneType,))
solver_ignore_timestamps = PrimitiveParameter(True)

# no_deps = PrimitiveParameter(NULL, element_type=(type(NULL), bool)) # CLI-only
# only_deps = PrimitiveParameter(NULL, element_type=(type(NULL), bool)) # CLI-only
Expand All @@ -238,7 +239,7 @@ class Context(Configuration):
anaconda_upload = PrimitiveParameter(None, aliases=('binstar_upload',),
element_type=(bool, NoneType))
_croot = PrimitiveParameter('', aliases=('croot',))
_conda_build = MapParameter(string_types, aliases=('conda-build',))
_conda_build = MapParameter(string_types, aliases=('conda-build', 'conda_build'))

def __init__(self, search_path=None, argparse_args=None):
if search_path is None:
Expand Down Expand Up @@ -753,6 +754,7 @@ def category_map(self):
'pip_interop_enabled', # temporary feature flag
'root_prefix',
'sat_solver',
'solver_ignore_timestamps',
'subdir',
'subdirs',
# https://conda.io/docs/config.html#disable-updating-of-dependencies-update-dependencies # NOQA
Expand Down
12 changes: 7 additions & 5 deletions conda/core/initialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,9 @@ def _read_windows_registry(target_path): # pragma: no cover

try:
value_tuple = winreg.QueryValueEx(key, value_name)
value_value = value_tuple[0].strip()
value_value = value_tuple[0]
if isinstance(value_value, str):
value_value = value_value.strip()
value_type = value_tuple[1]
return value_value, value_type
except Exception:
Expand Down Expand Up @@ -1157,7 +1159,7 @@ def init_cmd_exe_registry(target_path, conda_prefix):
hook_path = '"%s"' % join(conda_prefix, 'condabin', 'conda_hook.bat')
replace_str = "__CONDA_REPLACE_ME_123__"
new_value = re.sub(
r'(\".*?conda[-_]hook\.bat\")',
r'(\"[^\"]*?conda[-_]hook\.bat\")',
replace_str,
prev_value,
count=1,
Expand Down Expand Up @@ -1187,13 +1189,13 @@ def init_long_path(target_path):
# win10, build 14352 was the first preview release that supported this
if int(win_ver) >= 10 and int(win_rev) >= 14352:
prev_value, value_type = _read_windows_registry(target_path)
if prev_value != "1":
if str(prev_value) != "1":
if context.verbosity:
print('\n')
print(target_path)
print(make_diff(prev_value, "1"))
print(make_diff(str(prev_value), '1'))
if not context.dry_run:
_write_windows_registry(target_path, "1", winreg.REG_DWORD)
_write_windows_registry(target_path, 1, winreg.REG_DWORD)
return Result.MODIFIED
else:
return Result.NO_CHANGE
Expand Down
5 changes: 5 additions & 0 deletions conda/core/path_actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from .envs_manager import USER_ENVIRONMENTS_TXT_FILE, register_env, unregister_env
from .portability import _PaddingError, update_prefix
from .prefix_data import PrefixData
from .. import CondaError
from .._vendor.auxlib.compat import with_metaclass
from .._vendor.auxlib.ish import dals
from ..base.constants import CONDA_TARBALL_EXTENSION
Expand Down Expand Up @@ -161,6 +162,10 @@ def make_file_link_action(source_path_data):
noarch = package_info.repodata_record.noarch
if noarch == NoarchType.python:
sp_dir = transaction_context['target_site_packages_short_path']
if sp_dir is None:
raise CondaError("Unable to determine python site-packages "
"dir in target_prefix!\nPlease make sure "
"python is installed in %s" % target_prefix)
target_short_path = get_python_noarch_target_path(source_path_data.path, sp_dir)
elif noarch is None or noarch == NoarchType.generic:
target_short_path = source_path_data.path
Expand Down
11 changes: 11 additions & 0 deletions conda/core/prefix_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from os import listdir
from os.path import basename, isdir, isfile, join, lexists

from .._vendor.auxlib.exceptions import ValidationError
from ..base.constants import CONDA_TARBALL_EXTENSION, PREFIX_MAGIC_FILE
from ..base.context import context
from ..common.compat import JSONDecodeError, itervalues, odict, string_types, with_metaclass
Expand Down Expand Up @@ -257,6 +258,16 @@ def _load_site_packages(self):
python_record = read_python_record(self.prefix_path, af, python_pkg_record.version)
except EnvironmentError:
continue
except ValidationError:
import sys
exc_type, exc_value, exc_traceback = sys.exc_info()
import traceback
tb = traceback.format_exception(exc_type, exc_value, exc_traceback)
log.warn("Problem reading non-conda package record at %s. Please verify that you "
"still need this, and if so, that this is still installed correctly. "
"Reinstalling this package may help.", af)
log.debug("ValidationError: \n%s\n", "\n".join(tb))
continue
if not python_record:
continue
self.__prefix_records[python_record.name] = python_record
Expand Down
7 changes: 5 additions & 2 deletions conda/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from .base.constants import DEFAULTS_CHANNEL_NAME, UNKNOWN_CHANNEL
from .base.context import context, reset_context
from .common.compat import itervalues, text_type
from .common.io import env_var, time_recorder
from .common.io import env_vars, time_recorder
from .core.index import LAST_CHANNEL_URLS, _supplement_index_with_prefix
from .core.link import PrefixSetup, UnlinkLinkTransaction
from .core.solve import diff_for_unlink_link_precs
Expand Down Expand Up @@ -438,7 +438,10 @@ def install_actions(prefix, index, specs, force=False, only_names=None, always_c
channel_priority_map=None, is_update=False,
minimal_hint=False): # pragma: no cover
# this is for conda-build
with env_var('CONDA_ALLOW_NON_CHANNEL_URLS', 'true', reset_context):
with env_vars({
'CONDA_ALLOW_NON_CHANNEL_URLS': 'true',
'CONDA_SOLVER_IGNORE_TIMESTAMPS': 'false',
}, reset_context):
from os.path import basename
from ._vendor.boltons.setutils import IndexedSet
from .core.solve import Solver
Expand Down
15 changes: 11 additions & 4 deletions conda/resolve.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ def __init__(self, index, sort=False, processed=False, channels=()):

self.channels = channels
self._channel_priorities_map = self._make_channel_priorities(channels) if channels else {}
self._channel_priority = context.channel_priority
self._solver_ignore_timestamps = context.solver_ignore_timestamps

groups = groupby("name", itervalues(index))
trackers = defaultdict(list)
Expand Down Expand Up @@ -500,10 +502,15 @@ def version_key(self, prec, vtype=None):
build_number = prec.get('build_number', 0)
build_string = prec.get('build')
ts = prec.get('timestamp', 0)
if context.channel_priority != ChannelPriority.DISABLED:
return valid, -channel_priority, version_comparator, build_number, ts, build_string
if self._channel_priority != ChannelPriority.DISABLED:
vkey = [valid, -channel_priority, version_comparator, build_number]
else:
return valid, version_comparator, -channel_priority, build_number, ts, build_string
vkey = [valid, version_comparator, -channel_priority, build_number]
if self._solver_ignore_timestamps:
vkey.append(build_string)
else:
vkey.extend((ts, build_string))
return vkey

@staticmethod
def _make_channel_priorities(channels):
Expand Down Expand Up @@ -696,7 +703,7 @@ def generate_version_metrics(self, C, specs, include0=False):
elif pkey[3] != version_key[3]:
ib += 1
it = 0
elif pkey[4] != version_key[4]:
elif not self._solver_ignore_timestamps and pkey[4] != version_key[4]:
it += 1

prec_sat_name = self.to_sat_name(prec)
Expand Down
6 changes: 5 additions & 1 deletion conda/shell/condabin/Conda.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,11 @@ function Invoke-Conda() {
}
else {
$Command = $Args[0];
$OtherArgs = $Args[1..($Args.Count - 1)];
if ($Args.Count -ge 2) {
$OtherArgs = $Args[1..($Args.Count - 1)];
} else {
$OtherArgs = @();
}
switch ($Command) {
"activate" {
Enter-CondaEnvironment @OtherArgs;
Expand Down
33 changes: 20 additions & 13 deletions conda_env/specs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,42 @@


def detect(**kwargs):
# Check file existence
filename = kwargs.get('filename')
if filename and not os.path.isfile(filename):
raise EnvironmentFileNotFound(filename=filename)
remote_definition = kwargs.get('name')

# Check extensions
all_valid_exts = YamlFileSpec.extensions.union(RequirementsSpec.extensions)
fname, ext = os.path.splitext(filename)
if ext == '' or ext not in all_valid_exts:
raise EnvironmentFileExtensionNotValid(filename)
elif ext in YamlFileSpec.extensions:
specs = [YamlFileSpec]
elif ext in RequirementsSpec.extensions:
specs = [RequirementsSpec]

# First check if file exists and test the known valid extension for specs
file_exists = filename and os.path.isfile(filename)
if file_exists:
if ext == '' or ext not in all_valid_exts:
raise EnvironmentFileExtensionNotValid(filename)
elif ext in YamlFileSpec.extensions:
specs = [YamlFileSpec]
elif ext in RequirementsSpec.extensions:
specs = [RequirementsSpec]
else:
specs = [NotebookSpec, BinstarSpec]

# Check specifications
spec_instances = []
for SpecClass in specs:
spec = SpecClass(**kwargs)
spec_instances.append(spec)
if spec.can_handle():
return spec

raise SpecNotFound(build_message(specs))
if not file_exists and remote_definition is None:
raise EnvironmentFileNotFound(filename=filename)
else:
raise SpecNotFound(build_message(spec_instances))


def build_message(specs):
binstar_spec = next((spec for spec in specs if isinstance(spec, BinstarSpec)), None)
def build_message(spec_instances):
binstar_spec = next((s for s in spec_instances if isinstance(s, BinstarSpec)), None)
if binstar_spec:
return binstar_spec.msg
else:
return "\n".join([s.msg for s in specs if s.msg is not None])
return "\n".join([s.msg for s in spec_instances if s.msg is not None])
5 changes: 1 addition & 4 deletions conda_env/specs/binstar.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,6 @@ def __init__(self, name=None, **kwargs):

def can_handle(self):
result = self._can_handle()
if result:
print("WARNING: Binstar environments are deprecated and scheduled to be "
"removed in conda 4.5. See conda issue #5843 at "
"https://github.com/conda/conda/pull/5843 for more information.")
return result

def _can_handle(self):
Expand All @@ -60,6 +56,7 @@ def _can_handle(self):
self.msg = ("Anaconda Client is required to interact with anaconda.org or an "
"Anaconda API. Please run `conda install anaconda-client`.")
return False

return self.package is not None and self.valid_package()
return False

Expand Down
20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = python -msphinx
SPHINXPROJ = conda
SOURCEDIR = source
BUILDDIR = _build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
Loading

0 comments on commit 28adfb7

Please sign in to comment.