Skip to content

Commit

Permalink
Merge remote-tracking branch 'conda/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
kenodegard committed Oct 14, 2016
2 parents 3ff038e + d811502 commit 84834aa
Show file tree
Hide file tree
Showing 7 changed files with 117 additions and 4 deletions.
1 change: 1 addition & 0 deletions .condarc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
always_softlink: True
2 changes: 1 addition & 1 deletion conda/cli/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def add_parser_install(p):
action="store_true",
dest="update_deps",
default=NULL,
help="Don't update dependencies (default: %s)." % context.update_dependencies,
help="Update dependencies (default: %s)." % context.update_dependencies,
)
p.add_argument(
"--no-update-dependencies", "--no-update-deps",
Expand Down
94 changes: 94 additions & 0 deletions conda/exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals

from functools import partial

from conda import compat, plan
compat = compat
plan = plan

from conda.api import get_index # NOQA
get_index = get_index

from conda.cli.common import (Completer, InstalledPackages, add_parser_channels, add_parser_prefix, # NOQA
specs_from_args, spec_from_line, specs_from_url) # NOQA
Completer, InstalledPackages = Completer, InstalledPackages
add_parser_channels, add_parser_prefix = add_parser_channels, add_parser_prefix
specs_from_args, spec_from_line = specs_from_args, spec_from_line
specs_from_url = specs_from_url

from conda.cli.conda_argparse import ArgumentParser # NOQA
ArgumentParser = ArgumentParser

from conda.compat import (PY3, StringIO, configparser, input, iteritems, lchmod, string_types, # NOQA
text_type, TemporaryDirectory) # NOQA
PY3, StringIO, configparser, input = PY3, StringIO, configparser, input
iteritems, lchmod, string_types = iteritems, lchmod, string_types
text_type, TemporaryDirectory = text_type, TemporaryDirectory

from conda.connection import CondaSession # NOQA
CondaSession = CondaSession

from conda.fetch import TmpDownload, download, fetch_index, handle_proxy_407 # NOQA
TmpDownload, download, fetch_index = TmpDownload, download, fetch_index
handle_proxy_407 = handle_proxy_407

from conda.install import (delete_trash, is_linked, linked, linked_data, move_to_trash, # NOQA
prefix_placeholder, rm_rf, symlink_conda, rm_fetched, package_cache) # NOQA
delete_trash, is_linked, linked = delete_trash, is_linked, linked
linked_data, move_to_trash = linked_data, move_to_trash
prefix_placeholder, rm_rf, symlink_conda = prefix_placeholder, rm_rf, symlink_conda
rm_fetched, package_cache = rm_fetched, package_cache

from conda.lock import Locked # NOQA
Locked = Locked

from conda.misc import untracked, walk_prefix # NOQA
untracked, walk_prefix = untracked, walk_prefix

from conda.resolve import MatchSpec, NoPackagesFound, Resolve, Unsatisfiable, normalized_version # NOQA
MatchSpec, NoPackagesFound, Resolve = MatchSpec, NoPackagesFound, Resolve
Unsatisfiable, normalized_version = Unsatisfiable, normalized_version

from conda.signature import KEYS, KEYS_DIR, hash_file, verify # NOQA
KEYS, KEYS_DIR = KEYS, KEYS_DIR
hash_file, verify = hash_file, verify

from conda.utils import (human_bytes, hashsum_file, md5_file, memoized, unix_path_to_win, # NOQA
win_path_to_unix, url_path) # NOQA
human_bytes, hashsum_file, md5_file = human_bytes, hashsum_file, md5_file
memoized, unix_path_to_win = memoized, unix_path_to_win
win_path_to_unix, url_path = win_path_to_unix, url_path

from conda.config import sys_rc_path # NOQA
sys_rc_path = sys_rc_path

from conda.version import VersionOrder # NOQA
VersionOrder = VersionOrder


import conda.base.context # NOQA
import conda.exceptions # NOQA
from conda.base.context import get_prefix as context_get_prefix, non_x86_linux_machines # NOQA
non_x86_linux_machines = non_x86_linux_machines

from conda.base.constants import DEFAULT_CHANNELS # NOQA
get_prefix = partial(context_get_prefix, conda.base.context.context)
get_default_urls = lambda: DEFAULT_CHANNELS

arch_name = conda.base.context.context.arch_name
binstar_upload = conda.base.context.context.binstar_upload
bits = conda.base.context.context.bits
default_prefix = conda.base.context.context.default_prefix
default_python = conda.base.context.context.default_python
envs_dirs = conda.base.context.context.envs_dirs
pkgs_dirs = conda.base.context.context.pkgs_dirs
platform = conda.base.context.context.platform
root_dir = conda.base.context.context.root_dir
root_writable = conda.base.context.context.root_writable
subdir = conda.base.context.context.subdir
from conda.models.channel import get_conda_build_local_url # NOQA
get_rc_urls = lambda: list(conda.base.context.context.channels)
get_local_urls = lambda: list(get_conda_build_local_url()) or []
load_condarc = lambda fn: conda.base.context.reset_context([fn])
PaddingError = conda.exceptions.PaddingError
13 changes: 12 additions & 1 deletion conda/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ def ver_eval(vtest, spec):

version_check_re = re.compile(r'^[\*\.\+!_0-9a-z]+$')
version_split_re = re.compile('([0-9]+|[*]+|[^0-9*]+)')
version_cache = {}

class VersionOrder(object):
'''
This class implements an order relation between version strings.
Expand Down Expand Up @@ -126,7 +128,15 @@ class VersionOrder(object):
1.0.1a => 1.0.1post.a # ensure correct ordering for openssl
'''
def __init__(self, version):

def __new__(cls, version):
if isinstance(version, cls):
return version
self = version_cache.get(version)
if self is not None:
return self
self = version_cache[version] = object.__new__(cls)

# when fillvalue == 0 => 1.1 == 1.1.0
# when fillvalue == -1 => 1.1 < 1.1.0
self.fillvalue = 0
Expand Down Expand Up @@ -197,6 +207,7 @@ def __init__(self, version):
# components shall start with a number to keep numbers and
# strings in phase => prepend fillvalue
v[k] = [self.fillvalue] + c
return self

def __str__(self):
return self.norm_version
Expand Down
2 changes: 1 addition & 1 deletion conda_env/specs/requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def _valid_file(self):

def _valid_name(self):
if self.name is None:
self.msg = "Environment with requierements.txt file needs a name"
self.msg = "Environment with requirements.txt file needs a name"
return False
else:
return True
Expand Down
2 changes: 1 addition & 1 deletion tests/test_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ def test_shortcut_absent_does_not_barf_on_uninstall(self):
os.remove(shortcut_file)

@pytest.mark.skipif(not on_win, reason="shortcuts only relevant on Windows")
@pytest.mark.xfail(datetime.now() < datetime(2016, 10, 1), reason="deal with this later")
@pytest.mark.xfail(datetime.now() < datetime(2016, 11, 1), reason="deal with this later")
def test_shortcut_absent_when_condarc_set(self):
from menuinst.win32 import dirs as win_locations
user_mode = 'user' if exists(join(sys.prefix, u'.nonadmin')) else 'system'
Expand Down
7 changes: 7 additions & 0 deletions tests/test_exports.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals


def test_exports():
import conda.exports
assert conda.exports.PaddingError

0 comments on commit 84834aa

Please sign in to comment.