Tweak snapdiff API, we can use it as a module
authorLingchao Xin <lingchaox.xin@intel.com>
Fri, 29 Nov 2013 09:53:38 +0000 (17:53 +0800)
committerLingchao Xin <lingchaox.xin@intel.com>
Fri, 29 Nov 2013 09:53:50 +0000 (17:53 +0800)
Change-Id: Ic392844988249a3a74c7b05be7025513469b2a95

setup.py
snapdiff/__init__.py
tools/repo-diff

index 4ce3b72e6aad3c8593937da0127b49d2eec8699b..e4aaaa498d9056a7f84d733e8ce7435ac92aa387 100644 (file)
--- 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'],
index 1e5a5e759116164a4321dfe4f1186ee342fdb426..afe3d8ef1bf134ea1f87d54a067b747a7c22d171 100644 (file)
@@ -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']
index e73d2724bca52311dd4e11957b308e19cb161958..d94eebeac2c8433b9a21775d4967018a7c0eef42 100755 (executable)
@@ -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