From be998593dddfa54ad3828abb7692bb67db46edbc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrien=20Verg=C3=A9?= Date: Sun, 24 Jan 2016 18:02:42 +0100 Subject: [PATCH] Distribution: Create script with `setup.py` --- bin/yamllint | 24 ------------------------ setup.py | 2 +- yamllint/cli.py | 2 +- 3 files changed, 2 insertions(+), 26 deletions(-) delete mode 100755 bin/yamllint diff --git a/bin/yamllint b/bin/yamllint deleted file mode 100755 index ebc0deb..0000000 --- a/bin/yamllint +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright (C) 2016 Adrien Vergé -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . - -import sys - -from yamllint import cli - - -if __name__ == '__main__': - cli.run(sys.argv[1:]) diff --git a/setup.py b/setup.py index 7398f09..d7d8abd 100644 --- a/setup.py +++ b/setup.py @@ -42,7 +42,7 @@ setup( ], packages=find_packages(), - scripts=['bin/yamllint'], + entry_points={'console_scripts': ['yamllint=yamllint.cli:run']}, package_data={'yamllint': ['conf/*.yml']}, install_requires=['pyyaml'], tests_require=['nose'], diff --git a/yamllint/cli.py b/yamllint/cli.py index a1f7d68..78901b6 100644 --- a/yamllint/cli.py +++ b/yamllint/cli.py @@ -62,7 +62,7 @@ class Format(object): return line -def run(argv): +def run(argv=None): parser = argparse.ArgumentParser(prog=APP_NAME, description=APP_DESCRIPTION) parser.add_argument('files', metavar='FILE_OR_DIR', nargs='+',