From 73c175f5a0a7e749357e74f518c89b716b7e34b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Fri, 29 Jul 2011 02:20:39 +0200 Subject: Let pysetup list exit with a non-zero code when no result is found (#11409). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit “pysetup list” or “pysetup list --all” will continue to return 0 if no distribution is found (it’s not an error), but “pysetup list some.project” will now exit with 1 if no matching installed distribution is found. Based on a patch by Kelsey Hightower. --- Lib/packaging/run.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Lib/packaging/run.py b/Lib/packaging/run.py index 3e720cf..bcc3c21 100644 --- a/Lib/packaging/run.py +++ b/Lib/packaging/run.py @@ -358,8 +358,10 @@ def _list(dispatcher, args, **kw): dists = get_distributions(use_egg_info=True) if 'all' in opts or opts['args'] == []: results = dists + listall = True else: results = [d for d in dists if d.name.lower() in opts['args']] + listall = False number = 0 for dist in results: @@ -368,7 +370,11 @@ def _list(dispatcher, args, **kw): print() if number == 0: - print('Nothing seems to be installed.') + if listall: + print('Nothing seems to be installed.') + else: + print('No matching distribution found.') + return 1 else: print('Found %d projects installed.' % number) -- cgit v0.12 tion framework that is used for developing application software that can be run on various software and hardware platforms with little or no change in the underlying codebase, while still being a native application with native capabilities and speed.
summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_script_qscriptable.cpp
blob: b701c2c8e00644e02b5e57183b1f68986034cdf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/****************************************************************************
**
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (qt-info@nokia.com)
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** No Commercial Usage
** This file contains pre-release code and may not be distributed.
** You may use this file in accordance with the terms and conditions
** contained in the Technology Preview License Agreement accompanying
** this package.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Nokia gives you certain additional
** rights.  These rights are described in the Nokia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** If you have questions regarding the use of this file, please contact
** Nokia at qt-info@nokia.com.
**
**
**
**
**
**
**
**
** $QT_END_LICENSE$
**
****************************************************************************/

//! [0]
class MyScriptableObject: public QObject,
      protected QScriptable
{
    Q_OBJECT
...

public slots:
    void doSomething();
    double doSomethingElse();
}
//! [0]


//! [1]
void MyScriptableObject::doSomething()
{
  context()->throwError("Threw an error from a slot");
}

double MyScriptableObject::doSomethingElse()
{
  return qscriptvalue_cast<double>(thisObject());
}
//! [1]