run update.sh, install netifaces

This commit is contained in:
j 2016-03-23 12:41:42 +01:00
commit 19a695b4d6
83 changed files with 6434 additions and 593 deletions

View file

@ -41,11 +41,12 @@ commands_order = [
SearchCommand,
WheelCommand,
HashCommand,
CompletionCommand,
HelpCommand,
]
def get_summaries(ignore_hidden=True, ordered=True):
def get_summaries(ordered=True):
"""Yields sorted (command name, command summary) tuples."""
if ordered:
@ -54,9 +55,6 @@ def get_summaries(ignore_hidden=True, ordered=True):
cmditems = commands_dict.items()
for name, command_class in cmditems:
if ignore_hidden and command_class.hidden:
continue
yield (name, command_class.summary)

View file

@ -32,8 +32,7 @@ compctl -K _pip_completion pip
class CompletionCommand(Command):
"""A helper command to be used for command completion."""
name = 'completion'
summary = 'A helper command to be used for command completion'
hidden = True
summary = 'A helper command used for command completion'
def __init__(self, *args, **kw):
super(CompletionCommand, self).__init__(*args, **kw)

View file

@ -3,11 +3,15 @@ from __future__ import absolute_import
import sys
import pip
from pip.compat import stdlib_pkgs
from pip.basecommand import Command
from pip.operations.freeze import freeze
from pip.wheel import WheelCache
DEV_PKGS = ('pip', 'setuptools', 'distribute', 'wheel')
class FreezeCommand(Command):
"""
Output installed packages in requirements format.
@ -52,12 +56,22 @@ class FreezeCommand(Command):
action='store_true',
default=False,
help='Only output packages installed in user-site.')
self.cmd_opts.add_option(
'--all',
dest='freeze_all',
action='store_true',
help='Do not skip these packages in the output:'
' %s' % ', '.join(DEV_PKGS))
self.parser.insert_option_group(0, self.cmd_opts)
def run(self, options, args):
format_control = pip.index.FormatControl(set(), set())
wheel_cache = WheelCache(options.cache_dir, format_control)
skip = set(stdlib_pkgs)
if not options.freeze_all:
skip.update(DEV_PKGS)
freeze_kwargs = dict(
requirement=options.requirement,
find_links=options.find_links,
@ -65,7 +79,8 @@ class FreezeCommand(Command):
user_only=options.user,
skip_regex=options.skip_requirements_regex,
isolated=options.isolated_mode,
wheel_cache=wheel_cache)
wheel_cache=wheel_cache,
skip=skip)
for line in freeze(**freeze_kwargs):
sys.stdout.write(line + '\n')

View file

@ -24,6 +24,7 @@ from pip.utils.deprecation import RemovedInPip10Warning
from pip.utils.filesystem import check_path_owner
from pip.wheel import WheelCache, WheelBuilder
from pip.locations import running_under_virtualenv
logger = logging.getLogger(__name__)
@ -54,6 +55,12 @@ class InstallCommand(RequirementCommand):
def __init__(self, *args, **kw):
super(InstallCommand, self).__init__(*args, **kw)
default_user = True
if running_under_virtualenv():
default_user = False
if os.geteuid() == 0:
default_user = False
cmd_opts = self.cmd_opts
cmd_opts.add_option(cmdoptions.constraints())
@ -103,6 +110,7 @@ class InstallCommand(RequirementCommand):
'-I', '--ignore-installed',
dest='ignore_installed',
action='store_true',
default=default_user,
help='Ignore the installed packages (reinstalling instead).')
cmd_opts.add_option(cmdoptions.no_deps())
@ -114,10 +122,20 @@ class InstallCommand(RequirementCommand):
'--user',
dest='use_user_site',
action='store_true',
default=default_user,
help="Install to the Python user install directory for your "
"platform. Typically ~/.local/, or %APPDATA%\Python on "
"Windows. (See the Python documentation for site.USER_BASE "
"for full details.)")
"for full details.) On Debian systems, this is the "
"default when running outside of a virtual environment "
"and not as root.")
cmd_opts.add_option(
'--system',
dest='use_user_site',
action='store_false',
help="Install using the system scheme (overrides --user on "
"Debian systems)")
cmd_opts.add_option(
'--egg',

View file

@ -105,11 +105,16 @@ def print_results(hits, name_column_width=None, terminal_width=None):
if not hits:
return
if name_column_width is None:
name_column_width = max((len(hit['name']) for hit in hits)) + 4
name_column_width = max([
len(hit['name']) + len(hit.get('versions', ['-'])[-1])
for hit in hits
]) + 4
installed_packages = [p.project_name for p in pkg_resources.working_set]
for hit in hits:
name = hit['name']
summary = hit['summary'] or ''
version = hit.get('versions', ['-'])[-1]
if terminal_width is not None:
# wrap and indent summary to fit terminal
summary = textwrap.wrap(
@ -117,7 +122,9 @@ def print_results(hits, name_column_width=None, terminal_width=None):
terminal_width - name_column_width - 5,
)
summary = ('\n' + ' ' * (name_column_width + 3)).join(summary)
line = '%s - %s' % (name.ljust(name_column_width), summary)
line = '%-*s - %s' % (name_column_width,
'%s (%s)' % (name, version), summary)
try:
logger.info(line)
if name in installed_packages:

View file

@ -85,6 +85,14 @@ def search_packages_info(query):
entry_points = dist.get_metadata_lines('entry_points.txt')
package['entry_points'] = entry_points
installer = None
if dist.has_metadata('INSTALLER'):
for line in dist.get_metadata_lines('INSTALLER'):
if line.strip():
installer = line.strip()
break
package['installer'] = installer
# @todo: Should pkg_resources.Distribution have a
# `get_pkg_info` method?
feed_parser = FeedParser()
@ -94,6 +102,16 @@ def search_packages_info(query):
'home-page', 'author', 'author-email', 'license'):
package[key] = pkg_info_dict.get(key)
# It looks like FeedParser can not deal with repeated headers
classifiers = []
for line in metadata.splitlines():
if not line:
break
# Classifier: License :: OSI Approved :: MIT License
if line.startswith('Classifier: '):
classifiers.append(line[len('Classifier: '):])
package['classifiers'] = classifiers
if file_list:
package['files'] = sorted(file_list)
yield package
@ -114,9 +132,14 @@ def print_results(distributions, list_all_files):
logger.info("Home-page: %s", dist.get('home-page'))
logger.info("Author: %s", dist.get('author'))
logger.info("Author-email: %s", dist.get('author-email'))
if dist['installer'] is not None:
logger.info("Installer: %s", dist['installer'])
logger.info("License: %s", dist.get('license'))
logger.info("Location: %s", dist['location'])
logger.info("Requires: %s", ', '.join(dist['requires']))
logger.info("Classifiers:")
for classifier in dist['classifiers']:
logger.info(" %s", classifier)
if list_all_files:
logger.info("Files:")
if 'files' in dist: