mirror of
https://github.com/rpm-software-management/tito.git
synced 2025-02-23 12:12:47 +00:00
Automatically create tito's console script
Create tito.cli.main() which serves as command line's entry point that can be used: - by setuptools' 'console_scripts' entry point mechanism for automatic script creation, - via 'if __name__ == "__main__":'. Remove pre-generated bin/tito script. Update SPEC file.
This commit is contained in:
parent
805ce9ca4a
commit
9820841af5
4 changed files with 19 additions and 27 deletions
25
bin/tito
25
bin/tito
|
@ -1,25 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Copyright (c) 2008,2009 Red Hat, Inc.
|
||||
#
|
||||
# This software is licensed to you under the GNU General Public License,
|
||||
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
|
||||
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
|
||||
# FOR A PARTICULAR PURPOSE. You should have received a copy of GPLv2
|
||||
# along with this software; if not, see
|
||||
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.
|
||||
#
|
||||
# Red Hat trademarks are not licensed under GPLv2. No permission is
|
||||
# granted to use or replicate Red Hat trademarks that are incorporated
|
||||
# in this software or its documentation.
|
||||
#
|
||||
|
||||
import sys
|
||||
|
||||
from tito.cli import CLI
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
CLI().main(sys.argv[1:])
|
||||
except KeyboardInterrupt:
|
||||
pass
|
8
setup.py
8
setup.py
|
@ -37,9 +37,15 @@ setup(
|
|||
'blessed'
|
||||
],
|
||||
|
||||
# automatically create console scripts
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'tito = tito.cli:main',
|
||||
],
|
||||
},
|
||||
|
||||
# non-python scripts go here
|
||||
scripts=[
|
||||
'bin/tito',
|
||||
'bin/generate-patches.pl'
|
||||
],
|
||||
|
||||
|
|
|
@ -887,3 +887,15 @@ CLI_MODULES = {
|
|||
"report": ReportModule,
|
||||
"init": InitModule,
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
"""Command line's entry point."""
|
||||
try:
|
||||
CLI().main(sys.argv[1:])
|
||||
except KeyboardInterrupt:
|
||||
pass
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
|
@ -80,7 +80,6 @@ git.
|
|||
|
||||
%prep
|
||||
%setup -q -n tito-%{version}
|
||||
sed -i 1"s|#!.*|#!%{ourpythonbin}|" bin/tito
|
||||
|
||||
%build
|
||||
%{ourpythonbin} setup.py build
|
||||
|
|
Loading…
Add table
Reference in a new issue