Skip to content

Commit

Permalink
Merge pull request pypa#2 from undingen/more_cleanups
Browse files Browse the repository at this point in the history
Remove most of the setuptools hacks
  • Loading branch information
kmod committed May 19, 2015
2 parents 1b5100b + f08077c commit e715c2e
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 101 deletions.
Binary file modified virtualenv_support/setuptools-12.0.5-py2.py3-none-any.whl
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1608,7 +1608,6 @@ def run_script(self, script_name, namespace):
script_text = script_text.replace('\r', '\n')
script_filename = self._fn(self.egg_info, script)
namespace['__file__'] = script_filename
"""
if os.path.exists(script_filename):
source = open(script_filename).read()
code = compile(source, script_filename, 'exec')
Expand All @@ -1620,9 +1619,7 @@ def run_script(self, script_name, namespace):
)
script_code = compile(script_text, script_filename,'exec')
exec(script_code, namespace, namespace)
"""
print "Not implemented!!!!"
raise NotImplemented

def _has(self, path):
raise NotImplementedError(
"Can't perform this operation for unregistered loader type"
Expand Down Expand Up @@ -1739,51 +1736,11 @@ def build(cls, path):

load = build

import collections
from operator import itemgetter as _itemgetter


class manifest_mod__(tuple):
'manifest_mod(manifest, mtime)'
__slots__ = ()
_fields = ('manifest', 'mtime')
def __new__(_cls, manifest, mtime):
'Create new instance of manifest_mod(manifest, mtime)'
return tuple.__new__(_cls, (manifest, mtime))
@classmethod
def _make(cls, iterable, new=tuple.__new__, len=len):
'Make a new manifest_mod object from a sequence or iterable'
result = new(cls, iterable)
if len(result) != 2:
raise TypeError('Expected 2 arguments, got %d' % len(result))
return result
def __repr__(self):
'Return a nicely formatted representation string'
return 'manifest_mod(manifest=%r, mtime=%r)' % self
def _asdict(self):
'Return a new OrderedDict which maps field names to their values'
return collections.OrderedDict(zip(self._fields, self))
def _replace(_self, **kwds):
'Return a new manifest_mod object replacing specified fields with new values'
result = _self._make(map(kwds.pop, ('manifest', 'mtime'), _self))
if kwds:
raise ValueError('Got unexpected field names: %r' % kwds.keys())
return result
def __getnewargs__(self):
'Return self as a plain tuple. Used by copy and pickle.'
return tuple(self)
__dict__ = property(_asdict)
def __getstate__(self):
'Exclude the OrderedDict from pickling'
pass
manifest = property(_itemgetter(0), doc='Alias for field number 0')
mtime = property(_itemgetter(1), doc='Alias for field number 1')

class MemoizedZipManifests(ZipManifests):
"""
Memoized zipfile manifests.
"""

manifest_mod = collections.namedtuple('manifest_mod', 'manifest mtime')

def load(self, path):
Expand Down Expand Up @@ -2978,10 +2935,8 @@ def parse(s):
def _get_mro(cls):
"""Get an mro for a type or classic class"""
if not isinstance(cls, type):
#class cls(cls, object): pass
#return cls.__mro__[1:]
class _cls(object, cls): pass
return (_cls.__mro__[2], _cls.__mro__[1])
class cls(cls, object): pass
return cls.__mro__[1:]
return cls.__mro__

def _find_adapter(registry, ob):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,53 +24,11 @@
"parse", "Version", "LegacyVersion", "InvalidVersion", "VERSION_PATTERN"
]

import collections
from operator import itemgetter as _itemgetter
class _Version(tuple):
'_Version(epoch, release, dev, pre, post, local)'
__slots__ = ()
_fields = ('epoch', 'release', 'dev', 'pre', 'post', 'local')
def __new__(_cls, epoch, release, dev, pre, post, local):
'Create new instance of _Version(epoch, release, dev, pre, post, local)'
return tuple.__new__(_cls, (epoch, release, dev, pre, post, local))
@classmethod
def _make(cls, iterable, new=tuple.__new__, len=len):
'Make a new _Version object from a sequence or iterable'
result = new(cls, iterable)
if len(result) != 6:
raise TypeError('Expected 6 arguments, got %d' % len(result))
return result
def __repr__(self):
'Return a nicely formatted representation string'
return '_Version(epoch=%r, release=%r, dev=%r, pre=%r, post=%r, local=%r)' % self
def _asdict(self):
'Return a new OrderedDict which maps field names to their values'
return collections.OrderedDict(zip(self._fields, self))
def _replace(_self, **kwds):
'Return a new _Version object replacing specified fields with new values'
result = _self._make(map(kwds.pop, ('epoch', 'release', 'dev', 'pre', 'post', 'local'), _self))
if kwds:
raise ValueError('Got unexpected field names: %r' % kwds.keys())
return result
def __getnewargs__(self):
'Return self as a plain tuple. Used by copy and pickle.'
return tuple(self)
__dict__ = property(_asdict)
def __getstate__(self):
'Exclude the OrderedDict from pickling'
pass
epoch = property(_itemgetter(0), doc='Alias for field number 0')
release = property(_itemgetter(1), doc='Alias for field number 1')
dev = property(_itemgetter(2), doc='Alias for field number 2')
pre = property(_itemgetter(3), doc='Alias for field number 3')
post = property(_itemgetter(4), doc='Alias for field number 4')
local = property(_itemgetter(5), doc='Alias for field number 5')


#_Version = collections.namedtuple(
# "_Version",
# ["epoch", "release", "dev", "pre", "post", "local"],
#)

_Version = collections.namedtuple(
"_Version",
["epoch", "release", "dev", "pre", "post", "local"],
)


def parse(version):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,6 @@ def do_install_data(self):
old, self.distribution.data_files = self.distribution.data_files, []

for item in old:
print "adding item to data files:", item
if isinstance(item, tuple) and len(item) == 2:
if os.path.isabs(item[0]):
realpath = os.path.realpath(item[0])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,8 @@
from urlparse import urlparse, urlunparse, urljoin, urlsplit, urlunsplit
filterfalse = itertools.ifilterfalse

def reraise(tp, value, tb=None):
raise tp, value, tb
#exec("""def reraise(tp, value, tb=None):
#raise tp, value, tb""")
exec("""def reraise(tp, value, tb=None):
raise tp, value, tb""")

if PY3:
basestring = str
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,8 @@ def get_egg_cache_dir(self):
egg_cache_dir = os.path.join(os.curdir, '.eggs')
if not os.path.exists(egg_cache_dir):
os.mkdir(egg_cache_dir)
windows_support.hide_file(egg_cache_dir)
# Pyston change: we can't import windows_support yet
#windows_support.hide_file(egg_cache_dir)
readme_txt_filename = os.path.join(egg_cache_dir, 'README.txt')
with open(readme_txt_filename, 'w') as f:
f.write('This directory contains eggs that were downloaded '
Expand Down

0 comments on commit e715c2e

Please sign in to comment.