From f13361bcb9aa960dc008afd11cddf1a201966e21 Mon Sep 17 00:00:00 2001 From: Kale Franz Date: Tue, 6 Dec 2016 16:43:49 -0600 Subject: [PATCH] fix conda-build imports --- .gitignore | 2 + conda/compat.py | 88 +++---------------------------------------- conda/instructions.py | 3 +- conda/plan.py | 3 +- 4 files changed, 12 insertions(+), 84 deletions(-) diff --git a/.gitignore b/.gitignore index 5fd37bcd31..4c88fff807 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,5 @@ tmpfile.rc .coverage* *.bz2 tempfile.rc +.vagrant/ +Vagrantfile diff --git a/conda/compat.py b/conda/compat.py index f009c14884..146bf06971 100644 --- a/conda/compat.py +++ b/conda/compat.py @@ -3,16 +3,14 @@ # Taken mostly from six.py by Benjamin Peterson. # """ from __future__ import absolute_import, division, print_function, unicode_literals -# -# import sys -# import types -# import os import warnings as _warnings from tempfile import mkdtemp -# -# # True if we are running on Python 3. -# PY3 = sys.version_info[0] == 3 -# + + +# shim for conda-build +from .common.compat import * +PY3 = PY3 + class TemporaryDirectory(object): """Create and return a temporary directory. This has the same @@ -59,77 +57,3 @@ def __exit__(self, exc, value, tb): def __del__(self): # Issue a ResourceWarning if implicit cleanup needed self.cleanup(_warn=True) - - -# if PY3: -# string_types = str, -# integer_types = int, -# class_types = type, -# text_type = str -# binary_type = bytes -# input = input -# def lchmod(path, mode): -# try: -# os.chmod(path, mode, follow_symlinks=False) -# except (TypeError, NotImplementedError, SystemError): -# # On systems that don't allow permissions on symbolic links, skip -# # links entirely. -# if not os.path.islink(path): -# os.chmod(path, mode) -# import configparser -# from io import StringIO -# from itertools import zip_longest -# from shlex import quote -# range = range -# zip = zip -# -# else: -# import ConfigParser as configparser -# from cStringIO import StringIO -# string_types = basestring, -# integer_types = (int, long) -# class_types = (type, types.ClassType) -# text_type = unicode -# binary_type = str -# input = raw_input -# try: -# lchmod = os.lchmod -# except AttributeError: -# def lchmod(path, mode): -# # On systems that don't allow permissions on symbolic links, skip -# # links entirely. -# if not os.path.islink(path): -# os.chmod(path, mode) -# from itertools import izip_longest as zip_longest -# from math import log -# from pipes import quote -# -# # Modified from http://hg.python.org/cpython/file/3.3/Lib/tempfile.py. Don't -# # use the 3.4 one. It uses the new weakref.finalize feature. -# from tempfile import mkdtemp -# range = xrange -# # used elsewhere - do not remove -# from itertools import izip as zip -# -# -# if PY3: -# _iterkeys = "keys" -# _itervalues = "values" -# _iteritems = "items" -# else: -# _iterkeys = "iterkeys" -# _itervalues = "itervalues" -# _iteritems = "iteritems" -# -# -# def iterkeys(d): -# """Return an iterator over the keys of a dictionary.""" -# return iter(getattr(d, _iterkeys)()) -# -# def itervalues(d): -# """Return an iterator over the values of a dictionary.""" -# return iter(getattr(d, _itervalues)()) -# -# def iteritems(d): -# """Return an iterator over the (key, value) pairs of a dictionary.""" -# return iter(getattr(d, _iteritems)()) diff --git a/conda/instructions.py b/conda/instructions.py index 33f2b0d19d..ac5beb0654 100644 --- a/conda/instructions.py +++ b/conda/instructions.py @@ -236,7 +236,8 @@ def execute_instructions(plan, index=None, verbose=False, _commands=None): state['i'] - 1)) cmd = _commands[instruction] - cmd(state, arg) + if callable(cmd): + cmd(state, arg) if (state['i'] is not None and instruction in PROGRESS_COMMANDS and state['maxval'] == state['i']): diff --git a/conda/plan.py b/conda/plan.py index 059608f4bf..d9548900a4 100644 --- a/conda/plan.py +++ b/conda/plan.py @@ -311,7 +311,8 @@ def inject_UNLINKLINKTRANSACTION(plan): link_dists = tuple(Dist(d[1]) for d in grouped_instructions.get(LINK, ())) unlink_dists, link_dists = handle_menuinst(unlink_dists, link_dists) plan.insert(first_unlink_link_idx, (UNLINKLINKTRANSACTION, (unlink_dists, link_dists))) - plan = [p for p in plan if p[0] not in (UNLINK, LINK)] # filter out unlink/link + # plan = [p for p in plan if p[0] not in (UNLINK, LINK)] # filter out unlink/link + # don't filter LINK and UNLINK, just don't do anything with them return plan