From: Lingchao Xin Date: Fri, 29 Nov 2013 09:53:38 +0000 (+0800) Subject: Tweak snapdiff API, we can use it as a module X-Git-Tag: submit/devel/20190730.075508~36 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=65e0eb12ce9139ed1219a1abfb43a23a75f39e41;p=services%2Fpython-snapdiff.git Tweak snapdiff API, we can use it as a module Change-Id: Ic392844988249a3a74c7b05be7025513469b2a95 --- diff --git a/setup.py b/setup.py index 4ce3b72..e4aaaa4 100644 --- a/setup.py +++ b/setup.py @@ -1,17 +1,19 @@ #!/usr/bin/env python +import snapdiff + try: from setuptools import setup except ImportError: from distutils.core import setup -setup(name = 'python-snapdiff', - version = '0.1', - description = 'Generate image and repo diffs', - author = 'Lingchao Xin', - author_email = 'lingchaox.xin@intel.com', - url = 'http://www.tizen.org/', - scripts = ['tools/repo-diff',], +setup(name=snapdiff.__title__, + version=snapdiff.__version__, + description='Generate image and repo diffs', + author='Lingchao Xin', + author_email='lingchaox.xin@intel.com', + url='http://www.tizen.org/', + scripts=['tools/repo-diff',], packages=['snapdiff',], include_package_data=True, install_requires=['Jinja2>=2.6', 'requests>=2.0.1'], diff --git a/snapdiff/__init__.py b/snapdiff/__init__.py index 1e5a5e7..afe3d8e 100644 --- a/snapdiff/__init__.py +++ b/snapdiff/__init__.py @@ -1,2 +1,18 @@ +""" +Snapdiff is used to generate image and repo diffs. You can use it as a module: + + >>> import snapdiff + >>> snapdiff.diff_to_JSON('old url', 'new url') + >>> snapdiff.diff_to_HTML('old url', 'new url') + +or use it directly: + repo-diff [old url] [new url] + ... + +""" + +__title__ = 'python-snapdiff' +__version__ = '0.1' + +from .repo import * -__all__ = ['render', 'repo'] diff --git a/tools/repo-diff b/tools/repo-diff index e73d272..d94eebe 100755 --- a/tools/repo-diff +++ b/tools/repo-diff @@ -1,6 +1,6 @@ #!/usr/bin/env python -from snapdiff.repo import diff_to_JSON, diff_to_HTML +from snapdiff import diff_to_JSON, diff_to_HTML import argparse import sys