From 039b96217bcc92ea20268a9466caa42a9a8ce9c9 Mon Sep 17 00:00:00 2001
From: Dan Callaghan <dcallagh@redhat.com>
Date: Thu, 16 Jun 2016 16:30:40 +1000
Subject: [PATCH 2/2] use setuptools console_scripts for /usr/bin/unidiff
---
setup.py | 6 +++++-
bin/unidiff => unidiff/cli.py | 7 ++++---
2 files changed, 9 insertions(+), 4 deletions(-)
rename bin/unidiff => unidiff/cli.py (98%)
mode change 100755 => 100644
diff --git a/setup.py b/setup.py
index 54ca7b4..1359493 100644
--- a/setup.py
+++ b/setup.py
@@ -17,7 +17,11 @@
url='http://github.com/matiasb/python-unidiff',
license='MIT',
packages=find_packages(exclude=['tests']),
- scripts=['bin/unidiff'],
+ entry_points={
+ 'console_scripts': [
+ 'unidiff = unidiff.cli:main',
+ ],
+ },
classifiers=[
'Intended Audience :: Developers',
'Development Status :: 4 - Beta',
diff --git a/bin/unidiff b/unidiff/cli.py
old mode 100755
new mode 100644
similarity index 98%
rename from bin/unidiff
rename to unidiff/cli.py
index 084df6f..b879ee5
--- a/bin/unidiff
+++ b/unidiff/cli.py
@@ -1,4 +1,3 @@
-#!/usr/bin/env python
from __future__ import print_function, unicode_literals
@@ -30,8 +29,7 @@ def get_parser():
help='if not specified, read diff data from stdin')
return parser
-
-if __name__ == '__main__':
+def main():
parser = get_parser()
args = parser.parse_args()
@@ -66,3 +64,6 @@ def get_parser():
len(patch.modified_files), len(patch.added_files),
len(patch.removed_files)))
print('Total: %d addition(s), %d deletion(s)' % (additions, deletions))
+
+if __name__ == '__main__':
+ main()
--
2.4.11