From 9218ff15497856ca9e2a7fe72248ddd56faf5f60 Mon Sep 17 00:00:00 2001 From: Karl Moos Date: Sun, 25 Oct 2020 07:24:43 -0500 Subject: [PATCH] Add pieces to allow PyPi package publish --- api/__init__.py | 5 ++- make-and-publish-package.sh | 3 ++ setup.py | 70 +++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100755 make-and-publish-package.sh create mode 100644 setup.py diff --git a/api/__init__.py b/api/__init__.py index b8cf11e..a7db0e9 100644 --- a/api/__init__.py +++ b/api/__init__.py @@ -1 +1,4 @@ -from .APIHandler import APIHandler \ No newline at end of file +from .APIHandler import APIHandler + +__version__ = "0.0.1" +VERSION = __version__ diff --git a/make-and-publish-package.sh b/make-and-publish-package.sh new file mode 100755 index 0000000..43cca45 --- /dev/null +++ b/make-and-publish-package.sh @@ -0,0 +1,3 @@ +rm -fr dist +python setup.py sdist +twine upload dist/* \ No newline at end of file diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..614ea1c --- /dev/null +++ b/setup.py @@ -0,0 +1,70 @@ +#!/usr/bin/python3 + +import os +import re +import codecs +from setuptools import setup + +# Package meta-data. +NAME = 'reolink-api' +DESCRIPTION = 'Reolink Camera API written in Python 3.6' +URL = 'https://github.com/Benehiko/ReolinkCameraAPI' +AUTHOR_EMAIL = '' +AUTHOR = 'Benehiko' +LICENSE = 'GPL-3.0' +INSTALL_REQUIRES = [ + 'pillow', + 'pyyaml', + 'requests>=2.18.4', + 'numpy', + 'opencv-python', + 'pysocks' +] + + +here = os.path.abspath(os.path.dirname(__file__)) +# read the contents of your README file +with open(os.path.join(here, 'README.md'), encoding='utf-8') as f: + long_description = f.read() + + +def read(*parts): + with codecs.open(os.path.join(here, *parts), 'r') as fp: + return fp.read() + + +def find_version(*file_paths): + version_file = read(*file_paths) + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) + if version_match: + return version_match.group(1) + raise RuntimeError("Unable to find version string.") + + +setup(name=NAME, + python_requires='>=3.6.0', + version=find_version('api', '__init__.py'), + description=DESCRIPTION, + long_description=long_description, + long_description_content_type='text/markdown', + author=AUTHOR, + author_email=AUTHOR_EMAIL, + url=URL, + license=LICENSE, + install_requires=INSTALL_REQUIRES, + py_modules=[ + 'Camera', + 'ConfigHandler', + 'RtspClient', + 'resthandle', + 'api.APIHandler', + 'api.device', + 'api.display', + 'api.network', + 'api.ptz', + 'api.recording', + 'api.system', + 'api.user', + 'api.zoom' + ] + )