{% endfor %} | {% endfor %} | ||||
</ul> | </ul> | ||||
</div> | </div> | ||||
{% include "taggit_templatetags2/tagcanvas_include_js_static.html" %} | |||||
{% include_tagcanvas 'tag-cloud' '200 px' '200 px' 'taggit_templatetags2' 'application.Post' %} | |||||
<div id="tag-cloud"> | |||||
</div> | |||||
{% endblock %} | {% endblock %} |
from django.conf.urls import url | from django.conf.urls import url | ||||
from django.conf.urls import include | |||||
from taggit_templatetags2 import urls as taggit_templatetags2_urls | |||||
from . import views | from . import views | ||||
urlpatterns = [ | urlpatterns = [ | ||||
url(r'^drafts/$', views.post_draft_list, name='post_draft_list'), | url(r'^drafts/$', views.post_draft_list, name='post_draft_list'), | ||||
url(r'^post/(?P<pk>\d+)/publish/$', views.post_publish, name='post_publish'), | url(r'^post/(?P<pk>\d+)/publish/$', views.post_publish, name='post_publish'), | ||||
url(r'^post/(?P<pk>\d+)/remove/$', views.post_remove, name='post_remove'), | url(r'^post/(?P<pk>\d+)/remove/$', views.post_remove, name='post_remove'), | ||||
url(r'^tags/', include('taggit_templatetags2.urls')), | |||||
] | ] | ||||
from django.contrib.admin.views.decorators import staff_member_required | from django.contrib.admin.views.decorators import staff_member_required | ||||
from django.contrib.auth import authenticate, login, logout | from django.contrib.auth import authenticate, login, logout | ||||
from django.db.models import Q | from django.db.models import Q | ||||
from taggit_templatetags2.views import TagCanvasListView | |||||
import logging | import logging | ||||
import mysite.settings | import mysite.settings | ||||
def blog_search_list_view(request): | def blog_search_list_view(request): | ||||
return render(request, 'blog_search_list_view.html', {}) | return render(request, 'blog_search_list_view.html', {}) | ||||
def tag_cloud(request): | |||||
return render(request, 'tag_cloud.html', {}) |
#!/Users/Esthi/thesis_ek/thesisenv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
#!/Users/Esthi/thesis_ek/thesisenv/bin/python | |||||
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==33.1.1','console_scripts','easy_install' | |||||
__requires__ = 'setuptools==33.1.1' | |||||
import re | import re | ||||
import sys | import sys | ||||
from setuptools.command.easy_install import main | |||||
from pkg_resources import load_entry_point | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | ||||
sys.exit(main()) | |||||
sys.exit( | |||||
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install')() | |||||
) |
#!/Users/Esthi/thesis_ek/thesisenv/bin/python3 | |||||
# -*- coding: utf-8 -*- | |||||
#!/Users/Esthi/thesis_ek/thesisenv/bin/python | |||||
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==33.1.1','console_scripts','easy_install-3.6' | |||||
__requires__ = 'setuptools==33.1.1' | |||||
import re | import re | ||||
import sys | import sys | ||||
from setuptools.command.easy_install import main | |||||
from pkg_resources import load_entry_point | |||||
if __name__ == '__main__': | if __name__ == '__main__': | ||||
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) | ||||
sys.exit(main()) | |||||
sys.exit( | |||||
load_entry_point('setuptools==33.1.1', 'console_scripts', 'easy_install-3.6')() | |||||
) |
# Python 3.2 compatibility | # Python 3.2 compatibility | ||||
import imp as _imp | import imp as _imp | ||||
try: | |||||
FileExistsError | |||||
except NameError: | |||||
FileExistsError = OSError | |||||
from pkg_resources.extern import six | from pkg_resources.extern import six | ||||
from pkg_resources.extern.six.moves import urllib, map, filter | from pkg_resources.extern.six.moves import urllib, map, filter | ||||
__import__('pkg_resources.extern.packaging.markers') | __import__('pkg_resources.extern.packaging.markers') | ||||
if (3, 0) < sys.version_info < (3, 3): | |||||
raise RuntimeError("Python 3.3 or later is required") | |||||
__metaclass__ = type | |||||
if (3, 0) < sys.version_info < (3, 4): | |||||
raise RuntimeError("Python 3.4 or later is required") | |||||
if six.PY2: | if six.PY2: | ||||
# Those builtin exceptions are only defined in Python 3 | # Those builtin exceptions are only defined in Python 3 | ||||
XXX Currently this is the same as ``distutils.util.get_platform()``, but it | XXX Currently this is the same as ``distutils.util.get_platform()``, but it | ||||
needs some hacks for Linux and Mac OS X. | needs some hacks for Linux and Mac OS X. | ||||
""" | """ | ||||
try: | |||||
# Python 2.7 or >=3.2 | |||||
from sysconfig import get_platform | |||||
except ImportError: | |||||
from distutils.util import get_platform | |||||
from sysconfig import get_platform | |||||
plat = get_platform() | plat = get_platform() | ||||
if sys.platform == "darwin" and not plat.startswith('macosx-'): | if sys.platform == "darwin" and not plat.startswith('macosx-'): | ||||
"""List of resource names in the directory (like ``os.listdir()``)""" | """List of resource names in the directory (like ``os.listdir()``)""" | ||||
class WorkingSet(object): | |||||
class WorkingSet: | |||||
"""A collection of active distributions on sys.path (or a similar list)""" | """A collection of active distributions on sys.path (or a similar list)""" | ||||
def __init__(self, entries=None): | def __init__(self, entries=None): | ||||
distributions in the working set, otherwise only ones matching | distributions in the working set, otherwise only ones matching | ||||
both `group` and `name` are yielded (in distribution order). | both `group` and `name` are yielded (in distribution order). | ||||
""" | """ | ||||
for dist in self: | |||||
entries = dist.get_entry_map(group) | |||||
if name is None: | |||||
for ep in entries.values(): | |||||
yield ep | |||||
elif name in entries: | |||||
yield entries[name] | |||||
return ( | |||||
entry | |||||
for dist in self | |||||
for entry in dist.get_entry_map(group).values() | |||||
if name is None or name == entry.name | |||||
) | |||||
def run_script(self, requires, script_name): | def run_script(self, requires, script_name): | ||||
"""Locate distribution for `requires` and run `script_name` script""" | """Locate distribution for `requires` and run `script_name` script""" | ||||
return not req.marker or any(extra_evals) | return not req.marker or any(extra_evals) | ||||
class Environment(object): | |||||
class Environment: | |||||
"""Searchable snapshot of distributions on a search path""" | """Searchable snapshot of distributions on a search path""" | ||||
def __init__( | def __init__( | ||||
`platform` is an optional string specifying the name of the platform | `platform` is an optional string specifying the name of the platform | ||||
that platform-specific distributions must be compatible with. If | that platform-specific distributions must be compatible with. If | ||||
unspecified, it defaults to the current platform. `python` is an | unspecified, it defaults to the current platform. `python` is an | ||||
optional string naming the desired version of Python (e.g. ``'3.3'``); | |||||
optional string naming the desired version of Python (e.g. ``'3.6'``); | |||||
it defaults to the current version. | it defaults to the current version. | ||||
You may explicitly set `platform` (and/or `python`) to ``None`` if you | You may explicitly set `platform` (and/or `python`) to ``None`` if you | ||||
@classmethod | @classmethod | ||||
def _register(cls): | def _register(cls): | ||||
loader_cls = getattr( | |||||
importlib_machinery, | |||||
'SourceFileLoader', | |||||
type(None), | |||||
) | |||||
register_loader_type(loader_cls, cls) | |||||
loader_names = 'SourceFileLoader', 'SourcelessFileLoader', | |||||
for name in loader_names: | |||||
loader_cls = getattr(importlib_machinery, name, type(None)) | |||||
register_loader_type(loader_cls, cls) | |||||
DefaultProvider._register() | DefaultProvider._register() | ||||
).match | ).match | ||||
class EntryPoint(object): | |||||
class EntryPoint: | |||||
"""Object representing an advertised importable object""" | """Object representing an advertised importable object""" | ||||
def __init__(self, name, module_name, attrs=(), extras=(), dist=None): | def __init__(self, name, module_name, attrs=(), extras=(), dist=None): | ||||
return safe_version(value.strip()) or None | return safe_version(value.strip()) or None | ||||
class Distribution(object): | |||||
class Distribution: | |||||
"""Wrap an actual or potential sys.path entry w/metadata""" | """Wrap an actual or potential sys.path entry w/metadata""" | ||||
PKG_INFO = 'PKG-INFO' | PKG_INFO = 'PKG-INFO' | ||||
raise AttributeError(attr) | raise AttributeError(attr) | ||||
return getattr(self._provider, attr) | return getattr(self._provider, attr) | ||||
def __dir__(self): | |||||
return list( | |||||
set(super(Distribution, self).__dir__()) | |||||
| set( | |||||
attr for attr in self._provider.__dir__() | |||||
if not attr.startswith('_') | |||||
) | |||||
) | |||||
if not hasattr(object, '__dir__'): | |||||
# python 2.7 not supported | |||||
del __dir__ | |||||
@classmethod | @classmethod | ||||
def from_filename(cls, filename, metadata=None, **kw): | def from_filename(cls, filename, metadata=None, **kw): | ||||
return cls.from_location( | return cls.from_location( | ||||
dirname, filename = split(path) | dirname, filename = split(path) | ||||
if dirname and filename and not isdir(dirname): | if dirname and filename and not isdir(dirname): | ||||
_bypass_ensure_directory(dirname) | _bypass_ensure_directory(dirname) | ||||
mkdir(dirname, 0o755) | |||||
try: | |||||
mkdir(dirname, 0o755) | |||||
except FileExistsError: | |||||
pass | |||||
def split_sections(s): | def split_sections(s): |
# - Mac OS X: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html | # - Mac OS X: http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/index.html | ||||
# - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html | # - XDG spec for Un*x: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html | ||||
__version_info__ = (1, 4, 0) | |||||
__version_info__ = (1, 4, 3) | |||||
__version__ = '.'.join(map(str, __version_info__)) | __version__ = '.'.join(map(str, __version_info__)) | ||||
def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): | def site_data_dir(appname=None, appauthor=None, version=None, multipath=False): | ||||
"""Return full path to the user-shared data dir for this application. | |||||
r"""Return full path to the user-shared data dir for this application. | |||||
"appname" is the name of application. | "appname" is the name of application. | ||||
If None, just the system directory is returned. | If None, just the system directory is returned. | ||||
returned, or '/usr/local/share/<AppName>', | returned, or '/usr/local/share/<AppName>', | ||||
if XDG_DATA_DIRS is not set | if XDG_DATA_DIRS is not set | ||||
Typical user data directories are: | |||||
Typical site data directories are: | |||||
Mac OS X: /Library/Application Support/<AppName> | Mac OS X: /Library/Application Support/<AppName> | ||||
Unix: /usr/local/share/<AppName> or /usr/share/<AppName> | Unix: /usr/local/share/<AppName> or /usr/share/<AppName> | ||||
Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName> | Win XP: C:\Documents and Settings\All Users\Application Data\<AppAuthor>\<AppName> | ||||
<http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx> | <http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx> | ||||
for a discussion of issues. | for a discussion of issues. | ||||
Typical user data directories are: | |||||
Typical user config directories are: | |||||
Mac OS X: same as user_data_dir | Mac OS X: same as user_data_dir | ||||
Unix: ~/.config/<AppName> # or in $XDG_CONFIG_HOME, if defined | Unix: ~/.config/<AppName> # or in $XDG_CONFIG_HOME, if defined | ||||
Win *: same as user_data_dir | Win *: same as user_data_dir | ||||
For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. | For Unix, we follow the XDG spec and support $XDG_CONFIG_HOME. | ||||
That means, by deafult "~/.config/<AppName>". | |||||
That means, by default "~/.config/<AppName>". | |||||
""" | """ | ||||
if system in ["win32", "darwin"]: | if system in ["win32", "darwin"]: | ||||
path = user_data_dir(appname, appauthor, None, roaming) | path = user_data_dir(appname, appauthor, None, roaming) | ||||
def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): | def site_config_dir(appname=None, appauthor=None, version=None, multipath=False): | ||||
"""Return full path to the user-shared data dir for this application. | |||||
r"""Return full path to the user-shared data dir for this application. | |||||
"appname" is the name of application. | "appname" is the name of application. | ||||
If None, just the system directory is returned. | If None, just the system directory is returned. | ||||
returned. By default, the first item from XDG_CONFIG_DIRS is | returned. By default, the first item from XDG_CONFIG_DIRS is | ||||
returned, or '/etc/xdg/<AppName>', if XDG_CONFIG_DIRS is not set | returned, or '/etc/xdg/<AppName>', if XDG_CONFIG_DIRS is not set | ||||
Typical user data directories are: | |||||
Typical site config directories are: | |||||
Mac OS X: same as site_data_dir | Mac OS X: same as site_data_dir | ||||
Unix: /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> for each value in | Unix: /etc/xdg/<AppName> or $XDG_CONFIG_DIRS[i]/<AppName> for each value in | ||||
$XDG_CONFIG_DIRS | $XDG_CONFIG_DIRS | ||||
return path | return path | ||||
def user_state_dir(appname=None, appauthor=None, version=None, roaming=False): | |||||
r"""Return full path to the user-specific state dir for this application. | |||||
"appname" is the name of application. | |||||
If None, just the system directory is returned. | |||||
"appauthor" (only used on Windows) is the name of the | |||||
appauthor or distributing body for this application. Typically | |||||
it is the owning company name. This falls back to appname. You may | |||||
pass False to disable it. | |||||
"version" is an optional version path element to append to the | |||||
path. You might want to use this if you want multiple versions | |||||
of your app to be able to run independently. If used, this | |||||
would typically be "<major>.<minor>". | |||||
Only applied when appname is present. | |||||
"roaming" (boolean, default False) can be set True to use the Windows | |||||
roaming appdata directory. That means that for users on a Windows | |||||
network setup for roaming profiles, this user data will be | |||||
sync'd on login. See | |||||
<http://technet.microsoft.com/en-us/library/cc766489(WS.10).aspx> | |||||
for a discussion of issues. | |||||
Typical user state directories are: | |||||
Mac OS X: same as user_data_dir | |||||
Unix: ~/.local/state/<AppName> # or in $XDG_STATE_HOME, if defined | |||||
Win *: same as user_data_dir | |||||
For Unix, we follow this Debian proposal <https://wiki.debian.org/XDGBaseDirectorySpecification#state> | |||||
to extend the XDG spec and support $XDG_STATE_HOME. | |||||
That means, by default "~/.local/state/<AppName>". | |||||
""" | |||||
if system in ["win32", "darwin"]: | |||||
path = user_data_dir(appname, appauthor, None, roaming) | |||||
else: | |||||
path = os.getenv('XDG_STATE_HOME', os.path.expanduser("~/.local/state")) | |||||
if appname: | |||||
path = os.path.join(path, appname) | |||||
if appname and version: | |||||
path = os.path.join(path, version) | |||||
return path | |||||
def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): | def user_log_dir(appname=None, appauthor=None, version=None, opinion=True): | ||||
r"""Return full path to the user-specific log dir for this application. | r"""Return full path to the user-specific log dir for this application. | ||||
"Logs" to the base app data dir for Windows, and "log" to the | "Logs" to the base app data dir for Windows, and "log" to the | ||||
base cache dir for Unix. See discussion below. | base cache dir for Unix. See discussion below. | ||||
Typical user cache directories are: | |||||
Typical user log directories are: | |||||
Mac OS X: ~/Library/Logs/<AppName> | Mac OS X: ~/Library/Logs/<AppName> | ||||
Unix: ~/.cache/<AppName>/log # or under $XDG_CACHE_HOME if defined | Unix: ~/.cache/<AppName>/log # or under $XDG_CACHE_HOME if defined | ||||
Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs | Win XP: C:\Documents and Settings\<username>\Local Settings\Application Data\<AppAuthor>\<AppName>\Logs | ||||
class AppDirs(object): | class AppDirs(object): | ||||
"""Convenience wrapper for getting application dirs.""" | """Convenience wrapper for getting application dirs.""" | ||||
def __init__(self, appname, appauthor=None, version=None, roaming=False, | |||||
multipath=False): | |||||
def __init__(self, appname=None, appauthor=None, version=None, | |||||
roaming=False, multipath=False): | |||||
self.appname = appname | self.appname = appname | ||||
self.appauthor = appauthor | self.appauthor = appauthor | ||||
self.version = version | self.version = version | ||||
return user_cache_dir(self.appname, self.appauthor, | return user_cache_dir(self.appname, self.appauthor, | ||||
version=self.version) | version=self.version) | ||||
@property | |||||
def user_state_dir(self): | |||||
return user_state_dir(self.appname, self.appauthor, | |||||
version=self.version) | |||||
@property | @property | ||||
def user_log_dir(self): | def user_log_dir(self): | ||||
return user_log_dir(self.appname, self.appauthor, | return user_log_dir(self.appname, self.appauthor, | ||||
registry for this guarantees us the correct answer for all CSIDL_* | registry for this guarantees us the correct answer for all CSIDL_* | ||||
names. | names. | ||||
""" | """ | ||||
import _winreg | |||||
if PY3: | |||||
import winreg as _winreg | |||||
else: | |||||
import _winreg | |||||
shell_folder_name = { | shell_folder_name = { | ||||
"CSIDL_APPDATA": "AppData", | "CSIDL_APPDATA": "AppData", | ||||
if has_high_char: | if has_high_char: | ||||
buf = array.zeros('c', buf_size) | buf = array.zeros('c', buf_size) | ||||
kernel = win32.Kernel32.INSTANCE | kernel = win32.Kernel32.INSTANCE | ||||
if kernal.GetShortPathName(dir, buf, buf_size): | |||||
if kernel.GetShortPathName(dir, buf, buf_size): | |||||
dir = jna.Native.toString(buf.tostring()).rstrip("\0") | dir = jna.Native.toString(buf.tostring()).rstrip("\0") | ||||
return dir | return dir | ||||
appname = "MyApp" | appname = "MyApp" | ||||
appauthor = "MyCompany" | appauthor = "MyCompany" | ||||
props = ("user_data_dir", "site_data_dir", | |||||
"user_config_dir", "site_config_dir", | |||||
"user_cache_dir", "user_log_dir") | |||||
props = ("user_data_dir", | |||||
"user_config_dir", | |||||
"user_cache_dir", | |||||
"user_state_dir", | |||||
"user_log_dir", | |||||
"site_data_dir", | |||||
"site_config_dir") | |||||
print("-- app dirs %s --" % __version__) | |||||
print("-- app dirs (with optional 'version')") | print("-- app dirs (with optional 'version')") | ||||
dirs = AppDirs(appname, appauthor, version="1.0") | dirs = AppDirs(appname, appauthor, version="1.0") |
- embedded comments | - embedded comments | ||||
""" | """ | ||||
__version__ = "2.1.10" | |||||
__versionTime__ = "07 Oct 2016 01:31 UTC" | |||||
__version__ = "2.2.0" | |||||
__versionTime__ = "06 Mar 2017 02:06 UTC" | |||||
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" | __author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" | ||||
import string | import string | ||||
except UnicodeEncodeError: | except UnicodeEncodeError: | ||||
# Else encode it | # Else encode it | ||||
ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace') | ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace') | ||||
xmlcharref = Regex('&#\d+;') | |||||
xmlcharref = Regex(r'&#\d+;') | |||||
xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:]) | xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:]) | ||||
return xmlcharref.transformString(ret) | return xmlcharref.transformString(ret) | ||||
return None | return None | ||||
def getName(self): | def getName(self): | ||||
""" | |||||
r""" | |||||
Returns the results name for this token expression. Useful when several | Returns the results name for this token expression. Useful when several | ||||
different expressions might match at a particular location. | different expressions might match at a particular location. | ||||
def setParseAction( self, *fns, **kwargs ): | def setParseAction( self, *fns, **kwargs ): | ||||
""" | """ | ||||
Define action to perform when successfully matching parse element definition. | |||||
Define one or more actions to perform when successfully matching parse element definition. | |||||
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, | Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, | ||||
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: | C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: | ||||
- s = the original string being parsed (see note below) | - s = the original string being parsed (see note below) | ||||
def addParseAction( self, *fns, **kwargs ): | def addParseAction( self, *fns, **kwargs ): | ||||
""" | """ | ||||
Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | |||||
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | |||||
See examples in L{I{copy}<copy>}. | See examples in L{I{copy}<copy>}. | ||||
""" | """ | ||||
def clear(self): | def clear(self): | ||||
cache.clear() | cache.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
if _OrderedDict is not None: | if _OrderedDict is not None: | ||||
class _FifoCache(object): | class _FifoCache(object): | ||||
def set(self, key, value): | def set(self, key, value): | ||||
cache[key] = value | cache[key] = value | ||||
if len(cache) > size: | |||||
cache.popitem(False) | |||||
while len(cache) > size: | |||||
try: | |||||
cache.popitem(False) | |||||
except KeyError: | |||||
pass | |||||
def clear(self): | def clear(self): | ||||
cache.clear() | cache.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
else: | else: | ||||
class _FifoCache(object): | class _FifoCache(object): | ||||
def set(self, key, value): | def set(self, key, value): | ||||
cache[key] = value | cache[key] = value | ||||
if len(cache) > size: | |||||
while len(key_fifo) > size: | |||||
cache.pop(key_fifo.popleft(), None) | cache.pop(key_fifo.popleft(), None) | ||||
key_fifo.append(key) | key_fifo.append(key) | ||||
cache.clear() | cache.clear() | ||||
key_fifo.clear() | key_fifo.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
# argument cache for optimizing repeated calls when backtracking through recursive expressions | # argument cache for optimizing repeated calls when backtracking through recursive expressions | ||||
packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail | packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail | ||||
cap_word = Word(alphas.upper(), alphas.lower()) | cap_word = Word(alphas.upper(), alphas.lower()) | ||||
print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) | print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) | ||||
# the sum() builtin can be used to merge results into a single ParseResults object | |||||
print(sum(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity"))) | |||||
prints:: | prints:: | ||||
['More', 'Iron', 'Lead', 'Gold', 'I'] | |||||
[['More'], ['Iron'], ['Lead'], ['Gold'], ['I'], ['Electricity']] | |||||
['More', 'Iron', 'Lead', 'Gold', 'I', 'Electricity'] | |||||
""" | """ | ||||
try: | try: | ||||
return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ]) | return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ]) | ||||
warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), | warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), | ||||
SyntaxWarning, stacklevel=2) | SyntaxWarning, stacklevel=2) | ||||
return None | return None | ||||
return And( [ self, And._ErrorStop(), other ] ) | |||||
return self + And._ErrorStop() + other | |||||
def __rsub__(self, other ): | def __rsub__(self, other ): | ||||
""" | """ | ||||
class Regex(Token): | class Regex(Token): | ||||
""" | |||||
r""" | |||||
Token for matching strings that match a given regular expression. | Token for matching strings that match a given regular expression. | ||||
Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. | Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. | ||||
If the given regex contains named groups (defined using C{(?P<name>...)}), these will be preserved as | If the given regex contains named groups (defined using C{(?P<name>...)}), these will be preserved as | ||||
# replace escaped characters | # replace escaped characters | ||||
if self.escChar: | if self.escChar: | ||||
ret = re.sub(self.escCharReplacePattern,"\g<1>",ret) | |||||
ret = re.sub(self.escCharReplacePattern, r"\g<1>", ret) | |||||
# replace escaped quotes | # replace escaped quotes | ||||
if self.escQuote: | if self.escQuote: | ||||
constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. | constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. | ||||
- parseAction is the parse action to be associated with | - parseAction is the parse action to be associated with | ||||
expressions matching this operator expression (the | expressions matching this operator expression (the | ||||
parse action tuple member may be omitted) | |||||
parse action tuple member may be omitted); if the parse action | |||||
is passed a tuple or list of functions, this is equivalent to | |||||
calling C{setParseAction(*fn)} (L{ParserElement.setParseAction}) | |||||
- lpar - expression for matching left-parentheses (default=C{Suppress('(')}) | - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) | ||||
- rpar - expression for matching right-parentheses (default=C{Suppress(')')}) | - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) | ||||
else: | else: | ||||
raise ValueError("operator must indicate right or left associativity") | raise ValueError("operator must indicate right or left associativity") | ||||
if pa: | if pa: | ||||
matchExpr.setParseAction( pa ) | |||||
if isinstance(pa, (tuple, list)): | |||||
matchExpr.setParseAction(*pa) | |||||
else: | |||||
matchExpr.setParseAction(pa) | |||||
thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) | thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) | ||||
lastExpr = thisExpr | lastExpr = thisExpr | ||||
ret <<= lastExpr | ret <<= lastExpr |
# on later Python versions to cause relative imports | # on later Python versions to cause relative imports | ||||
# in the vendor package to resolve the same modules | # in the vendor package to resolve the same modules | ||||
# as those going through this importer. | # as those going through this importer. | ||||
if sys.version_info > (3, 3): | |||||
if prefix and sys.version_info > (3, 3): | |||||
del sys.modules[extant] | del sys.modules[extant] | ||||
return mod | return mod | ||||
except ImportError: | except ImportError: |
import errno | import errno | ||||
import sys | import sys | ||||
from .extern import six | |||||
def _makedirs_31(path, exist_ok=False): | def _makedirs_31(path, exist_ok=False): | ||||
try: | try: | ||||
# and exists_ok considerations are disentangled. | # and exists_ok considerations are disentangled. | ||||
# See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663 | # See https://github.com/pypa/setuptools/pull/1083#issuecomment-315168663 | ||||
needs_makedirs = ( | needs_makedirs = ( | ||||
sys.version_info < (3, 2, 5) or | |||||
(3, 3) <= sys.version_info < (3, 3, 6) or | |||||
six.PY2 or | |||||
(3, 4) <= sys.version_info < (3, 4, 1) | (3, 4) <= sys.version_info < (3, 4, 1) | ||||
) | ) | ||||
makedirs = _makedirs_31 if needs_makedirs else os.makedirs | makedirs = _makedirs_31 if needs_makedirs else os.makedirs |
.. image:: https://img.shields.io/pypi/v/setuptools.svg | |||||
:target: https://pypi.org/project/setuptools | |||||
.. image:: https://readthedocs.org/projects/setuptools/badge/?version=latest | |||||
:target: https://setuptools.readthedocs.io | |||||
.. image:: https://img.shields.io/travis/pypa/setuptools/master.svg?label=Linux%20build%20%40%20Travis%20CI | |||||
:target: https://travis-ci.org/pypa/setuptools | |||||
.. image:: https://img.shields.io/appveyor/ci/jaraco/setuptools/master.svg?label=Windows%20build%20%40%20Appveyor | |||||
:target: https://ci.appveyor.com/project/jaraco/setuptools/branch/master | |||||
.. image:: https://img.shields.io/pypi/pyversions/setuptools.svg | |||||
See the `Installation Instructions | |||||
<https://packaging.python.org/installing/>`_ in the Python Packaging | |||||
User's Guide for instructions on installing, upgrading, and uninstalling | |||||
Setuptools. | |||||
The project is `maintained at GitHub <https://github.com/pypa/setuptools>`_. | |||||
Questions and comments should be directed to the `distutils-sig | |||||
mailing list <http://mail.python.org/pipermail/distutils-sig/>`_. | |||||
Bug reports and especially tested patches may be | |||||
submitted directly to the `bug tracker | |||||
<https://github.com/pypa/setuptools/issues>`_. | |||||
Code of Conduct | |||||
--------------- | |||||
Everyone interacting in the setuptools project's codebases, issue trackers, | |||||
chat rooms, and mailing lists is expected to follow the | |||||
`PyPA Code of Conduct <https://www.pypa.io/en/latest/code-of-conduct/>`_. | |||||
pip |
Copyright (C) 2016 Jason R Coombs <jaraco@jaraco.com> | |||||
Permission is hereby granted, free of charge, to any person obtaining a copy of | |||||
this software and associated documentation files (the "Software"), to deal in | |||||
the Software without restriction, including without limitation the rights to | |||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies | |||||
of the Software, and to permit persons to whom the Software is furnished to do | |||||
so, subject to the following conditions: | |||||
The above copyright notice and this permission notice shall be included in all | |||||
copies or substantial portions of the Software. | |||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | |||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | |||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | |||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | |||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | |||||
SOFTWARE. |
Metadata-Version: 2.0 | |||||
Name: setuptools | |||||
Version: 39.0.1 | |||||
Summary: Easily download, build, install, upgrade, and uninstall Python packages | |||||
Home-page: https://github.com/pypa/setuptools | |||||
Author: Python Packaging Authority | |||||
Author-email: distutils-sig@python.org | |||||
License: UNKNOWN | |||||
Project-URL: Documentation, https://setuptools.readthedocs.io/ | |||||
Keywords: CPAN PyPI distutils eggs package management | |||||
Platform: UNKNOWN | |||||
Classifier: Development Status :: 5 - Production/Stable | |||||
Classifier: Intended Audience :: Developers | |||||
Classifier: License :: OSI Approved :: MIT License | |||||
Classifier: Operating System :: OS Independent | |||||
Classifier: Programming Language :: Python :: 2 | |||||
Classifier: Programming Language :: Python :: 2.7 | |||||
Classifier: Programming Language :: Python :: 3 | |||||
Classifier: Programming Language :: Python :: 3.3 | |||||
Classifier: Programming Language :: Python :: 3.4 | |||||
Classifier: Programming Language :: Python :: 3.5 | |||||
Classifier: Programming Language :: Python :: 3.6 | |||||
Classifier: Topic :: Software Development :: Libraries :: Python Modules | |||||
Classifier: Topic :: System :: Archiving :: Packaging | |||||
Classifier: Topic :: System :: Systems Administration | |||||
Classifier: Topic :: Utilities | |||||
Requires-Python: >=2.7,!=3.0.*,!=3.1.*,!=3.2.* | |||||
Description-Content-Type: text/x-rst; charset=UTF-8 | |||||
Provides-Extra: certs | |||||
Provides-Extra: ssl | |||||
Provides-Extra: certs | |||||
Requires-Dist: certifi (==2016.9.26); extra == 'certs' | |||||
Provides-Extra: ssl | |||||
Requires-Dist: wincertstore (==0.2); sys_platform=='win32' and extra == 'ssl' | |||||
.. image:: https://img.shields.io/pypi/v/setuptools.svg | |||||
:target: https://pypi.org/project/setuptools | |||||
.. image:: https://readthedocs.org/projects/setuptools/badge/?version=latest | |||||
:target: https://setuptools.readthedocs.io | |||||
.. image:: https://img.shields.io/travis/pypa/setuptools/master.svg?label=Linux%20build%20%40%20Travis%20CI | |||||
:target: https://travis-ci.org/pypa/setuptools | |||||
.. image:: https://img.shields.io/appveyor/ci/jaraco/setuptools/master.svg?label=Windows%20build%20%40%20Appveyor | |||||
:target: https://ci.appveyor.com/project/jaraco/setuptools/branch/master | |||||
.. image:: https://img.shields.io/pypi/pyversions/setuptools.svg | |||||
See the `Installation Instructions | |||||
<https://packaging.python.org/installing/>`_ in the Python Packaging | |||||
User's Guide for instructions on installing, upgrading, and uninstalling | |||||
Setuptools. | |||||
The project is `maintained at GitHub <https://github.com/pypa/setuptools>`_. | |||||
Questions and comments should be directed to the `distutils-sig | |||||
mailing list <http://mail.python.org/pipermail/distutils-sig/>`_. | |||||
Bug reports and especially tested patches may be | |||||
submitted directly to the `bug tracker | |||||
<https://github.com/pypa/setuptools/issues>`_. | |||||
Code of Conduct | |||||
--------------- | |||||
Everyone interacting in the setuptools project's codebases, issue trackers, | |||||
chat rooms, and mailing lists is expected to follow the | |||||
`PyPA Code of Conduct <https://www.pypa.io/en/latest/code-of-conduct/>`_. | |||||
easy_install.py,sha256=MDC9vt5AxDsXX5qcKlBz2TnW6Tpuv_AobnfhCJ9X3PM,126 | |||||
pkg_resources/__init__.py,sha256=YQ4_WQnPztMsUy1yuvp7ZRBPK9IhOyhgosLpvkFso1I,103551 | |||||
pkg_resources/py31compat.py,sha256=-ysVqoxLetAnL94uM0kHkomKQTC1JZLN2ZUjqUhMeKE,600 | |||||
pkg_resources/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | |||||
pkg_resources/_vendor/appdirs.py,sha256=tgGaL0m4Jo2VeuGfoOOifLv7a7oUEJu2n1vRkqoPw-0,22374 | |||||
pkg_resources/_vendor/pyparsing.py,sha256=PifeLY3-WhIcBVzLtv0U4T_pwDtPruBhBCkg5vLqa28,229867 | |||||
pkg_resources/_vendor/six.py,sha256=A6hdJZVjI3t_geebZ9BzUvwRrIXo0lfwzQlM2LcKyas,30098 | |||||
pkg_resources/_vendor/packaging/__about__.py,sha256=zkcCPTN_6TcLW0Nrlg0176-R1QQ_WVPTm8sz1R4-HjM,720 | |||||
pkg_resources/_vendor/packaging/__init__.py,sha256=_vNac5TrzwsrzbOFIbF-5cHqc_Y2aPT2D7zrIR06BOo,513 | |||||
pkg_resources/_vendor/packaging/_compat.py,sha256=Vi_A0rAQeHbU-a9X0tt1yQm9RqkgQbDSxzRw8WlU9kA,860 | |||||
pkg_resources/_vendor/packaging/_structures.py,sha256=RImECJ4c_wTlaTYYwZYLHEiebDMaAJmK1oPARhw1T5o,1416 | |||||
pkg_resources/_vendor/packaging/markers.py,sha256=uEcBBtGvzqltgnArqb9c4RrcInXezDLos14zbBHhWJo,8248 | |||||
pkg_resources/_vendor/packaging/requirements.py,sha256=SikL2UynbsT0qtY9ltqngndha_sfo0w6XGFhAhoSoaQ,4355 | |||||
pkg_resources/_vendor/packaging/specifiers.py,sha256=SAMRerzO3fK2IkFZCaZkuwZaL_EGqHNOz4pni4vhnN0,28025 | |||||
pkg_resources/_vendor/packaging/utils.py,sha256=3m6WvPm6NNxE8rkTGmn0r75B_GZSGg7ikafxHsBN1WA,421 | |||||
pkg_resources/_vendor/packaging/version.py,sha256=OwGnxYfr2ghNzYx59qWIBkrK3SnB6n-Zfd1XaLpnnM0,11556 | |||||
pkg_resources/extern/__init__.py,sha256=JUtlHHvlxHSNuB4pWqNjcx7n6kG-fwXg7qmJ2zNJlIY,2487 | |||||
setuptools/__init__.py,sha256=WWIdCbFJnZ9fZoaWDN_x1vDA_Rkm-Sc15iKvPtIYKFs,5700 | |||||
setuptools/archive_util.py,sha256=kw8Ib_lKjCcnPKNbS7h8HztRVK0d5RacU3r_KRdVnmM,6592 | |||||
setuptools/build_meta.py,sha256=FllaKTr1vSJyiUeRjVJEZmeEaRzhYueNlimtcwaJba8,5671 | |||||
setuptools/cli-32.exe,sha256=dfEuovMNnA2HLa3jRfMPVi5tk4R7alCbpTvuxtCyw0Y,65536 | |||||
setuptools/cli-64.exe,sha256=KLABu5pyrnokJCv6skjXZ6GsXeyYHGcqOUT3oHI3Xpo,74752 | |||||
setuptools/cli.exe,sha256=dfEuovMNnA2HLa3jRfMPVi5tk4R7alCbpTvuxtCyw0Y,65536 | |||||
setuptools/config.py,sha256=tVYBM3w1U_uBRRTOZydflxyZ_IrTJT5odlZz3cbuhSw,16381 | |||||
setuptools/dep_util.py,sha256=fgixvC1R7sH3r13ktyf7N0FALoqEXL1cBarmNpSEoWg,935 | |||||
setuptools/depends.py,sha256=hC8QIDcM3VDpRXvRVA6OfL9AaQfxvhxHcN_w6sAyNq8,5837 | |||||
setuptools/dist.py,sha256=_wCSFiGqwyaOUTj0tBjqZF2bqW9aEVu4W1D4gmsveno,42514 | |||||
setuptools/extension.py,sha256=uc6nHI-MxwmNCNPbUiBnybSyqhpJqjbhvOQ-emdvt_E,1729 | |||||
setuptools/glibc.py,sha256=X64VvGPL2AbURKwYRsWJOXXGAYOiF_v2qixeTkAULuU,3146 | |||||
setuptools/glob.py,sha256=Y-fpv8wdHZzv9DPCaGACpMSBWJ6amq_1e0R_i8_el4w,5207 | |||||
setuptools/gui-32.exe,sha256=XBr0bHMA6Hpz2s9s9Bzjl-PwXfa9nH4ie0rFn4V2kWA,65536 | |||||
setuptools/gui-64.exe,sha256=aYKMhX1IJLn4ULHgWX0sE0yREUt6B3TEHf_jOw6yNyE,75264 | |||||
setuptools/gui.exe,sha256=XBr0bHMA6Hpz2s9s9Bzjl-PwXfa9nH4ie0rFn4V2kWA,65536 | |||||
setuptools/launch.py,sha256=sd7ejwhBocCDx_wG9rIs0OaZ8HtmmFU8ZC6IR_S0Lvg,787 | |||||
setuptools/lib2to3_ex.py,sha256=t5e12hbR2pi9V4ezWDTB4JM-AISUnGOkmcnYHek3xjg,2013 | |||||
setuptools/monkey.py,sha256=zZGTH7p0xeXQKLmEwJTPIE4m5m7fJeHoAsxyv5M8e_E,5789 | |||||
setuptools/msvc.py,sha256=8EiV9ypb3EQJQssPcH1HZbdNsbRvqsFnJ7wPFEGwFIo,40877 | |||||
setuptools/namespaces.py,sha256=F0Nrbv8KCT2OrO7rwa03om4N4GZKAlnce-rr-cgDQa8,3199 | |||||
setuptools/package_index.py,sha256=NEsrNXnt_9gGP-nCCYzV-0gk15lXAGO7RghRxpfqLqE,40142 | |||||
setuptools/pep425tags.py,sha256=NuGMx1gGif7x6iYemh0LfgBr_FZF5GFORIbgmMdU8J4,10882 | |||||
setuptools/py27compat.py,sha256=3mwxRMDk5Q5O1rSXOERbQDXhFqwDJhhUitfMW_qpUCo,536 | |||||
setuptools/py31compat.py,sha256=XuU1HCsGE_3zGvBRIhYw2iB-IhCFK4-Pxw_jMiqdNVk,1192 | |||||
setuptools/py33compat.py,sha256=NKS84nl4LjLIoad6OQfgmygZn4mMvrok_b1N1tzebew,1182 | |||||
setuptools/py36compat.py,sha256=VUDWxmu5rt4QHlGTRtAFu6W5jvfL6WBjeDAzeoBy0OM,2891 | |||||
setuptools/sandbox.py,sha256=9UbwfEL5QY436oMI1LtFWohhoZ-UzwHvGyZjUH_qhkw,14276 | |||||
setuptools/script (dev).tmpl,sha256=f7MR17dTkzaqkCMSVseyOCMVrPVSMdmTQsaB8cZzfuI,201 | |||||
setuptools/script.tmpl,sha256=WGTt5piezO27c-Dbx6l5Q4T3Ff20A5z7872hv3aAhYY,138 | |||||
setuptools/site-patch.py,sha256=BVt6yIrDMXJoflA5J6DJIcsJUfW_XEeVhOzelTTFDP4,2307 | |||||
setuptools/ssl_support.py,sha256=YBDJsCZjSp62CWjxmSkke9kn9rhHHj25Cus6zhJRW3c,8492 | |||||
setuptools/unicode_utils.py,sha256=NOiZ_5hD72A6w-4wVj8awHFM3n51Kmw1Ic_vx15XFqw,996 | |||||
setuptools/version.py,sha256=og_cuZQb0QI6ukKZFfZWPlr1HgJBPPn2vO2m_bI9ZTE,144 | |||||
setuptools/wheel.py,sha256=yF9usxMvpwnymV-oOo5mfDiv3E8jrKkbDEItT7_kjBs,7230 | |||||
setuptools/windows_support.py,sha256=5GrfqSP2-dLGJoZTq2g6dCKkyQxxa2n5IQiXlJCoYEE,714 | |||||
setuptools/_vendor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 | |||||
setuptools/_vendor/pyparsing.py,sha256=PifeLY3-WhIcBVzLtv0U4T_pwDtPruBhBCkg5vLqa28,229867 | |||||
setuptools/_vendor/six.py,sha256=A6hdJZVjI3t_geebZ9BzUvwRrIXo0lfwzQlM2LcKyas,30098 | |||||
setuptools/_vendor/packaging/__about__.py,sha256=zkcCPTN_6TcLW0Nrlg0176-R1QQ_WVPTm8sz1R4-HjM,720 | |||||
setuptools/_vendor/packaging/__init__.py,sha256=_vNac5TrzwsrzbOFIbF-5cHqc_Y2aPT2D7zrIR06BOo,513 | |||||
setuptools/_vendor/packaging/_compat.py,sha256=Vi_A0rAQeHbU-a9X0tt1yQm9RqkgQbDSxzRw8WlU9kA,860 | |||||
setuptools/_vendor/packaging/_structures.py,sha256=RImECJ4c_wTlaTYYwZYLHEiebDMaAJmK1oPARhw1T5o,1416 | |||||
setuptools/_vendor/packaging/markers.py,sha256=Gvpk9EY20yKaMTiKgQZ8yFEEpodqVgVYtfekoic1Yts,8239 | |||||
setuptools/_vendor/packaging/requirements.py,sha256=t44M2HVWtr8phIz2OhnILzuGT3rTATaovctV1dpnVIg,4343 | |||||
setuptools/_vendor/packaging/specifiers.py,sha256=SAMRerzO3fK2IkFZCaZkuwZaL_EGqHNOz4pni4vhnN0,28025 | |||||
setuptools/_vendor/packaging/utils.py,sha256=3m6WvPm6NNxE8rkTGmn0r75B_GZSGg7ikafxHsBN1WA,421 | |||||
setuptools/_vendor/packaging/version.py,sha256=OwGnxYfr2ghNzYx59qWIBkrK3SnB6n-Zfd1XaLpnnM0,11556 | |||||
setuptools/command/__init__.py,sha256=NWzJ0A1BEengZpVeqUyWLNm2bk4P3F4iL5QUErHy7kA,594 | |||||
setuptools/command/alias.py,sha256=KjpE0sz_SDIHv3fpZcIQK-sCkJz-SrC6Gmug6b9Nkc8,2426 | |||||
setuptools/command/bdist_egg.py,sha256=RQ9h8BmSVpXKJQST3i_b_sm093Z-aCXbfMBEM2IrI-Q,18185 | |||||
setuptools/command/bdist_rpm.py,sha256=B7l0TnzCGb-0nLlm6rS00jWLkojASwVmdhW2w5Qz_Ak,1508 | |||||
setuptools/command/bdist_wininst.py,sha256=_6dz3lpB1tY200LxKPLM7qgwTCceOMgaWFF-jW2-pm0,637 | |||||
setuptools/command/build_clib.py,sha256=bQ9aBr-5ZSO-9fGsGsDLz0mnnFteHUZnftVLkhvHDq0,4484 | |||||
setuptools/command/build_ext.py,sha256=PCRAZ2xYnqyEof7EFNtpKYl0sZzT0qdKUNTH3sUdPqk,13173 | |||||
setuptools/command/build_py.py,sha256=yWyYaaS9F3o9JbIczn064A5g1C5_UiKRDxGaTqYbtLE,9596 | |||||
setuptools/command/develop.py,sha256=wKbOw2_qUvcDti2lZmtxbDmYb54yAAibExzXIvToz-A,8046 | |||||
setuptools/command/dist_info.py,sha256=5t6kOfrdgALT-P3ogss6PF9k-Leyesueycuk3dUyZnI,960 | |||||
setuptools/command/easy_install.py,sha256=I0UOqFrS9U7fmh0uW57IR37keMKSeqXp6z61Oz1nEoA,87054 | |||||
setuptools/command/egg_info.py,sha256=3b5Y3t_bl_zZRCkmlGi3igvRze9oOaxd-dVf2w1FBOc,24800 | |||||
setuptools/command/install.py,sha256=a0EZpL_A866KEdhicTGbuyD_TYl1sykfzdrri-zazT4,4683 | |||||
setuptools/command/install_egg_info.py,sha256=bMgeIeRiXzQ4DAGPV1328kcjwQjHjOWU4FngAWLV78Q,2203 | |||||
setuptools/command/install_lib.py,sha256=11mxf0Ch12NsuYwS8PHwXBRvyh671QAM4cTRh7epzG0,3840 | |||||
setuptools/command/install_scripts.py,sha256=UD0rEZ6861mTYhIdzcsqKnUl8PozocXWl9VBQ1VTWnc,2439 | |||||
setuptools/command/launcher manifest.xml,sha256=xlLbjWrB01tKC0-hlVkOKkiSPbzMml2eOPtJ_ucCnbE,628 | |||||
setuptools/command/py36compat.py,sha256=SzjZcOxF7zdFUT47Zv2n7AM3H8koDys_0OpS-n9gIfc,4986 | |||||
setuptools/command/register.py,sha256=bHlMm1qmBbSdahTOT8w6UhA-EgeQIz7p6cD-qOauaiI,270 | |||||
setuptools/command/rotate.py,sha256=co5C1EkI7P0GGT6Tqz-T2SIj2LBJTZXYELpmao6d4KQ,2164 | |||||
setuptools/command/saveopts.py,sha256=za7QCBcQimKKriWcoCcbhxPjUz30gSB74zuTL47xpP4,658 | |||||
setuptools/command/sdist.py,sha256=obDTe2BmWt2PlnFPZZh7e0LWvemEsbCCO9MzhrTZjm8,6711 | |||||
setuptools/command/setopt.py,sha256=NTWDyx-gjDF-txf4dO577s7LOzHVoKR0Mq33rFxaRr8,5085 | |||||
setuptools/command/test.py,sha256=MeBAcXUePGjPKqjz4zvTrHatLvNsjlPFcagt3XnFYdk,9214 | |||||
setuptools/command/upload.py,sha256=i1gfItZ3nQOn5FKXb8tLC2Kd7eKC8lWO4bdE6NqGpE4,1172 | |||||
setuptools/command/upload_docs.py,sha256=oXiGplM_cUKLwE4CWWw98RzCufAu8tBhMC97GegFcms,7311 | |||||
setuptools/extern/__init__.py,sha256=2eKMsBMwsZqolIcYBtLZU3t96s6xSTP4PTaNfM5P-I0,2499 | |||||
setuptools-39.0.1.dist-info/DESCRIPTION.rst,sha256=It3a3GRjT5701mqhrpMcLyW_YS2Dokv-X8zWoTaMRe0,1422 | |||||
setuptools-39.0.1.dist-info/LICENSE.txt,sha256=wyo6w5WvYyHv0ovnPQagDw22q4h9HCHU_sRhKNIFbVo,1078 | |||||
setuptools-39.0.1.dist-info/METADATA,sha256=bUSvsq3nbwr4FDQmI4Cu1Sd17lRO4y4MFANuLmZ70gs,2903 | |||||
setuptools-39.0.1.dist-info/RECORD,, | |||||
setuptools-39.0.1.dist-info/WHEEL,sha256=kdsN-5OJAZIiHN-iO4Rhl82KyS0bDWf4uBwMbkNafr8,110 | |||||
setuptools-39.0.1.dist-info/dependency_links.txt,sha256=HlkCFkoK5TbZ5EMLbLKYhLcY_E31kBWD8TqW2EgmatQ,239 | |||||
setuptools-39.0.1.dist-info/entry_points.txt,sha256=jBqCYDlVjl__sjYFGXo1JQGIMAYFJE-prYWUtnMZEew,2990 | |||||
setuptools-39.0.1.dist-info/metadata.json,sha256=kJuHY3HestbJAAqqkLVW75x2Uxgxd2qaz4sQAfFCtXM,4969 | |||||
setuptools-39.0.1.dist-info/top_level.txt,sha256=2HUXVVwA4Pff1xgTFr3GsTXXKaPaO6vlG6oNJ_4u4Tg,38 | |||||
setuptools-39.0.1.dist-info/zip-safe,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1 | |||||
../../../bin/easy_install,sha256=1HY9dEozZxF27JG8uBhjj5mzBtKNnJcCvl9bsqfUFVQ,262 | |||||
../../../bin/easy_install-3.6,sha256=1HY9dEozZxF27JG8uBhjj5mzBtKNnJcCvl9bsqfUFVQ,262 | |||||
setuptools-39.0.1.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 | |||||
__pycache__/easy_install.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/_structures.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/version.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/requirements.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/markers.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/_compat.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/specifiers.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/__about__.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/utils.cpython-36.pyc,, | |||||
setuptools/_vendor/packaging/__pycache__/__init__.cpython-36.pyc,, | |||||
setuptools/_vendor/__pycache__/six.cpython-36.pyc,, | |||||
setuptools/_vendor/__pycache__/__init__.cpython-36.pyc,, | |||||
setuptools/_vendor/__pycache__/pyparsing.cpython-36.pyc,, | |||||
setuptools/__pycache__/package_index.cpython-36.pyc,, | |||||
setuptools/__pycache__/py31compat.cpython-36.pyc,, | |||||
setuptools/__pycache__/sandbox.cpython-36.pyc,, | |||||
setuptools/__pycache__/windows_support.cpython-36.pyc,, | |||||
setuptools/__pycache__/wheel.cpython-36.pyc,, | |||||
setuptools/__pycache__/version.cpython-36.pyc,, | |||||
setuptools/__pycache__/site-patch.cpython-36.pyc,, | |||||
setuptools/__pycache__/launch.cpython-36.pyc,, | |||||
setuptools/__pycache__/unicode_utils.cpython-36.pyc,, | |||||
setuptools/__pycache__/config.cpython-36.pyc,, | |||||
setuptools/__pycache__/glibc.cpython-36.pyc,, | |||||
setuptools/__pycache__/ssl_support.cpython-36.pyc,, | |||||
setuptools/__pycache__/depends.cpython-36.pyc,, | |||||
setuptools/__pycache__/glob.cpython-36.pyc,, | |||||
setuptools/__pycache__/msvc.cpython-36.pyc,, | |||||
setuptools/__pycache__/py27compat.cpython-36.pyc,, | |||||
setuptools/__pycache__/pep425tags.cpython-36.pyc,, | |||||
setuptools/__pycache__/py33compat.cpython-36.pyc,, | |||||
setuptools/__pycache__/lib2to3_ex.cpython-36.pyc,, | |||||
setuptools/__pycache__/monkey.cpython-36.pyc,, | |||||
setuptools/__pycache__/py36compat.cpython-36.pyc,, | |||||
setuptools/__pycache__/dist.cpython-36.pyc,, | |||||
setuptools/__pycache__/build_meta.cpython-36.pyc,, | |||||
setuptools/__pycache__/namespaces.cpython-36.pyc,, | |||||
setuptools/__pycache__/dep_util.cpython-36.pyc,, | |||||
setuptools/__pycache__/__init__.cpython-36.pyc,, | |||||
setuptools/__pycache__/extension.cpython-36.pyc,, | |||||
setuptools/__pycache__/archive_util.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/alias.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/register.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/install_lib.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/setopt.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/bdist_egg.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/bdist_rpm.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/dist_info.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/develop.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/build_py.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/build_clib.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/upload.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/sdist.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/install.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/egg_info.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/py36compat.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/easy_install.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/build_ext.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/rotate.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/upload_docs.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/saveopts.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/__init__.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/test.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/bdist_wininst.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/install_scripts.cpython-36.pyc,, | |||||
setuptools/command/__pycache__/install_egg_info.cpython-36.pyc,, | |||||
setuptools/extern/__pycache__/__init__.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/_structures.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/version.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/requirements.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/markers.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/_compat.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/specifiers.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/__about__.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/utils.cpython-36.pyc,, | |||||
pkg_resources/_vendor/packaging/__pycache__/__init__.cpython-36.pyc,, | |||||
pkg_resources/_vendor/__pycache__/appdirs.cpython-36.pyc,, | |||||
pkg_resources/_vendor/__pycache__/six.cpython-36.pyc,, | |||||
pkg_resources/_vendor/__pycache__/__init__.cpython-36.pyc,, | |||||
pkg_resources/_vendor/__pycache__/pyparsing.cpython-36.pyc,, | |||||
pkg_resources/__pycache__/py31compat.cpython-36.pyc,, | |||||
pkg_resources/__pycache__/__init__.cpython-36.pyc,, | |||||
pkg_resources/extern/__pycache__/__init__.cpython-36.pyc,, |
Wheel-Version: 1.0 | |||||
Generator: bdist_wheel (0.30.0) | |||||
Root-Is-Purelib: true | |||||
Tag: py2-none-any | |||||
Tag: py3-none-any | |||||
https://files.pythonhosted.org/packages/source/c/certifi/certifi-2016.9.26.tar.gz#md5=baa81e951a29958563689d868ef1064d | |||||
https://files.pythonhosted.org/packages/source/w/wincertstore/wincertstore-0.2.zip#md5=ae728f2f007185648d0c7a8679b361e2 |
[console_scripts] | |||||
easy_install = setuptools.command.easy_install:main | |||||
easy_install-3.6 = setuptools.command.easy_install:main | |||||
[distutils.commands] | |||||
alias = setuptools.command.alias:alias | |||||
bdist_egg = setuptools.command.bdist_egg:bdist_egg | |||||
bdist_rpm = setuptools.command.bdist_rpm:bdist_rpm | |||||
bdist_wininst = setuptools.command.bdist_wininst:bdist_wininst | |||||
build_clib = setuptools.command.build_clib:build_clib | |||||
build_ext = setuptools.command.build_ext:build_ext | |||||
build_py = setuptools.command.build_py:build_py | |||||
develop = setuptools.command.develop:develop | |||||
dist_info = setuptools.command.dist_info:dist_info | |||||
easy_install = setuptools.command.easy_install:easy_install | |||||
egg_info = setuptools.command.egg_info:egg_info | |||||
install = setuptools.command.install:install | |||||
install_egg_info = setuptools.command.install_egg_info:install_egg_info | |||||
install_lib = setuptools.command.install_lib:install_lib | |||||
install_scripts = setuptools.command.install_scripts:install_scripts | |||||
register = setuptools.command.register:register | |||||
rotate = setuptools.command.rotate:rotate | |||||
saveopts = setuptools.command.saveopts:saveopts | |||||
sdist = setuptools.command.sdist:sdist | |||||
setopt = setuptools.command.setopt:setopt | |||||
test = setuptools.command.test:test | |||||
upload = setuptools.command.upload:upload | |||||
upload_docs = setuptools.command.upload_docs:upload_docs | |||||
[distutils.setup_keywords] | |||||
convert_2to3_doctests = setuptools.dist:assert_string_list | |||||
dependency_links = setuptools.dist:assert_string_list | |||||
eager_resources = setuptools.dist:assert_string_list | |||||
entry_points = setuptools.dist:check_entry_points | |||||
exclude_package_data = setuptools.dist:check_package_data | |||||
extras_require = setuptools.dist:check_extras | |||||
include_package_data = setuptools.dist:assert_bool | |||||
install_requires = setuptools.dist:check_requirements | |||||
namespace_packages = setuptools.dist:check_nsp | |||||
package_data = setuptools.dist:check_package_data | |||||
packages = setuptools.dist:check_packages | |||||
python_requires = setuptools.dist:check_specifier | |||||
setup_requires = setuptools.dist:check_requirements | |||||
test_loader = setuptools.dist:check_importable | |||||
test_runner = setuptools.dist:check_importable | |||||
test_suite = setuptools.dist:check_test_suite | |||||
tests_require = setuptools.dist:check_requirements | |||||
use_2to3 = setuptools.dist:assert_bool | |||||
use_2to3_exclude_fixers = setuptools.dist:assert_string_list | |||||
use_2to3_fixers = setuptools.dist:assert_string_list | |||||
zip_safe = setuptools.dist:assert_bool | |||||
[egg_info.writers] | |||||
PKG-INFO = setuptools.command.egg_info:write_pkg_info | |||||
dependency_links.txt = setuptools.command.egg_info:overwrite_arg | |||||
depends.txt = setuptools.command.egg_info:warn_depends_obsolete | |||||
eager_resources.txt = setuptools.command.egg_info:overwrite_arg | |||||
entry_points.txt = setuptools.command.egg_info:write_entries | |||||
namespace_packages.txt = setuptools.command.egg_info:overwrite_arg | |||||
requires.txt = setuptools.command.egg_info:write_requirements | |||||
top_level.txt = setuptools.command.egg_info:write_toplevel_names | |||||
[setuptools.installation] | |||||
eggsecutable = setuptools.command.easy_install:bootstrap | |||||
{"classifiers": ["Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: System :: Archiving :: Packaging", "Topic :: System :: Systems Administration", "Topic :: Utilities"], "description_content_type": "text/x-rst; charset=UTF-8", "extensions": {"python.commands": {"wrap_console": {"easy_install": "setuptools.command.easy_install:main", "easy_install-3.6": "setuptools.command.easy_install:main"}}, "python.details": {"contacts": [{"email": "distutils-sig@python.org", "name": "Python Packaging Authority", "role": "author"}], "document_names": {"description": "DESCRIPTION.rst", "license": "LICENSE.txt"}, "project_urls": {"Home": "https://github.com/pypa/setuptools"}}, "python.exports": {"console_scripts": {"easy_install": "setuptools.command.easy_install:main", "easy_install-3.6": "setuptools.command.easy_install:main"}, "distutils.commands": {"alias": "setuptools.command.alias:alias", "bdist_egg": "setuptools.command.bdist_egg:bdist_egg", "bdist_rpm": "setuptools.command.bdist_rpm:bdist_rpm", "bdist_wininst": "setuptools.command.bdist_wininst:bdist_wininst", "build_clib": "setuptools.command.build_clib:build_clib", "build_ext": "setuptools.command.build_ext:build_ext", "build_py": "setuptools.command.build_py:build_py", "develop": "setuptools.command.develop:develop", "dist_info": "setuptools.command.dist_info:dist_info", "easy_install": "setuptools.command.easy_install:easy_install", "egg_info": "setuptools.command.egg_info:egg_info", "install": "setuptools.command.install:install", "install_egg_info": "setuptools.command.install_egg_info:install_egg_info", "install_lib": "setuptools.command.install_lib:install_lib", "install_scripts": "setuptools.command.install_scripts:install_scripts", "register": "setuptools.command.register:register", "rotate": "setuptools.command.rotate:rotate", "saveopts": "setuptools.command.saveopts:saveopts", "sdist": "setuptools.command.sdist:sdist", "setopt": "setuptools.command.setopt:setopt", "test": "setuptools.command.test:test", "upload": "setuptools.command.upload:upload", "upload_docs": "setuptools.command.upload_docs:upload_docs"}, "distutils.setup_keywords": {"convert_2to3_doctests": "setuptools.dist:assert_string_list", "dependency_links": "setuptools.dist:assert_string_list", "eager_resources": "setuptools.dist:assert_string_list", "entry_points": "setuptools.dist:check_entry_points", "exclude_package_data": "setuptools.dist:check_package_data", "extras_require": "setuptools.dist:check_extras", "include_package_data": "setuptools.dist:assert_bool", "install_requires": "setuptools.dist:check_requirements", "namespace_packages": "setuptools.dist:check_nsp", "package_data": "setuptools.dist:check_package_data", "packages": "setuptools.dist:check_packages", "python_requires": "setuptools.dist:check_specifier", "setup_requires": "setuptools.dist:check_requirements", "test_loader": "setuptools.dist:check_importable", "test_runner": "setuptools.dist:check_importable", "test_suite": "setuptools.dist:check_test_suite", "tests_require": "setuptools.dist:check_requirements", "use_2to3": "setuptools.dist:assert_bool", "use_2to3_exclude_fixers": "setuptools.dist:assert_string_list", "use_2to3_fixers": "setuptools.dist:assert_string_list", "zip_safe": "setuptools.dist:assert_bool"}, "egg_info.writers": {"PKG-INFO": "setuptools.command.egg_info:write_pkg_info", "dependency_links.txt": "setuptools.command.egg_info:overwrite_arg", "depends.txt": "setuptools.command.egg_info:warn_depends_obsolete", "eager_resources.txt": "setuptools.command.egg_info:overwrite_arg", "entry_points.txt": "setuptools.command.egg_info:write_entries", "namespace_packages.txt": "setuptools.command.egg_info:overwrite_arg", "requires.txt": "setuptools.command.egg_info:write_requirements", "top_level.txt": "setuptools.command.egg_info:write_toplevel_names"}, "setuptools.installation": {"eggsecutable": "setuptools.command.easy_install:bootstrap"}}}, "extras": ["certs", "ssl"], "generator": "bdist_wheel (0.30.0)", "keywords": ["CPAN", "PyPI", "distutils", "eggs", "package", "management"], "metadata_version": "2.0", "name": "setuptools", "project_url": "Documentation, https://setuptools.readthedocs.io/", "requires_python": ">=2.7,!=3.0.*,!=3.1.*,!=3.2.*", "run_requires": [{"extra": "certs", "requires": ["certifi (==2016.9.26)"]}, {"environment": "sys_platform=='win32'", "extra": "ssl", "requires": ["wincertstore (==0.2)"]}], "summary": "Easily download, build, install, upgrade, and uninstall Python packages", "version": "39.0.1"} |
easy_install | |||||
pkg_resources | |||||
setuptools |
"""Extensions to the 'distutils' for large or complex distributions""" | """Extensions to the 'distutils' for large or complex distributions""" | ||||
import os | import os | ||||
import sys | |||||
import functools | import functools | ||||
import distutils.core | import distutils.core | ||||
import distutils.filelist | import distutils.filelist | ||||
from distutils.util import convert_path | from distutils.util import convert_path | ||||
from fnmatch import fnmatchcase | from fnmatch import fnmatchcase | ||||
from setuptools.extern.six import PY3 | |||||
from setuptools.extern.six.moves import filter, map | from setuptools.extern.six.moves import filter, map | ||||
import setuptools.version | import setuptools.version | ||||
from setuptools.depends import Require | from setuptools.depends import Require | ||||
from . import monkey | from . import monkey | ||||
__metaclass__ = type | |||||
__all__ = [ | __all__ = [ | ||||
'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', | 'setup', 'Distribution', 'Feature', 'Command', 'Extension', 'Require', | ||||
'find_packages', | |||||
'find_packages' | |||||
] | ] | ||||
if PY3: | |||||
__all__.append('find_namespace_packages') | |||||
__version__ = setuptools.version.__version__ | __version__ = setuptools.version.__version__ | ||||
bootstrap_install_from = None | bootstrap_install_from = None | ||||
lib2to3_fixer_packages = ['lib2to3.fixes'] | lib2to3_fixer_packages = ['lib2to3.fixes'] | ||||
class PackageFinder(object): | |||||
class PackageFinder: | |||||
""" | """ | ||||
Generate a list of all Python packages found within a directory | Generate a list of all Python packages found within a directory | ||||
""" | """ | ||||
find_packages = PackageFinder.find | find_packages = PackageFinder.find | ||||
if PY3: | |||||
find_namespace_packages = PEP420PackageFinder.find | |||||
def _install_setup_requires(attrs): | def _install_setup_requires(attrs): | ||||
# Note: do not use `setuptools.Distribution` directly, as | # Note: do not use `setuptools.Distribution` directly, as |
- embedded comments | - embedded comments | ||||
""" | """ | ||||
__version__ = "2.1.10" | |||||
__versionTime__ = "07 Oct 2016 01:31 UTC" | |||||
__version__ = "2.2.0" | |||||
__versionTime__ = "06 Mar 2017 02:06 UTC" | |||||
__author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" | __author__ = "Paul McGuire <ptmcg@users.sourceforge.net>" | ||||
import string | import string | ||||
except UnicodeEncodeError: | except UnicodeEncodeError: | ||||
# Else encode it | # Else encode it | ||||
ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace') | ret = unicode(obj).encode(sys.getdefaultencoding(), 'xmlcharrefreplace') | ||||
xmlcharref = Regex('&#\d+;') | |||||
xmlcharref = Regex(r'&#\d+;') | |||||
xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:]) | xmlcharref.setParseAction(lambda t: '\\u' + hex(int(t[0][2:-1]))[2:]) | ||||
return xmlcharref.transformString(ret) | return xmlcharref.transformString(ret) | ||||
return None | return None | ||||
def getName(self): | def getName(self): | ||||
""" | |||||
r""" | |||||
Returns the results name for this token expression. Useful when several | Returns the results name for this token expression. Useful when several | ||||
different expressions might match at a particular location. | different expressions might match at a particular location. | ||||
def setParseAction( self, *fns, **kwargs ): | def setParseAction( self, *fns, **kwargs ): | ||||
""" | """ | ||||
Define action to perform when successfully matching parse element definition. | |||||
Define one or more actions to perform when successfully matching parse element definition. | |||||
Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, | Parse action fn is a callable method with 0-3 arguments, called as C{fn(s,loc,toks)}, | ||||
C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: | C{fn(loc,toks)}, C{fn(toks)}, or just C{fn()}, where: | ||||
- s = the original string being parsed (see note below) | - s = the original string being parsed (see note below) | ||||
def addParseAction( self, *fns, **kwargs ): | def addParseAction( self, *fns, **kwargs ): | ||||
""" | """ | ||||
Add parse action to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | |||||
Add one or more parse actions to expression's list of parse actions. See L{I{setParseAction}<setParseAction>}. | |||||
See examples in L{I{copy}<copy>}. | See examples in L{I{copy}<copy>}. | ||||
""" | """ | ||||
def clear(self): | def clear(self): | ||||
cache.clear() | cache.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
if _OrderedDict is not None: | if _OrderedDict is not None: | ||||
class _FifoCache(object): | class _FifoCache(object): | ||||
def set(self, key, value): | def set(self, key, value): | ||||
cache[key] = value | cache[key] = value | ||||
if len(cache) > size: | |||||
cache.popitem(False) | |||||
while len(cache) > size: | |||||
try: | |||||
cache.popitem(False) | |||||
except KeyError: | |||||
pass | |||||
def clear(self): | def clear(self): | ||||
cache.clear() | cache.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
else: | else: | ||||
class _FifoCache(object): | class _FifoCache(object): | ||||
def set(self, key, value): | def set(self, key, value): | ||||
cache[key] = value | cache[key] = value | ||||
if len(cache) > size: | |||||
while len(key_fifo) > size: | |||||
cache.pop(key_fifo.popleft(), None) | cache.pop(key_fifo.popleft(), None) | ||||
key_fifo.append(key) | key_fifo.append(key) | ||||
cache.clear() | cache.clear() | ||||
key_fifo.clear() | key_fifo.clear() | ||||
def cache_len(self): | |||||
return len(cache) | |||||
self.get = types.MethodType(get, self) | self.get = types.MethodType(get, self) | ||||
self.set = types.MethodType(set, self) | self.set = types.MethodType(set, self) | ||||
self.clear = types.MethodType(clear, self) | self.clear = types.MethodType(clear, self) | ||||
self.__len__ = types.MethodType(cache_len, self) | |||||
# argument cache for optimizing repeated calls when backtracking through recursive expressions | # argument cache for optimizing repeated calls when backtracking through recursive expressions | ||||
packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail | packrat_cache = {} # this is set later by enabledPackrat(); this is here so that resetCache() doesn't fail | ||||
cap_word = Word(alphas.upper(), alphas.lower()) | cap_word = Word(alphas.upper(), alphas.lower()) | ||||
print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) | print(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity")) | ||||
# the sum() builtin can be used to merge results into a single ParseResults object | |||||
print(sum(cap_word.searchString("More than Iron, more than Lead, more than Gold I need Electricity"))) | |||||
prints:: | prints:: | ||||
['More', 'Iron', 'Lead', 'Gold', 'I'] | |||||
[['More'], ['Iron'], ['Lead'], ['Gold'], ['I'], ['Electricity']] | |||||
['More', 'Iron', 'Lead', 'Gold', 'I', 'Electricity'] | |||||
""" | """ | ||||
try: | try: | ||||
return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ]) | return ParseResults([ t for t,s,e in self.scanString( instring, maxMatches ) ]) | ||||
warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), | warnings.warn("Cannot combine element of type %s with ParserElement" % type(other), | ||||
SyntaxWarning, stacklevel=2) | SyntaxWarning, stacklevel=2) | ||||
return None | return None | ||||
return And( [ self, And._ErrorStop(), other ] ) | |||||
return self + And._ErrorStop() + other | |||||
def __rsub__(self, other ): | def __rsub__(self, other ): | ||||
""" | """ | ||||
class Regex(Token): | class Regex(Token): | ||||
""" | |||||
r""" | |||||
Token for matching strings that match a given regular expression. | Token for matching strings that match a given regular expression. | ||||
Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. | Defined with string specifying the regular expression in a form recognized by the inbuilt Python re module. | ||||
If the given regex contains named groups (defined using C{(?P<name>...)}), these will be preserved as | If the given regex contains named groups (defined using C{(?P<name>...)}), these will be preserved as | ||||
# replace escaped characters | # replace escaped characters | ||||
if self.escChar: | if self.escChar: | ||||
ret = re.sub(self.escCharReplacePattern,"\g<1>",ret) | |||||
ret = re.sub(self.escCharReplacePattern, r"\g<1>", ret) | |||||
# replace escaped quotes | # replace escaped quotes | ||||
if self.escQuote: | if self.escQuote: | ||||
constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. | constants C{opAssoc.RIGHT} and C{opAssoc.LEFT}. | ||||
- parseAction is the parse action to be associated with | - parseAction is the parse action to be associated with | ||||
expressions matching this operator expression (the | expressions matching this operator expression (the | ||||
parse action tuple member may be omitted) | |||||
parse action tuple member may be omitted); if the parse action | |||||
is passed a tuple or list of functions, this is equivalent to | |||||
calling C{setParseAction(*fn)} (L{ParserElement.setParseAction}) | |||||
- lpar - expression for matching left-parentheses (default=C{Suppress('(')}) | - lpar - expression for matching left-parentheses (default=C{Suppress('(')}) | ||||
- rpar - expression for matching right-parentheses (default=C{Suppress(')')}) | - rpar - expression for matching right-parentheses (default=C{Suppress(')')}) | ||||
else: | else: | ||||
raise ValueError("operator must indicate right or left associativity") | raise ValueError("operator must indicate right or left associativity") | ||||
if pa: | if pa: | ||||
matchExpr.setParseAction( pa ) | |||||
if isinstance(pa, (tuple, list)): | |||||
matchExpr.setParseAction(*pa) | |||||
else: | |||||
matchExpr.setParseAction(pa) | |||||
thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) | thisExpr <<= ( matchExpr.setName(termName) | lastExpr ) | ||||
lastExpr = thisExpr | lastExpr = thisExpr | ||||
ret <<= lastExpr | ret <<= lastExpr |
distutils.core.Distribution = orig | distutils.core.Distribution = orig | ||||
def _to_str(s): | |||||
""" | |||||
Convert a filename to a string (on Python 2, explicitly | |||||
a byte string, not Unicode) as distutils checks for the | |||||
exact type str. | |||||
""" | |||||
if sys.version_info[0] == 2 and not isinstance(s, str): | |||||
# Assume it's Unicode, as that's what the PEP says | |||||
# should be provided. | |||||
return s.encode(sys.getfilesystemencoding()) | |||||
return s | |||||
def _run_setup(setup_script='setup.py'): | def _run_setup(setup_script='setup.py'): | ||||
# Note that we can reuse our build directory between calls | # Note that we can reuse our build directory between calls | ||||
# Correctness comes first, then optimization later | # Correctness comes first, then optimization later | ||||
def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None): | def prepare_metadata_for_build_wheel(metadata_directory, config_settings=None): | ||||
sys.argv = sys.argv[:1] + ['dist_info', '--egg-base', metadata_directory] | |||||
sys.argv = sys.argv[:1] + ['dist_info', '--egg-base', _to_str(metadata_directory)] | |||||
_run_setup() | _run_setup() | ||||
dist_info_directory = metadata_directory | dist_info_directory = metadata_directory |
return True # Extension module | return True # Extension module | ||||
pkg = base[len(egg_dir) + 1:].replace(os.sep, '.') | pkg = base[len(egg_dir) + 1:].replace(os.sep, '.') | ||||
module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0] | module = pkg + (pkg and '.' or '') + os.path.splitext(name)[0] | ||||
if sys.version_info < (3, 3): | |||||
if six.PY2: | |||||
skip = 8 # skip magic & date | skip = 8 # skip magic & date | ||||
elif sys.version_info < (3, 7): | elif sys.version_info < (3, 7): | ||||
skip = 12 # skip magic & date & file size | skip = 12 # skip magic & date & file size |
and get_abi3_suffix() | and get_abi3_suffix() | ||||
) | ) | ||||
if use_abi3: | if use_abi3: | ||||
so_ext = _get_config_var_837('EXT_SUFFIX') | |||||
so_ext = get_config_var('EXT_SUFFIX') | |||||
filename = filename[:-len(so_ext)] | filename = filename[:-len(so_ext)] | ||||
filename = filename + get_abi3_suffix() | filename = filename + get_abi3_suffix() | ||||
if isinstance(ext, Library): | if isinstance(ext, Library): | ||||
self.create_static_lib( | self.create_static_lib( | ||||
objects, basename, output_dir, debug, target_lang | objects, basename, output_dir, debug, target_lang | ||||
) | ) | ||||
def _get_config_var_837(name): | |||||
""" | |||||
In https://github.com/pypa/setuptools/pull/837, we discovered | |||||
Python 3.3.0 exposes the extension suffix under the name 'SO'. | |||||
""" | |||||
if sys.version_info < (3, 3, 1): | |||||
name = 'SO' | |||||
return get_config_var(name) |
from setuptools import namespaces | from setuptools import namespaces | ||||
import setuptools | import setuptools | ||||
__metaclass__ = type | |||||
class develop(namespaces.DevelopInstaller, easy_install): | class develop(namespaces.DevelopInstaller, easy_install): | ||||
"""Set up package for development""" | """Set up package for development""" | ||||
return easy_install.install_wrapper_scripts(self, dist) | return easy_install.install_wrapper_scripts(self, dist) | ||||
class VersionlessRequirement(object): | |||||
class VersionlessRequirement: | |||||
""" | """ | ||||
Adapt a pkg_resources.Distribution to simply return the project | Adapt a pkg_resources.Distribution to simply return the project | ||||
name as the 'requirement' so that scripts will work across | name as the 'requirement' so that scripts will work across |
import shlex | import shlex | ||||
import io | import io | ||||
from sysconfig import get_config_vars, get_path | |||||
from setuptools.extern import six | from setuptools.extern import six | ||||
from setuptools.extern.six.moves import configparser, map | from setuptools.extern.six.moves import configparser, map | ||||
from setuptools import Command | from setuptools import Command | ||||
from setuptools.sandbox import run_setup | from setuptools.sandbox import run_setup | ||||
from setuptools.py31compat import get_path, get_config_vars | |||||
from setuptools.py27compat import rmtree_safe | from setuptools.py27compat import rmtree_safe | ||||
from setuptools.command import setopt | from setuptools.command import setopt | ||||
from setuptools.archive_util import unpack_archive | from setuptools.archive_util import unpack_archive | ||||
) | ) | ||||
import pkg_resources.py31compat | import pkg_resources.py31compat | ||||
__metaclass__ = type | |||||
# Turn on PEP440Warnings | # Turn on PEP440Warnings | ||||
warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) | warnings.filterwarnings("default", category=pkg_resources.PEP440Warning) | ||||
if six.PY2: | if six.PY2: | ||||
def _to_ascii(s): | |||||
def _to_bytes(s): | |||||
return s | return s | ||||
def isascii(s): | def isascii(s): | ||||
return False | return False | ||||
else: | else: | ||||
def _to_ascii(s): | |||||
return s.encode('ascii') | |||||
def _to_bytes(s): | |||||
return s.encode('utf8') | |||||
def isascii(s): | def isascii(s): | ||||
try: | try: | ||||
self.all_site_dirs.append(normalize_path(d)) | self.all_site_dirs.append(normalize_path(d)) | ||||
if not self.editable: | if not self.editable: | ||||
self.check_site_dir() | self.check_site_dir() | ||||
self.index_url = self.index_url or "https://pypi.python.org/simple" | |||||
self.index_url = self.index_url or "https://pypi.org/simple/" | |||||
self.shadow_path = self.all_site_dirs[:] | self.shadow_path = self.all_site_dirs[:] | ||||
for path_item in self.install_dir, normalize_path(self.script_dir): | for path_item in self.install_dir, normalize_path(self.script_dir): | ||||
if path_item not in self.shadow_path: | if path_item not in self.shadow_path: | ||||
if is_script: | if is_script: | ||||
body = self._load_template(dev_path) % locals() | body = self._load_template(dev_path) % locals() | ||||
script_text = ScriptWriter.get_header(script_text) + body | script_text = ScriptWriter.get_header(script_text) + body | ||||
self.write_script(script_name, _to_ascii(script_text), 'b') | |||||
self.write_script(script_name, _to_bytes(script_text), 'b') | |||||
@staticmethod | @staticmethod | ||||
def _load_template(dev_path): | def _load_template(dev_path): | ||||
split_args = dict(posix=False) | split_args = dict(posix=False) | ||||
class ScriptWriter(object): | |||||
class ScriptWriter: | |||||
""" | """ | ||||
Encapsulates behavior around writing entry point scripts for console and | Encapsulates behavior around writing entry point scripts for console and | ||||
gui apps. | gui apps. |
return re.compile(pat, flags=re.MULTILINE|re.DOTALL) | return re.compile(pat, flags=re.MULTILINE|re.DOTALL) | ||||
class egg_info(Command): | |||||
class InfoCommon: | |||||
tag_build = None | |||||
tag_date = None | |||||
@property | |||||
def name(self): | |||||
return safe_name(self.distribution.get_name()) | |||||
def tagged_version(self): | |||||
version = self.distribution.get_version() | |||||
# egg_info may be called more than once for a distribution, | |||||
# in which case the version string already contains all tags. | |||||
if self.vtags and version.endswith(self.vtags): | |||||
return safe_version(version) | |||||
return safe_version(version + self.vtags) | |||||
def tags(self): | |||||
version = '' | |||||
if self.tag_build: | |||||
version += self.tag_build | |||||
if self.tag_date: | |||||
version += time.strftime("-%Y%m%d") | |||||
return version | |||||
vtags = property(tags) | |||||
class egg_info(InfoCommon, Command): | |||||
description = "create a distribution's .egg-info directory" | description = "create a distribution's .egg-info directory" | ||||
user_options = [ | user_options = [ | ||||
} | } | ||||
def initialize_options(self): | def initialize_options(self): | ||||
self.egg_name = None | |||||
self.egg_version = None | |||||
self.egg_base = None | self.egg_base = None | ||||
self.egg_name = None | |||||
self.egg_info = None | self.egg_info = None | ||||
self.tag_build = None | |||||
self.tag_date = 0 | |||||
self.egg_version = None | |||||
self.broken_egg_info = False | self.broken_egg_info = False | ||||
self.vtags = None | |||||
#################################### | #################################### | ||||
# allow the 'tag_svn_revision' to be detected and | # allow the 'tag_svn_revision' to be detected and | ||||
edit_config(filename, dict(egg_info=egg_info)) | edit_config(filename, dict(egg_info=egg_info)) | ||||
def finalize_options(self): | def finalize_options(self): | ||||
self.egg_name = safe_name(self.distribution.get_name()) | |||||
self.vtags = self.tags() | |||||
# Note: we need to capture the current value returned | |||||
# by `self.tagged_version()`, so we can later update | |||||
# `self.distribution.metadata.version` without | |||||
# repercussions. | |||||
self.egg_name = self.name | |||||
self.egg_version = self.tagged_version() | self.egg_version = self.tagged_version() | ||||
parsed_version = parse_version(self.egg_version) | parsed_version = parse_version(self.egg_version) | ||||
try: | try: | ||||
if not self.dry_run: | if not self.dry_run: | ||||
os.unlink(filename) | os.unlink(filename) | ||||
def tagged_version(self): | |||||
version = self.distribution.get_version() | |||||
# egg_info may be called more than once for a distribution, | |||||
# in which case the version string already contains all tags. | |||||
if self.vtags and version.endswith(self.vtags): | |||||
return safe_version(version) | |||||
return safe_version(version + self.vtags) | |||||
def run(self): | def run(self): | ||||
self.mkpath(self.egg_info) | self.mkpath(self.egg_info) | ||||
installer = self.distribution.fetch_build_egg | installer = self.distribution.fetch_build_egg | ||||
self.find_sources() | self.find_sources() | ||||
def tags(self): | |||||
version = '' | |||||
if self.tag_build: | |||||
version += self.tag_build | |||||
if self.tag_date: | |||||
version += time.strftime("-%Y%m%d") | |||||
return version | |||||
def find_sources(self): | def find_sources(self): | ||||
"""Generate SOURCES.txt manifest file""" | """Generate SOURCES.txt manifest file""" | ||||
manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") | manifest_filename = os.path.join(self.egg_info, "SOURCES.txt") |
from distutils import log | |||||
import distutils.command.register as orig | import distutils.command.register as orig | ||||
__doc__ = orig.register.__doc__ | __doc__ = orig.register.__doc__ | ||||
def run(self): | def run(self): | ||||
# Make sure that we are using valid current name/version info | |||||
self.run_command('egg_info') | |||||
orig.register.run(self) | |||||
try: | |||||
# Make sure that we are using valid current name/version info | |||||
self.run_command('egg_info') | |||||
orig.register.run(self) | |||||
finally: | |||||
self.announce( | |||||
"WARNING: Registering is deprecated, use twine to " | |||||
"upload instead (https://pypi.org/p/twine/)", | |||||
log.WARN | |||||
) |
add_activation_listener, require, EntryPoint) | add_activation_listener, require, EntryPoint) | ||||
from setuptools import Command | from setuptools import Command | ||||
__metaclass__ = type | |||||
class ScanningLoader(TestLoader): | class ScanningLoader(TestLoader): | ||||
# adapted from jaraco.classes.properties:NonDataProperty | # adapted from jaraco.classes.properties:NonDataProperty | ||||
class NonDataProperty(object): | |||||
class NonDataProperty: | |||||
def __init__(self, fget): | def __init__(self, fget): | ||||
self.fget = fget | self.fget = fget | ||||
import getpass | import getpass | ||||
from distutils import log | |||||
from distutils.command import upload as orig | from distutils.command import upload as orig | ||||
in a variety of different ways. | in a variety of different ways. | ||||
""" | """ | ||||
def run(self): | |||||
try: | |||||
orig.upload.run(self) | |||||
finally: | |||||
self.announce( | |||||
"WARNING: Uploading via this command is deprecated, use twine " | |||||
"to upload instead (https://pypi.org/p/twine/)", | |||||
log.WARN | |||||
) | |||||
def finalize_options(self): | def finalize_options(self): | ||||
orig.upload.finalize_options(self) | orig.upload.finalize_options(self) | ||||
self.username = ( | self.username = ( |
from importlib import import_module | from importlib import import_module | ||||
from distutils.errors import DistutilsOptionError, DistutilsFileError | from distutils.errors import DistutilsOptionError, DistutilsFileError | ||||
from setuptools.extern.six import string_types | |||||
from setuptools.extern.packaging.version import LegacyVersion, parse | |||||
from setuptools.extern.six import string_types, PY3 | |||||
__metaclass__ = type | |||||
def read_configuration( | def read_configuration( | ||||
If False exceptions are propagated as expected. | If False exceptions are propagated as expected. | ||||
:rtype: list | :rtype: list | ||||
""" | """ | ||||
meta = ConfigMetadataHandler( | |||||
distribution.metadata, command_options, ignore_option_errors) | |||||
meta.parse() | |||||
options = ConfigOptionsHandler( | options = ConfigOptionsHandler( | ||||
distribution, command_options, ignore_option_errors) | distribution, command_options, ignore_option_errors) | ||||
options.parse() | options.parse() | ||||
meta = ConfigMetadataHandler( | |||||
distribution.metadata, command_options, ignore_option_errors, distribution.package_dir) | |||||
meta.parse() | |||||
return meta, options | return meta, options | ||||
class ConfigHandler(object): | |||||
class ConfigHandler: | |||||
"""Handles metadata supplied in configuration files.""" | """Handles metadata supplied in configuration files.""" | ||||
section_prefix = None | section_prefix = None | ||||
return f.read() | return f.read() | ||||
@classmethod | @classmethod | ||||
def _parse_attr(cls, value): | |||||
def _parse_attr(cls, value, package_dir=None): | |||||
"""Represents value as a module attribute. | """Represents value as a module attribute. | ||||
Examples: | Examples: | ||||
module_name = '.'.join(attrs_path) | module_name = '.'.join(attrs_path) | ||||
module_name = module_name or '__init__' | module_name = module_name or '__init__' | ||||
sys.path.insert(0, os.getcwd()) | |||||
parent_path = os.getcwd() | |||||
if package_dir: | |||||
if attrs_path[0] in package_dir: | |||||
# A custom path was specified for the module we want to import | |||||
custom_path = package_dir[attrs_path[0]] | |||||
parts = custom_path.rsplit('/', 1) | |||||
if len(parts) > 1: | |||||
parent_path = os.path.join(os.getcwd(), parts[0]) | |||||
module_name = parts[1] | |||||
else: | |||||
module_name = custom_path | |||||
elif '' in package_dir: | |||||
# A custom parent directory was specified for all root modules | |||||
parent_path = os.path.join(os.getcwd(), package_dir['']) | |||||
sys.path.insert(0, parent_path) | |||||
try: | try: | ||||
module = import_module(module_name) | module = import_module(module_name) | ||||
value = getattr(module, attr_name) | value = getattr(module, attr_name) | ||||
""" | """ | ||||
def __init__(self, target_obj, options, ignore_option_errors=False, | |||||
package_dir=None): | |||||
super(ConfigMetadataHandler, self).__init__(target_obj, options, | |||||
ignore_option_errors) | |||||
self.package_dir = package_dir | |||||
@property | @property | ||||
def parsers(self): | def parsers(self): | ||||
"""Metadata item name to parser function mapping.""" | """Metadata item name to parser function mapping.""" | ||||
:rtype: str | :rtype: str | ||||
""" | """ | ||||
version = self._parse_attr(value) | |||||
version = self._parse_file(value) | |||||
if version != value: | |||||
version = version.strip() | |||||
# Be strict about versions loaded from file because it's easy to | |||||
# accidentally include newlines and other unintended content | |||||
if isinstance(parse(version), LegacyVersion): | |||||
raise DistutilsOptionError('Version loaded from %s does not comply with PEP 440: %s' % ( | |||||
value, version | |||||
)) | |||||
return version | |||||
version = self._parse_attr(value, self.package_dir) | |||||
if callable(version): | if callable(version): | ||||
version = version() | version = version() | ||||
:param value: | :param value: | ||||
:rtype: list | :rtype: list | ||||
""" | """ | ||||
find_directive = 'find:' | |||||
find_directives = ['find:', 'find_namespace:'] | |||||
trimmed_value = value.strip() | |||||
if not value.startswith(find_directive): | |||||
if not trimmed_value in find_directives: | |||||
return self._parse_list(value) | return self._parse_list(value) | ||||
findns = trimmed_value == find_directives[1] | |||||
if findns and not PY3: | |||||
raise DistutilsOptionError('find_namespace: directive is unsupported on Python < 3.3') | |||||
# Read function arguments from a dedicated section. | # Read function arguments from a dedicated section. | ||||
find_kwargs = self.parse_section_packages__find( | find_kwargs = self.parse_section_packages__find( | ||||
self.sections.get('packages.find', {})) | self.sections.get('packages.find', {})) | ||||
from setuptools import find_packages | |||||
if findns: | |||||
from setuptools import find_namespace_packages as find_packages | |||||
else: | |||||
from setuptools import find_packages | |||||
return find_packages(**find_kwargs) | return find_packages(**find_kwargs) | ||||
file.write('Provides-Extra: %s\n' % extra) | file.write('Provides-Extra: %s\n' % extra) | ||||
# from Python 3.4 | |||||
def write_pkg_info(self, base_dir): | |||||
"""Write the PKG-INFO file into the release tree. | |||||
""" | |||||
with open(os.path.join(base_dir, 'PKG-INFO'), 'w', | |||||
encoding='UTF-8') as pkg_info: | |||||
self.write_pkg_file(pkg_info) | |||||
sequence = tuple, list | sequence = tuple, list | ||||
distribution for the included and excluded features. | distribution for the included and excluded features. | ||||
""" | """ | ||||
_DISTUTILS_UNSUPPORTED_METADATA = { | |||||
'long_description_content_type': None, | |||||
'project_urls': dict, | |||||
'provides_extras': set, | |||||
} | |||||
_patched_dist = None | _patched_dist = None | ||||
def patch_missing_pkg_info(self, attrs): | def patch_missing_pkg_info(self, attrs): | ||||
self.require_features = [] | self.require_features = [] | ||||
self.features = {} | self.features = {} | ||||
self.dist_files = [] | self.dist_files = [] | ||||
# Filter-out setuptools' specific options. | |||||
self.src_root = attrs.pop("src_root", None) | self.src_root = attrs.pop("src_root", None) | ||||
self.patch_missing_pkg_info(attrs) | self.patch_missing_pkg_info(attrs) | ||||
self.project_urls = attrs.get('project_urls', {}) | |||||
self.dependency_links = attrs.pop('dependency_links', []) | self.dependency_links = attrs.pop('dependency_links', []) | ||||
self.setup_requires = attrs.pop('setup_requires', []) | self.setup_requires = attrs.pop('setup_requires', []) | ||||
for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): | for ep in pkg_resources.iter_entry_points('distutils.setup_keywords'): | ||||
vars(self).setdefault(ep.name, None) | vars(self).setdefault(ep.name, None) | ||||
_Distribution.__init__(self, attrs) | |||||
# The project_urls attribute may not be supported in distutils, so | |||||
# prime it here from our value if not automatically set | |||||
self.metadata.project_urls = getattr( | |||||
self.metadata, 'project_urls', self.project_urls) | |||||
self.metadata.long_description_content_type = attrs.get( | |||||
'long_description_content_type' | |||||
) | |||||
self.metadata.provides_extras = getattr( | |||||
self.metadata, 'provides_extras', set() | |||||
) | |||||
_Distribution.__init__(self, { | |||||
k: v for k, v in attrs.items() | |||||
if k not in self._DISTUTILS_UNSUPPORTED_METADATA | |||||
}) | |||||
# Fill-in missing metadata fields not supported by distutils. | |||||
# Note some fields may have been set by other tools (e.g. pbr) | |||||
# above; they are taken preferrentially to setup() arguments | |||||
for option, default in self._DISTUTILS_UNSUPPORTED_METADATA.items(): | |||||
for source in self.metadata.__dict__, attrs: | |||||
if option in source: | |||||
value = source[option] | |||||
break | |||||
else: | |||||
value = default() if default else None | |||||
setattr(self.metadata, option, value) | |||||
if isinstance(self.metadata.version, numbers.Number): | if isinstance(self.metadata.version, numbers.Number): | ||||
# Some people apparently take "version number" too literally :) | # Some people apparently take "version number" too literally :) |
# on later Python versions to cause relative imports | # on later Python versions to cause relative imports | ||||
# in the vendor package to resolve the same modules | # in the vendor package to resolve the same modules | ||||
# as those going through this importer. | # as those going through this importer. | ||||
if sys.version_info > (3, 3): | |||||
if sys.version_info >= (3, ): | |||||
del sys.modules[extant] | del sys.modules[extant] | ||||
return mod | return mod | ||||
except ImportError: | except ImportError: |
needs_warehouse = ( | needs_warehouse = ( | ||||
sys.version_info < (2, 7, 13) | sys.version_info < (2, 7, 13) | ||||
or | or | ||||
(3, 0) < sys.version_info < (3, 3, 7) | |||||
or | |||||
(3, 4) < sys.version_info < (3, 4, 6) | (3, 4) < sys.version_info < (3, 4, 6) | ||||
or | or | ||||
(3, 5) < sys.version_info <= (3, 5, 3) | (3, 5) < sys.version_info <= (3, 5, 3) | ||||
distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse | distutils.config.PyPIRCCommand.DEFAULT_REPOSITORY = warehouse | ||||
_patch_distribution_metadata_write_pkg_file() | _patch_distribution_metadata_write_pkg_file() | ||||
_patch_distribution_metadata_write_pkg_info() | |||||
# Install Distribution throughout the distutils | # Install Distribution throughout the distutils | ||||
for module in distutils.dist, distutils.core, distutils.cmd: | for module in distutils.dist, distutils.core, distutils.cmd: | ||||
) | ) | ||||
def _patch_distribution_metadata_write_pkg_info(): | |||||
""" | |||||
Workaround issue #197 - Python 3 prior to 3.2.2 uses an environment-local | |||||
encoding to save the pkg_info. Monkey-patch its write_pkg_info method to | |||||
correct this undesirable behavior. | |||||
""" | |||||
environment_local = (3,) <= sys.version_info[:3] < (3, 2, 2) | |||||
if not environment_local: | |||||
return | |||||
distutils.dist.DistributionMetadata.write_pkg_info = ( | |||||
setuptools.dist.write_pkg_info | |||||
) | |||||
def patch_func(replacement, target_mod, func_name): | def patch_func(replacement, target_mod, func_name): | ||||
""" | """ | ||||
Patch func_name in target_mod with replacement | Patch func_name in target_mod with replacement |
elif version >= 14.0: | elif version >= 14.0: | ||||
# For VC++ 14.0 Redirect user to Visual C++ Build Tools | # For VC++ 14.0 Redirect user to Visual C++ Build Tools | ||||
message += (' Get it with "Microsoft Visual C++ Build Tools": ' | message += (' Get it with "Microsoft Visual C++ Build Tools": ' | ||||
r'http://landinghub.visualstudio.com/' | |||||
'visual-cpp-build-tools') | |||||
r'https://visualstudio.microsoft.com/downloads/') | |||||
exc.args = (message, ) | exc.args = (message, ) | ||||
from setuptools.py33compat import unescape | from setuptools.py33compat import unescape | ||||
from setuptools.wheel import Wheel | from setuptools.wheel import Wheel | ||||
__metaclass__ = type | |||||
EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') | EGG_FRAGMENT = re.compile(r'^egg=([-A-Za-z0-9_.+!]+)$') | ||||
HREF = re.compile("""href\\s*=\\s*['"]?([^'"> ]+)""", re.I) | |||||
# this is here to fix emacs' cruddy broken syntax highlighting | |||||
HREF = re.compile(r"""href\s*=\s*['"]?([^'"> ]+)""", re.I) | |||||
PYPI_MD5 = re.compile( | PYPI_MD5 = re.compile( | ||||
'<a href="([^"#]+)">([^<]+)</a>\n\\s+\\(<a (?:title="MD5 hash"\n\\s+)' | |||||
'href="[^?]+\\?:action=show_md5&digest=([0-9a-f]{32})">md5</a>\\)' | |||||
r'<a href="([^"#]+)">([^<]+)</a>\n\s+\(<a (?:title="MD5 hash"\n\s+)' | |||||
r'href="[^?]+\?:action=show_md5&digest=([0-9a-f]{32})">md5</a>\)' | |||||
) | ) | ||||
URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):', re.I).match | URL_SCHEME = re.compile('([-+.a-z0-9]{2,}):', re.I).match | ||||
EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() | EXTENSIONS = ".tar.gz .tar.bz2 .tar .zip .tgz".split() | ||||
yield urllib.parse.urljoin(url, htmldecode(match.group(1))) | yield urllib.parse.urljoin(url, htmldecode(match.group(1))) | ||||
class ContentChecker(object): | |||||
class ContentChecker: | |||||
""" | """ | ||||
A null content checker that defines the interface for checking content | A null content checker that defines the interface for checking content | ||||
""" | """ | ||||
"""A distribution index that scans web pages for download URLs""" | """A distribution index that scans web pages for download URLs""" | ||||
def __init__( | def __init__( | ||||
self, index_url="https://pypi.python.org/simple", hosts=('*',), | |||||
self, index_url="https://pypi.org/simple/", hosts=('*',), | |||||
ca_bundle=None, verify_ssl=True, *args, **kw | ca_bundle=None, verify_ssl=True, *args, **kw | ||||
): | ): | ||||
Environment.__init__(self, *args, **kw) | Environment.__init__(self, *args, **kw) | ||||
def decode_entity(match): | def decode_entity(match): | ||||
what = match.group(1) | |||||
what = match.group(0) | |||||
return unescape(what) | return unescape(what) | ||||
def htmldecode(text): | def htmldecode(text): | ||||
"""Decode HTML entities in the given text.""" | |||||
""" | |||||
Decode HTML entities in the given text. | |||||
>>> htmldecode( | |||||
... 'https://../package_name-0.1.2.tar.gz' | |||||
... '?tokena=A&tokenb=B">package_name-0.1.2.tar.gz') | |||||
'https://../package_name-0.1.2.tar.gz?tokena=A&tokenb=B">package_name-0.1.2.tar.gz' | |||||
""" | |||||
return entity_sub(decode_entity, text) | return entity_sub(decode_entity, text) | ||||
return encoded.replace('\n', '') | return encoded.replace('\n', '') | ||||
class Credential(object): | |||||
class Credential: | |||||
""" | """ | ||||
A username/password pair. Use like a namedtuple. | A username/password pair. Use like a namedtuple. | ||||
""" | """ |
from __future__ import absolute_import | from __future__ import absolute_import | ||||
import distutils.util | import distutils.util | ||||
from distutils import log | |||||
import platform | import platform | ||||
import re | import re | ||||
import sys | import sys | ||||
import warnings | import warnings | ||||
from collections import OrderedDict | from collections import OrderedDict | ||||
from .extern import six | |||||
from . import glibc | from . import glibc | ||||
_osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)') | _osx_arch_pat = re.compile(r'(.+)_(\d+)_(\d+)_(.+)') | ||||
val = get_config_var(var) | val = get_config_var(var) | ||||
if val is None: | if val is None: | ||||
if warn: | if warn: | ||||
warnings.warn("Config variable '{0}' is unset, Python ABI tag may " | |||||
"be incorrect".format(var), RuntimeWarning, 2) | |||||
log.debug("Config variable '%s' is unset, Python ABI tag may " | |||||
"be incorrect", var) | |||||
return fallback() | return fallback() | ||||
return val == expected | return val == expected | ||||
lambda: sys.maxunicode == 0x10ffff, | lambda: sys.maxunicode == 0x10ffff, | ||||
expected=4, | expected=4, | ||||
warn=(impl == 'cp' and | warn=(impl == 'cp' and | ||||
sys.version_info < (3, 3))) \ | |||||
and sys.version_info < (3, 3): | |||||
six.PY2)) \ | |||||
and six.PY2: | |||||
u = 'u' | u = 'u' | ||||
abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u) | abi = '%s%s%s%s%s' % (impl, get_impl_ver(), d, m, u) | ||||
elif soabi and soabi.startswith('cpython-'): | elif soabi and soabi.startswith('cpython-'): |
__all__ = ['get_config_vars', 'get_path'] | |||||
__all__ = [] | |||||
try: | |||||
# Python 2.7 or >=3.2 | |||||
from sysconfig import get_config_vars, get_path | |||||
except ImportError: | |||||
from distutils.sysconfig import get_config_vars, get_python_lib | |||||
def get_path(name): | |||||
if name not in ('platlib', 'purelib'): | |||||
raise ValueError("Name must be purelib or platlib") | |||||
return get_python_lib(name == 'platlib') | |||||
__metaclass__ = type | |||||
try: | try: | ||||
import shutil | import shutil | ||||
import tempfile | import tempfile | ||||
class TemporaryDirectory(object): | |||||
class TemporaryDirectory: | |||||
""" | """ | ||||
Very simple temporary directory context manager. | Very simple temporary directory context manager. | ||||
Will try to delete afterward, but will also ignore OS and similar | Will try to delete afterward, but will also ignore OS and similar |
from setuptools.extern import six | from setuptools.extern import six | ||||
from setuptools.extern.six.moves import html_parser | from setuptools.extern.six.moves import html_parser | ||||
__metaclass__ = type | |||||
OpArg = collections.namedtuple('OpArg', 'opcode arg') | OpArg = collections.namedtuple('OpArg', 'opcode arg') | ||||
class Bytecode_compat(object): | |||||
class Bytecode_compat: | |||||
def __init__(self, code): | def __init__(self, code): | ||||
self.code = code | self.code = code | ||||
__requires__ = %(spec)r | __requires__ = %(spec)r | ||||
__import__('pkg_resources').require(%(spec)r) | __import__('pkg_resources').require(%(spec)r) | ||||
__file__ = %(dev_path)r | __file__ = %(dev_path)r | ||||
exec(compile(open(__file__).read(), __file__, 'exec')) | |||||
with open(__file__) as f: | |||||
exec(compile(f.read(), __file__, 'exec')) |
break | break | ||||
else: | else: | ||||
try: | try: | ||||
import imp # Avoid import loop in Python >= 3.3 | |||||
import imp # Avoid import loop in Python 3 | |||||
stream, path, descr = imp.find_module('site', [item]) | stream, path, descr = imp.find_module('site', [item]) | ||||
except ImportError: | except ImportError: | ||||
continue | continue |
'''Wheels support.''' | |||||
"""Wheels support.""" | |||||
from distutils.util import get_platform | from distutils.util import get_platform | ||||
import email | import email | ||||
import itertools | import itertools | ||||
import os | import os | ||||
import posixpath | |||||
import re | import re | ||||
import zipfile | import zipfile | ||||
from pkg_resources import Distribution, PathMetadata, parse_version | from pkg_resources import Distribution, PathMetadata, parse_version | ||||
from setuptools.extern.packaging.utils import canonicalize_name | |||||
from setuptools.extern.six import PY3 | from setuptools.extern.six import PY3 | ||||
from setuptools import Distribution as SetuptoolsDistribution | from setuptools import Distribution as SetuptoolsDistribution | ||||
from setuptools import pep425tags | from setuptools import pep425tags | ||||
from setuptools.command.egg_info import write_requirements | from setuptools.command.egg_info import write_requirements | ||||
__metaclass__ = type | |||||
WHEEL_NAME = re.compile( | WHEEL_NAME = re.compile( | ||||
r"""^(?P<project_name>.+?)-(?P<version>\d.*?) | r"""^(?P<project_name>.+?)-(?P<version>\d.*?) | ||||
((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?) | ((-(?P<build>\d.*?))?-(?P<py_version>.+?)-(?P<abi>.+?)-(?P<platform>.+?) | ||||
)\.whl$""", | )\.whl$""", | ||||
re.VERBOSE).match | |||||
re.VERBOSE).match | |||||
NAMESPACE_PACKAGE_INIT = '''\ | NAMESPACE_PACKAGE_INIT = '''\ | ||||
try: | try: | ||||
os.rmdir(dirpath) | os.rmdir(dirpath) | ||||
class Wheel(object): | |||||
class Wheel: | |||||
def __init__(self, filename): | def __init__(self, filename): | ||||
match = WHEEL_NAME(os.path.basename(filename)) | match = WHEEL_NAME(os.path.basename(filename)) | ||||
def tags(self): | def tags(self): | ||||
'''List tags (py_version, abi, platform) supported by this wheel.''' | '''List tags (py_version, abi, platform) supported by this wheel.''' | ||||
return itertools.product(self.py_version.split('.'), | |||||
self.abi.split('.'), | |||||
self.platform.split('.')) | |||||
return itertools.product( | |||||
self.py_version.split('.'), | |||||
self.abi.split('.'), | |||||
self.platform.split('.'), | |||||
) | |||||
def is_compatible(self): | def is_compatible(self): | ||||
'''Is the wheel is compatible with the current platform?''' | '''Is the wheel is compatible with the current platform?''' | ||||
platform=(None if self.platform == 'any' else get_platform()), | platform=(None if self.platform == 'any' else get_platform()), | ||||
).egg_name() + '.egg' | ).egg_name() + '.egg' | ||||
def get_dist_info(self, zf): | |||||
# find the correct name of the .dist-info dir in the wheel file | |||||
for member in zf.namelist(): | |||||
dirname = posixpath.dirname(member) | |||||
if (dirname.endswith('.dist-info') and | |||||
canonicalize_name(dirname).startswith( | |||||
canonicalize_name(self.project_name))): | |||||
return dirname | |||||
raise ValueError("unsupported wheel format. .dist-info not found") | |||||
def install_as_egg(self, destination_eggdir): | def install_as_egg(self, destination_eggdir): | ||||
'''Install wheel as an egg directory.''' | '''Install wheel as an egg directory.''' | ||||
with zipfile.ZipFile(self.filename) as zf: | with zipfile.ZipFile(self.filename) as zf: | ||||
dist_basename = '%s-%s' % (self.project_name, self.version) | |||||
dist_info = '%s.dist-info' % dist_basename | |||||
dist_data = '%s.data' % dist_basename | |||||
def get_metadata(name): | |||||
with zf.open('%s/%s' % (dist_info, name)) as fp: | |||||
value = fp.read().decode('utf-8') if PY3 else fp.read() | |||||
return email.parser.Parser().parsestr(value) | |||||
wheel_metadata = get_metadata('WHEEL') | |||||
dist_metadata = get_metadata('METADATA') | |||||
# Check wheel format version is supported. | |||||
wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) | |||||
if not parse_version('1.0') <= wheel_version < parse_version('2.0dev0'): | |||||
raise ValueError('unsupported wheel format version: %s' % wheel_version) | |||||
# Extract to target directory. | |||||
os.mkdir(destination_eggdir) | |||||
zf.extractall(destination_eggdir) | |||||
# Convert metadata. | |||||
dist_info = os.path.join(destination_eggdir, dist_info) | |||||
dist = Distribution.from_location( | |||||
destination_eggdir, dist_info, | |||||
metadata=PathMetadata(destination_eggdir, dist_info) | |||||
self._install_as_egg(destination_eggdir, zf) | |||||
def _install_as_egg(self, destination_eggdir, zf): | |||||
dist_basename = '%s-%s' % (self.project_name, self.version) | |||||
dist_info = self.get_dist_info(zf) | |||||
dist_data = '%s.data' % dist_basename | |||||
egg_info = os.path.join(destination_eggdir, 'EGG-INFO') | |||||
self._convert_metadata(zf, destination_eggdir, dist_info, egg_info) | |||||
self._move_data_entries(destination_eggdir, dist_data) | |||||
self._fix_namespace_packages(egg_info, destination_eggdir) | |||||
@staticmethod | |||||
def _convert_metadata(zf, destination_eggdir, dist_info, egg_info): | |||||
def get_metadata(name): | |||||
with zf.open(posixpath.join(dist_info, name)) as fp: | |||||
value = fp.read().decode('utf-8') if PY3 else fp.read() | |||||
return email.parser.Parser().parsestr(value) | |||||
wheel_metadata = get_metadata('WHEEL') | |||||
# Check wheel format version is supported. | |||||
wheel_version = parse_version(wheel_metadata.get('Wheel-Version')) | |||||
wheel_v1 = ( | |||||
parse_version('1.0') <= wheel_version < parse_version('2.0dev0') | |||||
) | |||||
if not wheel_v1: | |||||
raise ValueError( | |||||
'unsupported wheel format version: %s' % wheel_version) | |||||
# Extract to target directory. | |||||
os.mkdir(destination_eggdir) | |||||
zf.extractall(destination_eggdir) | |||||
# Convert metadata. | |||||
dist_info = os.path.join(destination_eggdir, dist_info) | |||||
dist = Distribution.from_location( | |||||
destination_eggdir, dist_info, | |||||
metadata=PathMetadata(destination_eggdir, dist_info), | |||||
) | |||||
# Note: Evaluate and strip markers now, | |||||
# as it's difficult to convert back from the syntax: | |||||
# foobar; "linux" in sys_platform and extra == 'test' | |||||
def raw_req(req): | |||||
req.marker = None | |||||
return str(req) | |||||
install_requires = list(sorted(map(raw_req, dist.requires()))) | |||||
extras_require = { | |||||
extra: sorted( | |||||
req | |||||
for req in map(raw_req, dist.requires((extra,))) | |||||
if req not in install_requires | |||||
) | ) | ||||
# Note: we need to evaluate and strip markers now, | |||||
# as we can't easily convert back from the syntax: | |||||
# foobar; "linux" in sys_platform and extra == 'test' | |||||
def raw_req(req): | |||||
req.marker = None | |||||
return str(req) | |||||
install_requires = list(sorted(map(raw_req, dist.requires()))) | |||||
extras_require = { | |||||
extra: list(sorted( | |||||
req | |||||
for req in map(raw_req, dist.requires((extra,))) | |||||
if req not in install_requires | |||||
)) | |||||
for extra in dist.extras | |||||
} | |||||
egg_info = os.path.join(destination_eggdir, 'EGG-INFO') | |||||
os.rename(dist_info, egg_info) | |||||
os.rename(os.path.join(egg_info, 'METADATA'), | |||||
os.path.join(egg_info, 'PKG-INFO')) | |||||
setup_dist = SetuptoolsDistribution(attrs=dict( | |||||
for extra in dist.extras | |||||
} | |||||
os.rename(dist_info, egg_info) | |||||
os.rename( | |||||
os.path.join(egg_info, 'METADATA'), | |||||
os.path.join(egg_info, 'PKG-INFO'), | |||||
) | |||||
setup_dist = SetuptoolsDistribution( | |||||
attrs=dict( | |||||
install_requires=install_requires, | install_requires=install_requires, | ||||
extras_require=extras_require, | extras_require=extras_require, | ||||
)) | |||||
write_requirements(setup_dist.get_command_obj('egg_info'), | |||||
None, os.path.join(egg_info, 'requires.txt')) | |||||
# Move data entries to their correct location. | |||||
dist_data = os.path.join(destination_eggdir, dist_data) | |||||
dist_data_scripts = os.path.join(dist_data, 'scripts') | |||||
if os.path.exists(dist_data_scripts): | |||||
egg_info_scripts = os.path.join(destination_eggdir, | |||||
'EGG-INFO', 'scripts') | |||||
os.mkdir(egg_info_scripts) | |||||
for entry in os.listdir(dist_data_scripts): | |||||
# Remove bytecode, as it's not properly handled | |||||
# during easy_install scripts install phase. | |||||
if entry.endswith('.pyc'): | |||||
os.unlink(os.path.join(dist_data_scripts, entry)) | |||||
else: | |||||
os.rename(os.path.join(dist_data_scripts, entry), | |||||
os.path.join(egg_info_scripts, entry)) | |||||
os.rmdir(dist_data_scripts) | |||||
for subdir in filter(os.path.exists, ( | |||||
os.path.join(dist_data, d) | |||||
for d in ('data', 'headers', 'purelib', 'platlib') | |||||
)): | |||||
unpack(subdir, destination_eggdir) | |||||
if os.path.exists(dist_data): | |||||
os.rmdir(dist_data) | |||||
# Fix namespace packages. | |||||
namespace_packages = os.path.join(egg_info, 'namespace_packages.txt') | |||||
if os.path.exists(namespace_packages): | |||||
with open(namespace_packages) as fp: | |||||
namespace_packages = fp.read().split() | |||||
for mod in namespace_packages: | |||||
mod_dir = os.path.join(destination_eggdir, *mod.split('.')) | |||||
mod_init = os.path.join(mod_dir, '__init__.py') | |||||
if os.path.exists(mod_dir) and not os.path.exists(mod_init): | |||||
with open(mod_init, 'w') as fp: | |||||
fp.write(NAMESPACE_PACKAGE_INIT) | |||||
), | |||||
) | |||||
write_requirements( | |||||
setup_dist.get_command_obj('egg_info'), | |||||
None, | |||||
os.path.join(egg_info, 'requires.txt'), | |||||
) | |||||
@staticmethod | |||||
def _move_data_entries(destination_eggdir, dist_data): | |||||
"""Move data entries to their correct location.""" | |||||
dist_data = os.path.join(destination_eggdir, dist_data) | |||||
dist_data_scripts = os.path.join(dist_data, 'scripts') | |||||
if os.path.exists(dist_data_scripts): | |||||
egg_info_scripts = os.path.join( | |||||
destination_eggdir, 'EGG-INFO', 'scripts') | |||||
os.mkdir(egg_info_scripts) | |||||
for entry in os.listdir(dist_data_scripts): | |||||
# Remove bytecode, as it's not properly handled | |||||
# during easy_install scripts install phase. | |||||
if entry.endswith('.pyc'): | |||||
os.unlink(os.path.join(dist_data_scripts, entry)) | |||||
else: | |||||
os.rename( | |||||
os.path.join(dist_data_scripts, entry), | |||||
os.path.join(egg_info_scripts, entry), | |||||
) | |||||
os.rmdir(dist_data_scripts) | |||||
for subdir in filter(os.path.exists, ( | |||||
os.path.join(dist_data, d) | |||||
for d in ('data', 'headers', 'purelib', 'platlib') | |||||
)): | |||||
unpack(subdir, destination_eggdir) | |||||
if os.path.exists(dist_data): | |||||
os.rmdir(dist_data) | |||||
@staticmethod | |||||
def _fix_namespace_packages(egg_info, destination_eggdir): | |||||
namespace_packages = os.path.join( | |||||
egg_info, 'namespace_packages.txt') | |||||
if os.path.exists(namespace_packages): | |||||
with open(namespace_packages) as fp: | |||||
namespace_packages = fp.read().split() | |||||
for mod in namespace_packages: | |||||
mod_dir = os.path.join(destination_eggdir, *mod.split('.')) | |||||
mod_init = os.path.join(mod_dir, '__init__.py') | |||||
if os.path.exists(mod_dir) and not os.path.exists(mod_init): | |||||
with open(mod_init, 'w') as fp: | |||||
fp.write(NAMESPACE_PACKAGE_INIT) |