~ubuntu-branches/ubuntu/saucy/click/saucy-proposed

« back to all changes in this revision

Viewing changes to click/commands/install.py

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2013-06-27 15:57:25 UTC
  • Revision ID: package-import@ubuntu.com-20130627155725-1kpggp0xots3peir
Tags: 0.1.3
Rename to click, per Mark Shuttleworth.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright (C) 2013 Canonical Ltd.
 
2
# Author: Colin Watson <cjwatson@ubuntu.com>
 
3
 
 
4
# This program is free software: you can redistribute it and/or modify
 
5
# it under the terms of the GNU General Public License as published by
 
6
# the Free Software Foundation; version 3 of the License.
 
7
#
 
8
# This program is distributed in the hope that it will be useful,
 
9
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
# GNU General Public License for more details.
 
12
#
 
13
# You should have received a copy of the GNU General Public License
 
14
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 
 
16
"""Install a Click package."""
 
17
 
 
18
from __future__ import print_function
 
19
 
 
20
from optparse import OptionParser
 
21
 
 
22
from click.install import ClickInstaller
 
23
 
 
24
 
 
25
# TODO: make configurable in build system or configuration file or similar?
 
26
default_root = "/opt/click.ubuntu.com"
 
27
 
 
28
 
 
29
def run(argv):
 
30
    parser = OptionParser("%prog install [options] PACKAGE-FILE")
 
31
    parser.add_option(
 
32
        "--root", metavar="PATH", default=default_root,
 
33
        help="set top-level directory to PATH (default: %s)" % default_root)
 
34
    parser.add_option(
 
35
        "--force-missing-framework", action="store_true", default=False,
 
36
        help="install despite missing system framework")
 
37
    options, args = parser.parse_args(argv)
 
38
    if len(args) < 1:
 
39
        parser.error("need package file name")
 
40
    package_path = args[0]
 
41
    installer = ClickInstaller(options.root, options.force_missing_framework)
 
42
    installer.install(package_path)
 
43
    return 0