Skip to content

pip support for wheel #845

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 44 commits into from
Mar 16, 2013
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
aa5b33d
experimental support for installing wheel archives
dholth Oct 2, 2012
2d3cd9d
use the constructed exename
qwcode Oct 2, 2012
fe443fa
wheel doc updates
qwcode Oct 2, 2012
7433867
Guard the chmod in case external_attr is 0.
qwcode Oct 12, 2012
60089cf
remove pip channel notifications
qwcode Oct 12, 2012
aaf18e3
set the travis branches
qwcode Oct 12, 2012
50c2111
Add platform checks to wheel location code
pfmoore Oct 12, 2012
6e481b1
Merge pull request #8 from pfmoore/wheel_install_platcheck
qwcode Oct 14, 2012
4bfc92d
'pip wheel'
qwcode Oct 16, 2012
cdcdf45
'pip wheel' doesn't support py25
qwcode Oct 16, 2012
a0cd7b6
use CommandError
qwcode Oct 16, 2012
e0f3535
make sure bdist_wheel is available up front
dholth Oct 17, 2012
7e36aae
Merge pull request #14 from dholth/wheel_build
qwcode Oct 18, 2012
8d68f7f
Merge pull request #12 from qwcode/wheel_build
qwcode Oct 18, 2012
b7a88b8
Allow --use-wheel in requirements files
pfmoore Oct 24, 2012
be12f79
merge pypa/develop
qwcode Oct 25, 2012
57c19d3
Merge pull request #19 from pfmoore/wheel_in_req
qwcode Oct 25, 2012
d1dc699
pip wheel --unpack-only test fix
qwcode Oct 25, 2012
1379091
remove 'import *'
dholth Oct 27, 2012
ed0c239
allow pip wheel --use-wheel ...
dholth Oct 27, 2012
9087a6f
skip trying to build wheels for requirements found as wheels
dholth Oct 27, 2012
467616f
Merge pull request #23 from dholth/wheel_build
qwcode Oct 28, 2012
7ece6f4
add --no-deps option to "pip wheel"
qwcode Oct 28, 2012
edbd5c2
don't ignore building pip/setuptools/distribute
qwcode Oct 28, 2012
1873e80
import check at 'pip wheel' command level is enough
qwcode Oct 28, 2012
4b01b90
Give wheels priority over sdists when installing
pfmoore Oct 28, 2012
28ffb1b
Merge pull request #25 from pfmoore/wheel_priority
qwcode Oct 28, 2012
51ced03
test readme update
qwcode Nov 4, 2012
7ad52b4
link sort key as instance method; guard when link is InfLink
qwcode Nov 4, 2012
dff849c
existing install has priority over wheels
qwcode Nov 4, 2012
9c271ba
distutils scheme util for wheel installs; --user/--target support fo…
qwcode Nov 15, 2012
fa1b104
no user scheme until python 2.6
qwcode Nov 15, 2012
6bbf963
no need to override purelib/platlib in virtualenvs
qwcode Nov 16, 2012
ec33da2
Merge pull request #28 from qwcode/get_paths
qwcode Nov 16, 2012
ae8a062
mention 'pip wheel' in docs
qwcode Nov 18, 2012
53bbdf5
merge with pypa/pip:develop
qwcode Nov 29, 2012
cabd1d5
merge with pypa/pip/develop
qwcode Feb 3, 2013
8659f3d
wheel cli fixes
qwcode Feb 3, 2013
354a750
wheel doc update
qwcode Feb 3, 2013
db165f1
have find_link path work for windows tests
qwcode Feb 3, 2013
299eb77
make test windows compatible
qwcode Feb 3, 2013
00fa9be
merge with develop
qwcode Mar 16, 2013
13b023e
move wheel help to class doc string
qwcode Mar 16, 2013
07c48ea
set the help order of 'wheel'
qwcode Mar 16, 2013
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ before_install:
install: pip install nose virtualenv scripttest mock
script: nosetests
notifications:
irc: "irc.freenode.org#pip"
branches:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this removal intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch.. will add that back

only:
- develop
Expand Down
37 changes: 37 additions & 0 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,43 @@ Examples
peppercorn - A library for converting a token stream into [...]


pip wheel
---------

Usage
*****

.. pip-command-usage:: wheel


Description
***********

.. pip-command-description:: wheel

Options
*******

**Wheel Options:**

.. pip-command-options:: wheel

**Other Options:**

* :ref:`Package Index Options <Package Index Options>`
* :ref:`General Options <General Options>`

Examples
********

1. Build wheels for a requirement (and all it's dependencies), and then install

::

$ pip wheel --wheel-dir=/tmp/wheelhouse SomePackage
$ pip install --use-wheel --no-index --find-links=/tmp/wheelhouse SomePackage


pip zip
-------

Expand Down
57 changes: 57 additions & 0 deletions pip/cmdoptions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
"""shared options and groups"""
from optparse import make_option, OptionGroup
from pip.locations import build_prefix


def make_option_group(group, parser):
Expand Down Expand Up @@ -62,6 +63,62 @@ def make_option_group(group, parser):
default=[],
help='Specific mirror URLs to query when --use-mirrors is used.')

requirements = make_option(
'-r', '--requirement',
dest='requirements',
action='append',
default=[],
metavar='file',
help='Install from the given requirements file. '
'This option can be used multiple times.')

use_wheel = make_option(
'--use-wheel',
dest='use_wheel',
action='store_true',
help='Find wheel archives when searching indexes and find-links locations.')

download_cache = make_option(
'--download-cache',
dest='download_cache',
metavar='dir',
default=None,
help='Cache downloaded packages in <dir>.')

no_deps = make_option(
'--no-deps', '--no-dependencies',
dest='ignore_dependencies',
action='store_true',
default=False,
help="Don't install package dependencies.")

build_dir = make_option(
'-b', '--build', '--build-dir', '--build-directory',
dest='build_dir',
metavar='dir',
default=build_prefix,
help='Directory to unpack packages into and build in. '
'The default in a virtualenv is "<venv path>/build". '
'The default for global installs is "<OS temp dir>/pip-build-<username>".')

install_options = make_option(
'--install-option',
dest='install_options',
action='append',
metavar='options',
help="Extra arguments to be supplied to the setup.py install "
"command (use like --install-option=\"--install-scripts=/usr/local/bin\"). "
"Use multiple --install-option options to pass multiple options to setup.py install. "
"If you are using an option with a directory path, be sure to use absolute path.")

global_options = make_option(
'--global-option',
dest='global_options',
action='append',
metavar='options',
help="Extra global options to be supplied to the setup.py "
"call before the install command.")


##########
# groups #
Expand Down
3 changes: 3 additions & 0 deletions pip/commands/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
from pip.commands.uninstall import UninstallCommand
from pip.commands.unzip import UnzipCommand
from pip.commands.zip import ZipCommand
from pip.commands.wheel import WheelCommand


commands = {
Expand All @@ -28,6 +29,7 @@
UnzipCommand.name: UnzipCommand,
ZipCommand.name: ZipCommand,
ListCommand.name: ListCommand,
WheelCommand.name: WheelCommand,
}


Expand All @@ -38,6 +40,7 @@
ListCommand,
ShowCommand,
SearchCommand,
WheelCommand,
ZipCommand,
UnzipCommand,
BundleCommand,
Expand Down
69 changes: 18 additions & 51 deletions pip/commands/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
import shutil
from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.log import logger
from pip.locations import build_prefix, src_prefix, virtualenv_no_global
from pip.locations import src_prefix, virtualenv_no_global
from pip.basecommand import Command
from pip.index import PackageFinder
from pip.exceptions import InstallationError, CommandError
from pip.backwardcompat import home_lib
from pip.cmdoptions import make_option_group, index_group
from pip import cmdoptions


class InstallCommand(Command):
Expand Down Expand Up @@ -52,23 +52,8 @@ def __init__(self, *args, **kw):
metavar='path/url',
help='Install a project in editable mode (i.e. setuptools "develop mode") from a local project path or a VCS url.')

cmd_opts.add_option(
'-r', '--requirement',
dest='requirements',
action='append',
default=[],
metavar='file',
help='Install from the given requirements file. '
'This option can be used multiple times.')

cmd_opts.add_option(
'-b', '--build', '--build-dir', '--build-directory',
dest='build_dir',
metavar='dir',
default=build_prefix,
help='Directory to unpack packages into and build in. '
'The default in a virtualenv is "<venv path>/build". '
'The default for global installs is "<OS temp dir>/pip-build-<username>".')
cmd_opts.add_option(cmdoptions.requirements)
cmd_opts.add_option(cmdoptions.build_dir)

cmd_opts.add_option(
'-t', '--target',
Expand All @@ -84,12 +69,7 @@ def __init__(self, *args, **kw):
default=None,
help="Download packages into <dir> instead of installing them, irregardless of what's already installed.")

cmd_opts.add_option(
'--download-cache',
dest='download_cache',
metavar='dir',
default=None,
help='Cache downloaded packages in <dir>.')
cmd_opts.add_option(cmdoptions.download_cache)

cmd_opts.add_option(
'--src', '--source', '--source-dir', '--source-directory',
Expand Down Expand Up @@ -120,12 +100,7 @@ def __init__(self, *args, **kw):
action='store_true',
help='Ignore the installed packages (reinstalling instead).')

cmd_opts.add_option(
'--no-deps', '--no-dependencies',
dest='ignore_dependencies',
action='store_true',
default=False,
help="Don't install package dependencies.")
cmd_opts.add_option(cmdoptions.no_deps)

cmd_opts.add_option(
'--no-install',
Expand All @@ -140,23 +115,8 @@ def __init__(self, *args, **kw):
help="Don't download any packages, just install the ones already downloaded "
"(completes an install run with --no-install).")

cmd_opts.add_option(
'--install-option',
dest='install_options',
action='append',
metavar='options',
help="Extra arguments to be supplied to the setup.py install "
"command (use like --install-option=\"--install-scripts=/usr/local/bin\"). "
"Use multiple --install-option options to pass multiple options to setup.py install. "
"If you are using an option with a directory path, be sure to use absolute path.")

cmd_opts.add_option(
'--global-option',
dest='global_options',
action='append',
metavar='options',
help="Extra global options to be supplied to the setup.py "
"call before the install command.")
cmd_opts.add_option(cmdoptions.install_options)
cmd_opts.add_option(cmdoptions.global_options)

cmd_opts.add_option(
'--user',
Expand All @@ -177,13 +137,15 @@ def __init__(self, *args, **kw):
default=None,
help="Install everything relative to this alternate root directory.")

cmd_opts.add_option(cmdoptions.use_wheel)

cmd_opts.add_option(
'--pre',
action='store_true',
default=False,
help="Include pre-release and development versions. By default, pip only finds stable versions.")

index_opts = make_option_group(index_group, self.parser)
index_opts = cmdoptions.make_option_group(cmdoptions.index_group, self.parser)

self.parser.insert_option_group(0, index_opts)
self.parser.insert_option_group(0, cmd_opts)
Expand All @@ -197,7 +159,8 @@ def _build_package_finder(self, options, index_urls):
return PackageFinder(find_links=options.find_links,
index_urls=index_urls,
use_mirrors=options.use_mirrors,
mirrors=options.mirrors)
mirrors=options.mirrors,
use_wheel=options.use_wheel)

def run(self, options, args):
if options.download_dir:
Expand All @@ -210,13 +173,16 @@ def run(self, options, args):
if virtualenv_no_global():
raise InstallationError("Can not perform a '--user' install. User site-packages are not visible in this virtualenv.")
install_options.append('--user')

temp_target_dir = None
if options.target_dir:
options.ignore_installed = True
temp_target_dir = tempfile.mkdtemp()
options.target_dir = os.path.abspath(options.target_dir)
if os.path.exists(options.target_dir) and not os.path.isdir(options.target_dir):
raise CommandError("Target path exists but is not a directory, will not continue.")
install_options.append('--home=' + temp_target_dir)

global_options = options.global_options or []
index_urls = [options.index_url] + options.extra_index_urls
if options.no_index:
Expand All @@ -235,7 +201,8 @@ def run(self, options, args):
ignore_installed=options.ignore_installed,
ignore_dependencies=options.ignore_dependencies,
force_reinstall=options.force_reinstall,
use_user_site=options.use_user_site)
use_user_site=options.use_user_site,
target_dir=temp_target_dir)
for name in args:
requirement_set.add_requirement(
InstallRequirement.from_line(name, None, prereleases=options.pre))
Expand Down
Loading