merge with develop

This commit is contained in:
Marcus Smith 2013-02-15 17:11:17 -08:00
commit d0c3138fbf
13 changed files with 59 additions and 23 deletions

View File

@ -9,6 +9,8 @@ python:
before_install: before_install:
- sudo apt-get install subversion bzr mercurial - sudo apt-get install subversion bzr mercurial
- echo -e "[web]\ncacerts = /etc/ssl/certs/ca-certificates.crt" >> ~/.hgrc - echo -e "[web]\ncacerts = /etc/ssl/certs/ca-certificates.crt" >> ~/.hgrc
- git config --global user.email "python-virtualenv@googlegroups.com"
- git config --global user.name "Pip"
install: pip install nose virtualenv scripttest mock install: pip install nose virtualenv scripttest mock
script: nosetests script: nosetests
notifications: notifications:

View File

@ -18,6 +18,7 @@ David (d1b)
Dmitry Gladkov Dmitry Gladkov
Donald Stufft Donald Stufft
Francesco Francesco
Geoffrey Lehée
Georgi Valkov Georgi Valkov
Hugo Lopes Tavares Hugo Lopes Tavares
Ian Bicking Ian Bicking
@ -29,6 +30,7 @@ Jannis Leidel
Jay Graves Jay Graves
John-Scott Atlakson John-Scott Atlakson
Jon Parise Jon Parise
Jonas Nockert
Josh Bronson Josh Bronson
Kamal Bin Mustafa Kamal Bin Mustafa
Kelsey Hightower Kelsey Hightower

View File

@ -15,6 +15,8 @@ platforms.
* On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf` * On Unix and Mac OS X the configuration file is: :file:`$HOME/.pip/pip.conf`
* On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.ini` * On Windows, the configuration file is: :file:`%HOME%\\pip\\pip.ini`
You can set a custom path location for the config file using the environment variable ``PIP_CONFIG_FILE``.
The names of the settings are derived from the long command line option, e.g. The names of the settings are derived from the long command line option, e.g.
if you want to use a different package index (``--index-url``) and set the if you want to use a different package index (``--index-url``) and set the
HTTP timeout (``--default-timeout``) to 60 seconds your config file would HTTP timeout (``--default-timeout``) to 60 seconds your config file would

View File

@ -125,7 +125,7 @@ Ensuring Repeatability
Three things are required to fully guarantee a repeatable installation using requirements files. Three things are required to fully guarantee a repeatable installation using requirements files.
1. The requirements file was generated by ``pip freeze`` or you're sure it only contains requirements that specifiy a specific version. 1. The requirements file was generated by ``pip freeze`` or you're sure it only contains requirements that specify a specific version.
2. The installation is performed using :ref:`--no-deps <install_--no-deps>`. This guarantees that only what is explicitly listed in the requirements file is installed. 2. The installation is performed using :ref:`--no-deps <install_--no-deps>`. This guarantees that only what is explicitly listed in the requirements file is installed.
3. The installation is performed against a index or find-links location that is guaranteed to *not* allow achives to be changed and updated without a version increase. 3. The installation is performed against an index or find-links location that is guaranteed to *not* allow archives to be changed and updated without a version increase.

View File

@ -7,7 +7,7 @@ Pull Requests
Submit Pull Requests against the `develop` branch. Submit Pull Requests against the `develop` branch.
Provide a good description of what your doing and why. Provide a good description of what you're doing and why.
Provide tests that cover your changes and try to run the tests locally first. Provide tests that cover your changes and try to run the tests locally first.

View File

@ -68,7 +68,7 @@ pip requires a working VCS command on your path: git, hg, svn, or bzr.
VCS projects can be installed in :ref:`editable mode <editable-installs>` (using the :ref:`--editable <install_--editable>` option) or not. VCS projects can be installed in :ref:`editable mode <editable-installs>` (using the :ref:`--editable <install_--editable>` option) or not.
* For editable installs, the clone location by default is "<venv path>/src/SomeProject" in virtual environments, and "<cwd>/src/SomeProject" for global intalls. * For editable installs, the clone location by default is "<venv path>/src/SomeProject" in virtual environments, and "<cwd>/src/SomeProject" for global installs.
The :ref:`--src <install_--src>` option can be used to modify this location. The :ref:`--src <install_--src>` option can be used to modify this location.
* For non-editable installs, the project is built locally in a temp dir and then installed normally. * For non-editable installs, the project is built locally in a temp dir and then installed normally.

View File

@ -21,7 +21,7 @@ if "%1" == "help" (
echo. singlehtml to make a single large HTML file echo. singlehtml to make a single large HTML file
echo. pickle to make pickle files echo. pickle to make pickle files
echo. json to make JSON files echo. json to make JSON files
echo. htmlhelp to make HTML files and a HTML help project echo. htmlhelp to make HTML files and an HTML help project
echo. qthelp to make HTML files and a qthelp project echo. qthelp to make HTML files and a qthelp project
echo. devhelp to make HTML files and a Devhelp project echo. devhelp to make HTML files and a Devhelp project
echo. epub to make an epub echo. epub to make an epub

View File

@ -72,7 +72,7 @@ Examples
$ pip install --upgrade SomePackage $ pip install --upgrade SomePackage
4) Install a local project in in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`. 4) Install a local project in "editable" mode. See the section on :ref:`Editable Installs <editable-installs>`.
:: ::

View File

@ -162,7 +162,7 @@ class ConfigOptionParser(CustomOptionParser):
val = option.convert_value(key, val) val = option.convert_value(key, val)
except optparse.OptionValueError: except optparse.OptionValueError:
e = sys.exc_info()[1] e = sys.exc_info()[1]
print("An error occured during configuration: %s" % e) print("An error occurred during configuration: %s" % e)
sys.exit(3) sys.exit(3)
defaults[option.dest] = val defaults[option.dest] = val
return defaults return defaults

View File

@ -31,17 +31,33 @@ commands = {
} }
def get_summaries(ignore_hidden=True): commands_order = [
"""Return a sorted list of (command name, command summary).""" InstallCommand,
items = [] UninstallCommand,
FreezeCommand,
ListCommand,
ShowCommand,
SearchCommand,
ZipCommand,
UnzipCommand,
BundleCommand,
HelpCommand,
]
for name, command_class in commands.items():
def get_summaries(ignore_hidden=True, ordered=True):
"""Yields sorted (command name, command summary) tuples."""
if ordered:
cmditems = _sort_commands(commands, commands_order)
else:
cmditems = commands.items()
for name, command_class in cmditems:
if ignore_hidden and command_class.hidden: if ignore_hidden and command_class.hidden:
continue continue
items.append((name, command_class.summary)) yield (name, command_class.summary)
return sorted(items)
def get_similar_commands(name): def get_similar_commands(name):
@ -56,3 +72,14 @@ def get_similar_commands(name):
guess = False guess = False
return guess return guess
def _sort_commands(cmddict, order):
def keyfn(key):
try:
return order.index(key[1])
except ValueError:
# unordered items should come last
return 0xff
return sorted(cmddict.items(), key=keyfn)

View File

@ -43,7 +43,6 @@ class ListCommand(Command):
default=False, default=False,
help='If in a virtualenv that has global access, do not list globally-installed packages.') help='If in a virtualenv that has global access, do not list globally-installed packages.')
index_opts = make_option_group(index_group, self.parser) index_opts = make_option_group(index_group, self.parser)
self.parser.insert_option_group(0, index_opts) self.parser.insert_option_group(0, index_opts)
@ -121,6 +120,7 @@ class ListCommand(Command):
self.output_package_listing(installed_packages) self.output_package_listing(installed_packages)
def output_package_listing(self, installed_packages): def output_package_listing(self, installed_packages):
installed_packages = sorted(installed_packages, key=lambda dist: dist.project_name.lower())
for dist in installed_packages: for dist in installed_packages:
if dist_is_editable(dist): if dist_is_editable(dist):
line = '%s (%s, %s)' % (dist.project_name, dist.version, dist.location) line = '%s (%s, %s)' % (dist.project_name, dist.version, dist.location)

View File

@ -305,7 +305,7 @@ exec(compile(open(__file__).read().replace('\\r\\n', '\\n'), __file__, 'exec'))
filenames = [f for f in filenames if f.endswith('.egg-info')] filenames = [f for f in filenames if f.endswith('.egg-info')]
if not filenames: if not filenames:
raise InstallationError('No files/directores in %s (from %s)' % (base, filename)) raise InstallationError('No files/directories in %s (from %s)' % (base, filename))
assert filenames, "No files/directories in %s (from %s)" % (base, filename) assert filenames, "No files/directories in %s (from %s)" % (base, filename)
# if we have more than one match, we pick the toplevel one. This can # if we have more than one match, we pick the toplevel one. This can
@ -849,7 +849,7 @@ class RequirementSet(object):
else: else:
if self.has_requirement(name): if self.has_requirement(name):
raise InstallationError( raise InstallationError(
'Double requirement given: %s (aready in %s, name=%r)' 'Double requirement given: %s (already in %s, name=%r)'
% (install_req, self.get_requirement(name), name)) % (install_req, self.get_requirement(name), name))
self.requirements[name] = install_req self.requirements[name] = install_req
## FIXME: what about other normalizations? E.g., _ vs. -? ## FIXME: what about other normalizations? E.g., _ vs. -?

View File

@ -13,7 +13,7 @@ from pip.exceptions import BadCommand
from pip.backwardcompat import ssl from pip.backwardcompat import ssl
from tests.test_pip import (here, reset_env, run_pip, pyversion, mkdir, from tests.test_pip import (here, reset_env, run_pip, pyversion, mkdir,
src_folder, write_file) src_folder, write_file, path_to_url)
from tests.local_repos import local_checkout from tests.local_repos import local_checkout
from tests.path import Path from tests.path import Path
@ -105,7 +105,7 @@ def test_install_from_mirrors_with_specific_mirrors():
Test installing a package from a specific PyPI mirror. Test installing a package from a specific PyPI mirror.
""" """
e = reset_env() e = reset_env()
result = run_pip('install', '-vvv', '--use-mirrors', '--mirrors', "http://d.pypi.python.org/", '--no-index', 'INITools==0.2') result = run_pip('install', '-vvv', '--use-mirrors', '--mirrors', "http://a.pypi.python.org/", '--no-index', 'INITools==0.2')
egg_info_folder = e.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion egg_info_folder = e.site_packages / 'INITools-0.2-py%s.egg-info' % pyversion
initools_folder = e.site_packages / 'initools' initools_folder = e.site_packages / 'initools'
assert egg_info_folder in result.files_created, str(result) assert egg_info_folder in result.files_created, str(result)
@ -503,10 +503,13 @@ def test_install_package_with_root():
""" """
env = reset_env() env = reset_env()
root_dir = env.scratch_path/'root' root_dir = env.scratch_path/'root'
result = run_pip('install', '--root', root_dir, "--install-option=--home=''", find_links = path_to_url(os.path.join(here, 'packages'))
'--install-option=--install-lib=lib/python', "initools==0.1") result = run_pip('install', '--root', root_dir, '-f', find_links, '--no-index', 'simple==1.0')
normal_install_path = env.root_path / env.site_packages / 'simple-1.0-py%s.egg-info' % pyversion
assert Path('scratch')/'root'/'lib'/'python'/'initools' in result.files_created, str(result) #use distutils to change the root exactly how the --root option does it
from distutils.util import change_root
root_path = change_root(os.path.join(env.scratch, 'root'), normal_install_path)
assert root_path in result.files_created, str(result)
def test_find_command_folder_in_path(): def test_find_command_folder_in_path():