From 5c8368758a4534a1d4890055d2e2ed74dcdb11e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Sun, 24 Jun 2018 13:49:34 +0200 Subject: [PATCH] Install anishot from pypi Package anishot with openstack-pbr define anishot as a python package. Introduce dependencies management via requirements.txt. Move deprecated gflags to abls-py (https://pypi.python.org/pypi/absl-py) --- .gitignore | 11 ++++++++++ .travis.yml | 25 +++++++++++++++++++++ README.md | 10 ++++++++- anishot/__init__.py | 0 anishot.py => anishot/__main__.py | 13 +++++++---- requirements.txt | 3 +++ setup.cfg | 36 +++++++++++++++++++++++++++++++ setup.py | 7 ++++++ 8 files changed, 100 insertions(+), 5 deletions(-) create mode 100644 .gitignore create mode 100644 .travis.yml create mode 100644 anishot/__init__.py rename anishot.py => anishot/__main__.py (92%) create mode 100644 requirements.txt create mode 100644 setup.cfg create mode 100644 setup.py diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..feae35b --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +anishot.egg-info/ +build/ +*.eggs/ +*__pycache__* +build/ +.tox/ +*.pyc +dist/ +*.swa +*.swp +*~ diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..07fd7a6 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,25 @@ +language: python +cache: + - pip +python: + - '2.7' + - '3.4' + - '3.5' + - 3.5-dev + - '3.6' + - 3.6-dev +before_install: + - pip install -U pip + - pip install -U setuptools + - pip install -U wheel + - pip install -U pbr +script: + - python setup.py install + +deploy: + - provider: pypi + user: sourcerer-io + password: your-pypi-password + on: + tags: true + distributions: sdist bdist_wheel diff --git a/README.md b/README.md index 7dcab91..35cbc7d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,15 @@ Animates a long screenshot into a GIF. Use it to show off long screenshots in yo ![](https://user-images.githubusercontent.com/35666548/41495994-7669ccc8-70e9-11e8-80d4-3253cd0fa963.gif) +## Install + +``` +$ pip install anishot +``` + +## Usage ``` +$ anishot Usage: --h: Window height (default: '0') @@ -25,4 +33,4 @@ Usage: ``` The anishot in this README was generated by: -``python3 anishot.py --in=screenshot.png --h=500 --stops=277,562 --out=anishot.gif --zoom=3 --zoom_frac=.5`` +``anishot --in=screenshot.png --h=500 --stops=277,562 --out=anishot.gif --zoom=3 --zoom_frac=.5`` diff --git a/anishot/__init__.py b/anishot/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/anishot.py b/anishot/__main__.py similarity index 92% rename from anishot.py rename to anishot/__main__.py index f3b1fb1..c2ea858 100644 --- a/anishot.py +++ b/anishot/__main__.py @@ -6,7 +6,7 @@ import os import sys -import gflags +from absl import flags as gflags import imageio import numpy @@ -78,7 +78,8 @@ def make_scroll(image, frames): add_frame(frames, image[s1:s1 + F.h, :], 2) -def main(argv): +def main(): + argv = sys.argv try: F(argv) @@ -92,11 +93,15 @@ def main(argv): imageio.mimwrite(F.out, map(lambda f: f[0], frames), duration=list(map(lambda f: f[1], frames))) - except gflags.FlagsError as e: + except TypeError as e: + print('e: ', e) + print('Usage: %s' % F) + return 1 + except gflags.Error as e: print('e: ', e) print('Usage: %s' % F) return 1 if __name__ == '__main__': - sys.exit(main(sys.argv)) + sys.exit(main()) diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..db9af66 --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +absl-py +imageio +Pillow diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 0000000..a75b134 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,36 @@ +[metadata] +name = anishot +home-page = https://github.com/sourcerer-io/anishot +summary = Animate a long screenshot +description-file = + README.md +author = sourcerer-io +author-email = sergey@sourcerer.io +licence = MIT +classifier = + Development Status :: 5 - Production/Stable + Intended Audience :: Information Technology + License :: OSI Approved :: MIT License + Operating System :: POSIX + Programming Language :: Python + Programming Language :: Python :: 2 + Programming Language :: Python :: 2.7 + Programming Language :: Python :: 3 + Programming Language :: Python :: 3.4 + Programming Language :: Python :: 3.5 + Programming Language :: Python :: 3.6 + +[files] +packages = + anishot + +[extras] +devel= + pbr + +[entry_points] +console_scripts = + anishot = anishot.__main__:main + +[wheel] +universal = 1 diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..78c57ea --- /dev/null +++ b/setup.py @@ -0,0 +1,7 @@ +from setuptools import setup + +setup( + requires=['pbd'], + pbr=True, + long_description_content_type="text/markdown", +)