comparison venv/lib/python2.7/site-packages/pip/commands/freeze.py @ 0:d67268158946 draft

planemo upload commit a3f181f5f126803c654b3a66dd4e83a48f7e203b
author bcclaywell
date Mon, 12 Oct 2015 17:43:33 -0400
parents
children
comparison
equal deleted inserted replaced
-1:000000000000 0:d67268158946
1 from __future__ import absolute_import
2
3 import sys
4
5 from pip.basecommand import Command
6 from pip.operations.freeze import freeze
7
8
9 class FreezeCommand(Command):
10 """
11 Output installed packages in requirements format.
12
13 packages are listed in a case-insensitive sorted order.
14 """
15 name = 'freeze'
16 usage = """
17 %prog [options]"""
18 summary = 'Output installed packages in requirements format.'
19 log_streams = ("ext://sys.stderr", "ext://sys.stderr")
20
21 def __init__(self, *args, **kw):
22 super(FreezeCommand, self).__init__(*args, **kw)
23
24 self.cmd_opts.add_option(
25 '-r', '--requirement',
26 dest='requirement',
27 action='store',
28 default=None,
29 metavar='file',
30 help="Use the order in the given requirements file and its "
31 "comments when generating output.")
32 self.cmd_opts.add_option(
33 '-f', '--find-links',
34 dest='find_links',
35 action='append',
36 default=[],
37 metavar='URL',
38 help='URL for finding packages, which will be added to the '
39 'output.')
40 self.cmd_opts.add_option(
41 '-l', '--local',
42 dest='local',
43 action='store_true',
44 default=False,
45 help='If in a virtualenv that has global access, do not output '
46 'globally-installed packages.')
47 self.cmd_opts.add_option(
48 '--user',
49 dest='user',
50 action='store_true',
51 default=False,
52 help='Only output packages installed in user-site.')
53
54 self.parser.insert_option_group(0, self.cmd_opts)
55
56 def run(self, options, args):
57 freeze_kwargs = dict(
58 requirement=options.requirement,
59 find_links=options.find_links,
60 local_only=options.local,
61 user_only=options.user,
62 skip_regex=options.skip_requirements_regex,
63 isolated=options.isolated_mode)
64
65 for line in freeze(**freeze_kwargs):
66 sys.stdout.write(line + '\n')