~mvo/click/repository

« back to all changes in this revision

Viewing changes to click/commands/info.py

  • Committer: Michael Vogt
  • Date: 2014-10-14 11:53:09 UTC
  • Revision ID: michael.vogt@ubuntu.com-20141014115309-kx3lnwbr8ye76n43
click/commands/info.py: always search local/remote click names in click info

Show diffs side-by-side

added added

removed removed

Lines of Context:
78
78
        help="look up PACKAGE-NAME for USER (if you have permission; "
79
79
             "default: current user)")
80
80
    parser.add_option(
81
 
        "--remote", default=False, action="store_true",
82
 
        help="look in remote repository if it is not found locally")
 
81
        "--repository", default=False, action="store_true",
 
82
        help="Search in remote repository only")
 
83
    parser.add_option(
 
84
        "--no-repository", default=False, action="store_true",
 
85
        help="Never search in a remote repository ")
83
86
    options, args = parser.parse_args(argv)
84
87
    pkgname = args[0]
85
88
    if len(args) < 1:
86
89
        parser.error("need file name")
87
 
    try:
88
 
        manifest = get_manifest(options, pkgname)
89
 
    except Exception as e:
90
 
        if not options.remote:
91
 
            print(e, file=sys.stderr)
92
 
            return 1
 
90
 
 
91
    # see if its available locally: pkgname, click-path, path-to-unpacked-click
 
92
    manifest = None
 
93
    if not options.repository:
 
94
        try:
 
95
            manifest = get_manifest(options, pkgname)
 
96
        except Exception as e:
 
97
            pass
 
98
    
 
99
    # now check remote
 
100
    if manifest is None and not options.no_repository:
93
101
        repo = get_repository()
94
102
        try:
95
103
            details = repo.details(pkgname)
111
119
                                  'keywords',
112
120
                                  'license',
113
121
                              )}
 
122
            manifest["_repository"] = repo.description
114
123
        except ClickRepositoryError as e:
115
124
            print(
116
125
                "Can not get details for %s:%s" % (pkgname, e), file=sys.stderr)