Upgrade distlib to 0.1.7

This commit is contained in:
Donald Stufft 2014-01-16 17:00:03 -05:00
parent 0c306c61f0
commit 2788e17e43
8 changed files with 37 additions and 10 deletions

View File

@ -9,6 +9,9 @@ env:
- TOXENV=py34
- TOXENV=pypy
before_install:
- "[ -d ~/.distlib ] && sudo chown -R travis:travis ~/.distlib || true"
install:
- "if [[ $TOXENV == 'pypy' ]]; then sudo add-apt-repository -y ppa:pypy/ppa; fi"
- "if [[ $TOXENV == 'pypy' ]]; then sudo apt-get -y update && sudo apt-get -y install pypy; fi"

View File

@ -6,7 +6,7 @@
#
import logging
__version__ = '0.1.6'
__version__ = '0.1.7'
class DistlibException(Exception):
pass

View File

@ -644,7 +644,9 @@ class Metadata(object):
'summary': ('legacy',),
}
INDEX_KEYS = 'name version license summary description'
INDEX_KEYS = ('name version license summary description author '
'author_email keywords platform home_page classifiers '
'download_url')
DEPENDENCY_KEYS = ('extras run_requires test_requires build_requires '
'dev_requires provides meta_requires obsoleted_by '

View File

@ -37,7 +37,8 @@ class Cache(object):
directory under whatever :func:`get_cache_base` returns.
"""
if base is None:
base = os.path.join(get_cache_base(), 'resource-cache')
# Use native string to avoid issues on 2.x: see Python #20140.
base = os.path.join(get_cache_base(), str('resource-cache'))
# we use 'isdir' instead of 'exists', because we want to
# fail if there's a file with that name
if not os.path.isdir(base):
@ -158,10 +159,14 @@ class ResourceFinder(object):
self.loader = getattr(module, '__loader__', None)
self.base = os.path.dirname(getattr(module, '__file__', ''))
def _adjust_path(self, path):
return os.path.realpath(path)
def _make_path(self, resource_name):
parts = resource_name.split('/')
parts.insert(0, self.base)
return os.path.realpath(os.path.join(*parts))
result = os.path.join(*parts)
return self._adjust_path(result)
def _find(self, path):
return os.path.exists(path)
@ -217,6 +222,9 @@ class ZipResourceFinder(ResourceFinder):
self._files = zipimport._zip_directory_cache[archive]
self.index = sorted(self._files)
def _adjust_path(self, path):
return path
def _find(self, path):
path = path[self.prefix_len:]
if path in self._files:

View File

@ -13,7 +13,8 @@ import sys
from .compat import sysconfig, fsencode, detect_encoding, ZipFile
from .resources import finder
from .util import FileOperator, get_export_entry, convert_path, get_executable
from .util import (FileOperator, get_export_entry, convert_path,
get_executable, in_venv)
logger = logging.getLogger(__name__)
@ -95,7 +96,7 @@ class ScriptMaker(object):
executable = self.executable
elif not sysconfig.is_python_build():
executable = get_executable()
elif hasattr(sys, 'base_prefix') and sys.prefix != sys.base_prefix:
elif in_venv():
executable = os.path.join(sysconfig.get_path('scripts'),
'python%s' % sysconfig.get_config_var('EXE'))
else:

View File

@ -598,8 +598,20 @@ def get_cache_base(suffix=None):
result = os.path.join(result, suffix)
# we use 'isdir' instead of 'exists', because we want to
# fail if there's a file with that name
if not os.path.isdir(result):
os.makedirs(result)
if os.path.isdir(result):
usable = os.access(result, os.W_OK)
if not usable:
logger.warning('Directory exists but is not writable: %s', result)
else:
try:
os.makedirs(result)
usable = True
except OSError:
logger.warning('Unable to create %s', result, exc_info=True)
usable = False
if not usable:
result = tempfile.mkdtemp()
logger.warning('Default location unusable, using %s', result)
return result

View File

@ -601,7 +601,8 @@ class Wheel(object):
shutil.rmtree(workdir)
def _get_dylib_cache(self):
result = os.path.join(get_cache_base(), 'dylib-cache', sys.version[:3])
# Use native string to avoid issues on 2.x: see Python #20140.
result = os.path.join(get_cache_base(), str('dylib-cache'), sys.version[:3])
if not os.path.isdir(result):
os.makedirs(result)
return result

View File

@ -1,4 +1,4 @@
distlib==0.1.6
distlib==0.1.7
html5lib==1.0b1
six==1.3.0
colorama==0.2.7